mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Add comparator support for a large number of blocks (#5474)
* Add comparator support to a lot of various blocks. Closes #5447 * Add comparator support for various generator blocks * Cleanup some old calculations not using the new utils method
This commit is contained in:
1 parent
52796ff18f
commit
c8d2fbbac8
34 files changed
+341
-64
No files matched your search
@@ -17,6 +17,7 @@ import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IBoundingBlock;
|
||||
import mekanism.common.base.IComparatorSupport;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.ITankManager;
|
||||
@@ -44,7 +45,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, IActiveState, ISustainedData,
|
||||
ITankManager, ISecurityTile, IUpgradeTile, IUpgradeInfoHandler {
|
||||
ITankManager, ISecurityTile, IUpgradeTile, IUpgradeInfoHandler, IComparatorSupport {
|
||||
|
||||
public static final int MAX_GAS = 10000;
|
||||
private static final int[] INPUT_SLOT = {0};
|
||||
@@ -57,6 +58,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
|
||||
private SolarNeutronRecipe cachedRecipe;
|
||||
|
||||
private int currentRedstoneLevel;
|
||||
private boolean isActive;
|
||||
private boolean needsRainCheck;
|
||||
|
||||
@@ -107,6 +109,12 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
if (world.getTotalWorldTime() % 20 == 0) {
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new TileNetworkList())), new Range4D(Coord4D.get(this)));
|
||||
}
|
||||
|
||||
int newRedstoneLevel = getRedstoneLevel();
|
||||
if (newRedstoneLevel != currentRedstoneLevel) {
|
||||
world.updateComparatorOutputLevel(pos, getBlockType());
|
||||
currentRedstoneLevel = newRedstoneLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,4 +359,9 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
public boolean isItemValidForSlot(int slot, @Nonnull ItemStack stack) {
|
||||
return stack.getItem() instanceof IGasItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedstoneLevel() {
|
||||
return MekanismUtils.redstoneLevelFromContents(inputTank.getStored(), inputTank.getMaxGas());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user