diff --git a/src/com/builtbroken/minecraft/prefab/BlockMulti.java b/src/com/builtbroken/minecraft/prefab/BlockMulti.java index c83e3c0ce..974e08996 100644 --- a/src/com/builtbroken/minecraft/prefab/BlockMulti.java +++ b/src/com/builtbroken/minecraft/prefab/BlockMulti.java @@ -27,20 +27,12 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockMulti extends BlockContainer implements IExtraBlockInfo { public String textureName = null; - public String channel = ""; public BlockMulti() { super(DarkCore.CONFIGURATION.getBlock("MultiBlock", DarkCore.getNextID()).getInt(), UniversalElectricity.machine); this.setHardness(0.8F); this.setUnlocalizedName("multiBlock"); - this.setChannel(DarkCore.CHANNEL); - } - - public BlockMulti setChannel(String channel) - { - this.channel = channel; - return this; } @Override @@ -121,22 +113,25 @@ public class BlockMulti extends BlockContainer implements IExtraBlockInfo @Override public TileEntity createNewTileEntity(World var1) { - return new TileEntityMulti(this.channel); + return new TileEntityMulti(); } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World par1World, int x, int y, int z) + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { - TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z); - Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition; - - if (mainBlockPosition != null) + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + if (tileEntity instanceof TileEntityMulti) { - int mainBlockID = par1World.getBlockId(mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); + Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition; - if (mainBlockID > 0) + if (mainBlockPosition != null && !mainBlockPosition.equals(new Vector3(x, y, z))) { - return Block.blocksList[mainBlockID].getPickBlock(target, par1World, mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); + int mainBlockID = mainBlockPosition.getBlockID(world); + + if (mainBlockID > 0) + { + return Block.blocksList[mainBlockID].getPickBlock(target, world, mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); + } } } diff --git a/src/com/builtbroken/minecraft/prefab/TileEntityEnergyMachine.java b/src/com/builtbroken/minecraft/prefab/TileEntityEnergyMachine.java index e0970a4a6..254a08668 100644 --- a/src/com/builtbroken/minecraft/prefab/TileEntityEnergyMachine.java +++ b/src/com/builtbroken/minecraft/prefab/TileEntityEnergyMachine.java @@ -163,6 +163,7 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen return 0; } + /** Called to produce power using the output enumset for directions to output in */ protected void produce() { for (ForgeDirection direction : this.getOutputDirections()) diff --git a/src/com/builtbroken/minecraft/prefab/TileEntityMulti.java b/src/com/builtbroken/minecraft/prefab/TileEntityMulti.java index 2596bc639..074d5e24f 100644 --- a/src/com/builtbroken/minecraft/prefab/TileEntityMulti.java +++ b/src/com/builtbroken/minecraft/prefab/TileEntityMulti.java @@ -7,6 +7,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import universalelectricity.api.vector.Vector3; +import com.builtbroken.minecraft.DarkCore; import com.builtbroken.minecraft.interfaces.IMultiBlock; import com.builtbroken.minecraft.network.ISimplePacketReceiver; import com.builtbroken.minecraft.network.PacketHandler; @@ -21,18 +22,12 @@ public class TileEntityMulti extends TileEntity implements ISimplePacketReceiver { // The the position of the main block public Vector3 mainBlockPosition; - public String channel; public TileEntityMulti() { } - public TileEntityMulti(String channel) - { - this.channel = channel; - } - public void setMainBlock(Vector3 mainBlock) { this.mainBlockPosition = mainBlock; @@ -43,18 +38,31 @@ public class TileEntityMulti extends TileEntity implements ISimplePacketReceiver } } + @Override + public boolean simplePacket(String id, ByteArrayDataInput data, Player player) + { + try + { + if (id.equalsIgnoreCase("MainBlock")) + { + this.mainBlockPosition = new Vector3(data.readInt(), data.readInt(), data.readInt()); + return true; + } + } + catch (Exception e) + { + e.printStackTrace(); + return true; + } + return false; + } + @Override public Packet getDescriptionPacket() { if (this.mainBlockPosition != null) { - if (this.channel == null || this.channel == "" && this.getBlockType() instanceof BlockMulti) - { - this.channel = ((BlockMulti) this.getBlockType()).channel; - } - - return PacketHandler.instance().getTilePacket(this.channel, "MainBlock", this, this.mainBlockPosition.intX(), this.mainBlockPosition.intY(), this.mainBlockPosition.intZ()); - + return PacketHandler.instance().getTilePacket(DarkCore.CHANNEL, "MainBlock", this, this.mainBlockPosition.intX(), this.mainBlockPosition.intY(), this.mainBlockPosition.intZ()); } return null; @@ -125,22 +133,4 @@ public class TileEntityMulti extends TileEntity implements ISimplePacketReceiver return false; } - @Override - public boolean simplePacket(String id, ByteArrayDataInput data, Player player) - { - try - { - if (id.equalsIgnoreCase("MainBlock")) - { - this.mainBlockPosition = new Vector3(data.readInt(), data.readInt(), data.readInt()); - return true; - } - } - catch (Exception e) - { - e.printStackTrace(); - return true; - } - return false; - } } \ No newline at end of file