-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Performance and Auto Balancing of SolarFlux Solars
- Loading branch information
1 parent
4dc0cf0
commit 0e2931a
Showing
11 changed files
with
584 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/nomiceu/nomilabs/integration/solarflux/AccessibleInventoryDummy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.nomiceu.nomilabs.integration.solarflux; | ||
|
||
public interface AccessibleInventoryDummy { | ||
|
||
boolean labs$stateChanged(); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/nomiceu/nomilabs/integration/solarflux/AccessibleTileBaseSolar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.nomiceu.nomilabs.integration.solarflux; | ||
|
||
import net.minecraft.util.EnumFacing; | ||
|
||
public interface AccessibleTileBaseSolar { | ||
|
||
void labs$addBlacklistSide(EnumFacing facing); | ||
|
||
long labs$rawEnergy(); | ||
|
||
void labs$setEnergy(long amt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/nomiceu/nomilabs/mixin/solarflux/InventoryDummyMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.nomiceu.nomilabs.mixin.solarflux; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import com.nomiceu.nomilabs.integration.solarflux.AccessibleInventoryDummy; | ||
|
||
import tk.zeitheron.solarflux.utils.InventoryDummy; | ||
|
||
@Mixin(value = InventoryDummy.class, remap = false) | ||
public class InventoryDummyMixin implements AccessibleInventoryDummy { | ||
|
||
@Unique | ||
private boolean labs$stateChanged = true; | ||
|
||
@Override | ||
public boolean labs$stateChanged() { | ||
var old = labs$stateChanged; | ||
labs$stateChanged = false; | ||
return old; | ||
} | ||
|
||
@Inject(method = "markDirty", at = @At("RETURN"), remap = true) | ||
private void handleMarkDirty(CallbackInfo ci) { | ||
labs$stateChanged = true; | ||
} | ||
|
||
@Inject(method = "setInventorySlotContents", at = @At("RETURN"), remap = true) | ||
private void handleInventoryChanged(int index, ItemStack stack, CallbackInfo ci) { | ||
labs$stateChanged = true; | ||
} | ||
} |
Oops, something went wrong.