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:
Richard Freimer authored and GitHub committed 2019-05-13 15:50:02 -04:00
1 parent 52796ff18f
commit c8d2fbbac8
34 files changed
+341 -64

No files matched your search

@@ -15,6 +15,7 @@ import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.PacketHandler;
import mekanism.common.Upgrade;
import mekanism.common.base.IComparatorSupport;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.block.states.BlockStateMachine.MachineType;
@@ -51,7 +52,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityTeleporter extends TileEntityElectricBlock implements IComputerIntegration, IChunkLoader, IFrequencyHandler, IRedstoneControl, ISecurityTile,
IUpgradeTile {
IUpgradeTile, IComparatorSupport {
private static final String[] methods = new String[]{"getEnergy", "canTeleport", "getMaxEnergy", "teleport", "setFrequency"};
public AxisAlignedBB teleportBounds = null;
@@ -164,6 +165,8 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
if (shouldRender != prevShouldRender) {
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new TileNetworkList())),
Coord4D.get(this).getTargetPoint(40D));
//This also means the comparator output changed so notify the neighbors we have a change
MekanismUtils.notifyLoadedNeighborsOfTileChange(world, Coord4D.get(this));
}
prevShouldRender = shouldRender;
teleDelay = Math.max(0, teleDelay - 1);
@@ -555,4 +558,9 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
public TileComponentUpgrade getComponent() {
return upgradeComponent;
}
@Override
public int getRedstoneLevel() {
return shouldRender ? 15 : 0;
}
}