diff --git a/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java b/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java index 0b72a4316..4058a816d 100644 --- a/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java +++ b/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java @@ -1,16 +1,17 @@ package assemblyline.common.machine; +import net.minecraft.block.material.Material; import assemblyline.common.TabAssemblyLine; import assemblyline.common.block.BlockALMachine; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; public class BlockBeltSorter extends BlockALMachine { public BlockBeltSorter(int id) { - super("BlockBeltSorter", id, Material.iron, TabAssemblyLine.INSTANCE); + super(id, Material.iron); + this.setCreativeTab(TabAssemblyLine.INSTANCE); + this.setUnlocalizedName("BeltSorter"); } - + } diff --git a/src/minecraft/assemblyline/common/machine/BlockManipulator.java b/src/minecraft/assemblyline/common/machine/BlockManipulator.java index 7d0fb0c42..4fc82aad2 100644 --- a/src/minecraft/assemblyline/common/machine/BlockManipulator.java +++ b/src/minecraft/assemblyline/common/machine/BlockManipulator.java @@ -28,7 +28,7 @@ public class BlockManipulator extends BlockImprintable @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { - return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) par2, (double) par3, (double) par4, (double) par2 + 1, (double) par3 + 1, (double) par4 + 1); + return AxisAlignedBB.getAABBPool().getAABB((double) par2, (double) par3, (double) par4, (double) par2 + 1, (double) par3 + 1, (double) par4 + 1); } @Override @@ -78,7 +78,7 @@ public class BlockManipulator extends BlockImprintable } @Override - public TileEntity createNewTileEntity(World var1, int metadata) + public TileEntity createTileEntity(World var1, int metadata) { return new TileEntityManipulator(); } diff --git a/src/minecraft/assemblyline/common/machine/BlockRejector.java b/src/minecraft/assemblyline/common/machine/BlockRejector.java index 7b638e018..a0ced9c8c 100644 --- a/src/minecraft/assemblyline/common/machine/BlockRejector.java +++ b/src/minecraft/assemblyline/common/machine/BlockRejector.java @@ -17,7 +17,7 @@ public class BlockRejector extends BlockImprintable } @Override - public TileEntity createNewTileEntity(World var1, int metadata) + public TileEntity createTileEntity(World var1, int metadata) { return new TileEntityRejector(); } diff --git a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java index b48adad6e..d6b6f1e10 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java @@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; import universalelectricity.core.vector.Vector3; @@ -481,4 +482,10 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota { this.isRedstonePowered = false; } + + @Override + public boolean canConnect(ForgeDirection dir) + { + return dir != this.getDirection(); + } } diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java index a98d1100a..0d82a8ed0 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java @@ -133,4 +133,10 @@ public class TileEntityRejector extends TileEntityFilterable super.writeToNBT(nbt); nbt.setBoolean("piston", this.firePiston); } + + @Override + public boolean canConnect(ForgeDirection dir) + { + return dir != this.getDirection(); + } } diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java b/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java index 3625791cb..dfa3f18c8 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java @@ -7,13 +7,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraftforge.common.ForgeDirection; import universalelectricity.prefab.network.IPacketReceiver; -import universalelectricity.prefab.tile.TileEntityElectricityReceiver; +import universalelectricity.prefab.tile.TileEntityElectricityRunnable; import assemblyline.common.machine.belt.TileEntityConveyorBelt; import com.google.common.io.ByteArrayDataInput; -public class TileEntityRoboticSorter extends TileEntityElectricityReceiver implements IPacketReceiver, IInventory +public class TileEntityRoboticSorter extends TileEntityElectricityRunnable implements IPacketReceiver, IInventory { /** * The items this container contains. @@ -211,4 +212,22 @@ public class TileEntityRoboticSorter extends TileEntityElectricityReceiver imple { return 1; } + + @Override + public boolean canConnect(ForgeDirection dir) + { + return dir == ForgeDirection.DOWN; + } + + @Override + public boolean func_94042_c() + { + return false; + } + + @Override + public boolean func_94041_b(int i, ItemStack itemstack) + { + return false; + } } diff --git a/src/minecraft/assemblyline/common/machine/armbot/BlockArmbot.java b/src/minecraft/assemblyline/common/machine/armbot/BlockArmbot.java index e461a7ffb..36cb7b474 100644 --- a/src/minecraft/assemblyline/common/machine/armbot/BlockArmbot.java +++ b/src/minecraft/assemblyline/common/machine/armbot/BlockArmbot.java @@ -21,7 +21,7 @@ public class BlockArmbot extends BlockALMachine public BlockArmbot(int id) { super(id, UniversalElectricity.machine); - this.setBlockName("armbot"); + this.setUnlocalizedName("armbot"); this.setCreativeTab(TabAssemblyLine.INSTANCE); } @@ -95,21 +95,4 @@ public class BlockArmbot extends BlockALMachine return true; } - @Override - public boolean isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) - { - TileEntity ent = world.getBlockTileEntity(x, y, z); - // if (ent instanceof TileEntityArmbot) { return ((TileEntityArmbot) - // ent).isProvidingPowerSide(ForgeDirection.getOrientation(side)); } - // if (ent instanceof TileEntityArmbot) { return ((TileEntityArmbot) - // ent).getFacingDirectionFromAngle().getOpposite() == ForgeDirection.getOrientation(side);} - return false; - } - - @Override - public boolean isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) - { - return this.isProvidingStrongPower(world, x, y, z, side); - } - } diff --git a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java index 898295ad5..87197433b 100644 --- a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java +++ b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java @@ -4,7 +4,6 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.EnumSet; import java.util.Iterator; import java.util.List; @@ -23,8 +22,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.electricity.ElectricityConnections; -import universalelectricity.core.implement.IJouleStorage; +import universalelectricity.core.block.IElectricityStorage; import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.TranslationHelper; import universalelectricity.prefab.multiblock.IMultiBlock; @@ -53,7 +51,7 @@ import dan200.computer.api.IComputerAccess; import dan200.computer.api.IPeripheral; import dark.minecraft.helpers.ItemWorldHelper; -public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMultiBlock, IInventory, IPacketReceiver, IJouleStorage, IArmbot, IPeripheral +public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMultiBlock, IInventory, IPacketReceiver, IElectricityStorage, IArmbot, IPeripheral { private final CommandManager commandManager = new CommandManager(); private static final int PACKET_COMMANDS = 128; @@ -92,13 +90,6 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult */ public EntityItem renderEntityItem = null; - @Override - public void initiate() - { - ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN)); - this.onInventoryChanged(); - } - @Override public void onUpdate() { @@ -558,19 +549,19 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult } @Override - public double getJoules(Object... data) + public double getJoules() { return this.wattsReceived; } @Override - public void setJoules(double joules, Object... data) + public void setJoules(double joules) { this.wattsReceived = joules; } @Override - public double getMaxJoules(Object... data) + public double getMaxJoules() { return 1000; } @@ -673,10 +664,8 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult @Override public void onDestroy(TileEntity callingBlock) { - Vector3 destroyPosition = new Vector3(callingBlock); - destroyPosition.add(new Vector3(0, 1, 0)); - destroyPosition.setBlockWithNotify(this.worldObj, 0); - this.worldObj.setBlockWithNotify(this.xCoord, this.yCoord, this.zCoord, 0); + this.worldObj.setBlockAndMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 0, 0, 3); + this.worldObj.setBlockAndMetadataWithNotify(this.xCoord, this.yCoord + 1, this.zCoord, 0, 0, 3); } @Override @@ -973,4 +962,23 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult } } + @Override + public boolean canConnect(ForgeDirection direction) + { + return direction == ForgeDirection.DOWN; + } + + @Override + public boolean func_94042_c() + { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean func_94041_b(int i, ItemStack itemstack) + { + return false; + } + } diff --git a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java index 1dd40cd9b..c11f41bd5 100644 --- a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java @@ -6,6 +6,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -30,7 +31,7 @@ public class BlockConveyorBelt extends BlockALMachine public BlockConveyorBelt(int id) { super(id, UniversalElectricity.machine); - this.setBlockName("conveyorBelt"); + this.setUnlocalizedName("conveyorBelt"); this.setBlockBounds(0, 0, 0, 1, 0.3f, 1); this.setCreativeTab(TabAssemblyLine.INSTANCE); } @@ -68,11 +69,17 @@ public class BlockConveyorBelt extends BlockALMachine { TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t; - if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN) { return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1); } - if (tileEntity.getSlant() == SlantType.TOP) { return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + 0.68f, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.98f, (double) z + this.maxZ); } + if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN) + { + return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1); + } + if (tileEntity.getSlant() == SlantType.TOP) + { + return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + 0.68f, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.98f, (double) z + this.maxZ); + } } - return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); + return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); } @Override @@ -86,7 +93,7 @@ public class BlockConveyorBelt extends BlockALMachine if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN) { - AxisAlignedBB boundBottom = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.3, z + 1); + AxisAlignedBB boundBottom = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.3, z + 1); AxisAlignedBB boundTop = null; ForgeDirection direction = tileEntity.getDirection(); @@ -95,38 +102,38 @@ public class BlockConveyorBelt extends BlockALMachine { if (direction.offsetX > 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x + (float) direction.offsetX / 2, y, z, x + 1, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / 2, y, z, x + 1, y + 0.8, z + 1); } else if (direction.offsetX < 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + (float) direction.offsetX / -2, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / -2, y + 0.8, z + 1); } else if (direction.offsetZ > 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z + (float) direction.offsetZ / 2, x + 1, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / 2, x + 1, y + 0.8, z + 1); } else if (direction.offsetZ < 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / -2); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / -2); } } else if (tileEntity.getSlant() == SlantType.DOWN) { if (direction.offsetX > 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + (float) direction.offsetX / 2, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / 2, y + 0.8, z + 1); } else if (direction.offsetX < 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x + (float) direction.offsetX / -2, y, z, x + 1, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / -2, y, z, x + 1, y + 0.8, z + 1); } else if (direction.offsetZ > 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / 2); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / 2); } else if (direction.offsetZ < 0) { - boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z + (float) direction.offsetZ / -2, x + 1, y + 0.8, z + 1); + boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / -2, x + 1, y + 0.8, z + 1); } } @@ -144,7 +151,7 @@ public class BlockConveyorBelt extends BlockALMachine if (tileEntity.getSlant() == SlantType.TOP) { - AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y + 0.68, z, x + 1, y + 0.98, z + 1); + AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y + 0.68, z, x + 1, y + 0.98, z + 1); if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds)) { @@ -155,7 +162,7 @@ public class BlockConveyorBelt extends BlockALMachine } } - AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.3, z + 1); + AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.3, z + 1); if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds)) { @@ -164,7 +171,7 @@ public class BlockConveyorBelt extends BlockALMachine } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving, ItemStack stack) { int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int change = 2; @@ -185,7 +192,7 @@ public class BlockConveyorBelt extends BlockALMachine break; } - world.setBlockMetadataWithNotify(x, y, z, change); + world.setBlockMetadataWithNotify(x, y, z, change, 3); } @Override @@ -211,7 +218,7 @@ public class BlockConveyorBelt extends BlockALMachine } - world.setBlockMetadataWithNotify(x, y, z, change); + world.setBlockMetadataWithNotify(x, y, z, change, 3); return true; } @@ -241,7 +248,10 @@ public class BlockConveyorBelt extends BlockALMachine { TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z); tileEntity.updatePowerTransferRange(); - if (tileEntity.IgnoreList.contains(entity)) { return; } + if (tileEntity.IgnoreList.contains(entity)) + { + return; + } if (tileEntity.isRunning() && !world.isBlockIndirectlyGettingPowered(x, y, z)) { float acceleration = tileEntity.acceleration; diff --git a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java index 945890e94..655c97be7 100644 --- a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java @@ -12,8 +12,8 @@ import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.electricity.ElectricityConnections; import universalelectricity.prefab.implement.IRotatable; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; @@ -46,16 +46,12 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements private int animFrame = 0; // this is from 0 to 15 private SlantType slantType = SlantType.NONE; - public List IgnoreList = new ArrayList();// Entities that need to be ignored to prevent movement - - public TileEntityConveyorBelt() - { - super(); - ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN)); - } + public List IgnoreList = new ArrayList();// Entities that need to be ignored to + // prevent movement /** - * This function is overriden to allow conveyor belts to power belts that are diagonally going up. + * This function is overriden to allow conveyor belts to power belts that are diagonally going + * up. */ @Override public void updatePowerTransferRange() @@ -118,7 +114,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements { PacketManager.sendPacketToClients(this.getDescriptionPacket()); } - + /* PROCESSES IGNORE LIST AND REMOVES UNNEED ENTRIES */ List newList = new ArrayList(); for (Entity ent : IgnoreList) @@ -271,17 +267,27 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements } @Override - public void setDirection(ForgeDirection facingDirection) + public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) { - this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal()); + this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3); } @Override - public ForgeDirection getDirection() + public ForgeDirection getDirection(World world, int x, int y, int z) { return ForgeDirection.getOrientation(this.getBlockMetadata()); } + public ForgeDirection getDirection() + { + return this.getDirection(worldObj, xCoord, yCoord, zCoord); + } + + public void setDirection(ForgeDirection facingDirection) + { + this.setDirection(worldObj, xCoord, yCoord, zCoord, facingDirection); + } + @Override public List getAffectedEntities() { @@ -333,7 +339,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements if (worldObj != null) { - worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, nbt.getInteger("rotation")); + worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, nbt.getInteger("rotation"), 3); } } @@ -361,4 +367,10 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements } } + + @Override + public boolean canConnect(ForgeDirection direction) + { + return direction == ForgeDirection.DOWN; + } } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandBreak.java b/src/minecraft/assemblyline/common/machine/command/CommandBreak.java index 508251b24..1f99dd9ce 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandBreak.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandBreak.java @@ -42,7 +42,7 @@ public class CommandBreak extends Command this.tileEntity.grabEntity(new EntityItem(this.world, (double) serachPosition.intX() + 0.5D, (double) serachPosition.intY() + 0.5D, (double) serachPosition.intZ() + 0.5D, items.get(0))); } - serachPosition.setBlockWithNotify(this.world, 0); + world.setBlockAndMetadataWithNotify(serachPosition.intX(),serachPosition.intY(),serachPosition.intZ(), 0, 0, 3); return false; } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandFire.java b/src/minecraft/assemblyline/common/machine/command/CommandFire.java index 32a9bca50..95c56814e 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandFire.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandFire.java @@ -76,7 +76,7 @@ public class CommandFire extends Command if (item.getEntityItem().stackSize > 0) { stack.stackSize--; - item.func_92058_a(stack); + item.setEntityItemStack(stack); } else { diff --git a/src/minecraft/assemblyline/common/machine/command/CommandPlace.java b/src/minecraft/assemblyline/common/machine/command/CommandPlace.java index f31666591..5447e2a17 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandPlace.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandPlace.java @@ -62,11 +62,11 @@ public class CommandPlace extends Command int blockID = plantable.getPlantID(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()); int blockMetadata = plantable.getPlantMetadata(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()); - if (this.world.setBlockAndMetadataWithNotify(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata)) + if (this.world.setBlockAndMetadataWithNotify(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata, 3)) { if (this.world.getBlockId(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) == blockID) { - Block.blocksList[blockID].onBlockPlacedBy(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null); + Block.blocksList[blockID].onBlockPlacedBy(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null, itemStack); Block.blocksList[blockID].onPostBlockPlaced(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata); this.tileEntity.dropEntity(entity); return false; diff --git a/src/minecraft/assemblyline/common/machine/crane/BlockCraneController.java b/src/minecraft/assemblyline/common/machine/crane/BlockCraneController.java index 3322144ad..6fca4c361 100644 --- a/src/minecraft/assemblyline/common/machine/crane/BlockCraneController.java +++ b/src/minecraft/assemblyline/common/machine/crane/BlockCraneController.java @@ -1,12 +1,12 @@ package assemblyline.common.machine.crane; import net.minecraft.entity.EntityLiving; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.UniversalElectricity; import assemblyline.client.render.BlockRenderingHandler; -import assemblyline.common.TabAssemblyLine; import assemblyline.common.block.BlockALMachine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -15,7 +15,8 @@ public class BlockCraneController extends BlockALMachine { public BlockCraneController(int id) { - super("craneController", id, UniversalElectricity.machine); + super(id, UniversalElectricity.machine); + this.setUnlocalizedName("craneController"); // this.setCreativeTab(TabAssemblyLine.INSTANCE); } @@ -32,29 +33,29 @@ public class BlockCraneController extends BlockALMachine } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity) + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity, ItemStack stack) { int rot = (int) Math.min(((entity.rotationYaw + 315f) % 360f) / 90f, 3); switch (rot) { case 0: // WEST { - world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal()); + world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal(), 3); break; } case 1: // NORTH { - world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal()); + world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal(), 3); break; } case 2: // EAST { - world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal()); + world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal(), 3); break; } default: // SOUTH { - world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal()); + world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal(), 3); break; } } @@ -68,7 +69,7 @@ public class BlockCraneController extends BlockALMachine } @Override - public TileEntity createNewTileEntity(World world, int metadata) + public TileEntity createTileEntity(World world, int metadata) { return new TileEntityCraneController(); } diff --git a/src/minecraft/assemblyline/common/machine/crane/BlockCraneFrame.java b/src/minecraft/assemblyline/common/machine/crane/BlockCraneFrame.java index 925e4ab52..c82b94fd6 100644 --- a/src/minecraft/assemblyline/common/machine/crane/BlockCraneFrame.java +++ b/src/minecraft/assemblyline/common/machine/crane/BlockCraneFrame.java @@ -7,7 +7,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.UniversalElectricity; import assemblyline.client.render.BlockRenderingHandler; -import assemblyline.common.TabAssemblyLine; import assemblyline.common.block.BlockALMachine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,8 +15,9 @@ public class BlockCraneFrame extends BlockALMachine { public BlockCraneFrame(int id) { - super("craneFrame", id, UniversalElectricity.machine); - //this.setCreativeTab(TabAssemblyLine.INSTANCE); + super(id, UniversalElectricity.machine); + this.setUnlocalizedName("craneFrame"); + // this.setCreativeTab(TabAssemblyLine.INSTANCE); this.setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f); } @@ -136,7 +136,7 @@ public class BlockCraneFrame extends BlockALMachine } @Override - public TileEntity createNewTileEntity(World world, int metadata) + public TileEntity createTileEntity(World world, int metadata) { return new TileEntityCraneRail(); } diff --git a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java index 88f17d676..828b9900b 100644 --- a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java +++ b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java @@ -199,4 +199,10 @@ public class TileEntityCraneController extends TileEntityAssemblyNetwork impleme depth = nbt.getInteger("depth"); isCraneValid = nbt.getBoolean("isValid"); } + + @Override + public boolean canConnect(ForgeDirection direction) + { + return true; + } } diff --git a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java index 0e2435512..8eca5e7c0 100644 --- a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java +++ b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java @@ -13,4 +13,10 @@ public class TileEntityCraneRail extends TileEntityAssemblyNetwork implements IC return true; } + @Override + public boolean canConnect(ForgeDirection direction) + { + return false; + } + } diff --git a/src/minecraft/assemblyline/common/machine/detector/BlockDetector.java b/src/minecraft/assemblyline/common/machine/detector/BlockDetector.java index 26a5ad344..c5786aa28 100644 --- a/src/minecraft/assemblyline/common/machine/detector/BlockDetector.java +++ b/src/minecraft/assemblyline/common/machine/detector/BlockDetector.java @@ -3,12 +3,12 @@ package assemblyline.common.machine.detector; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.UniversalElectricity; -import assemblyline.common.AssemblyLine; import assemblyline.common.TabAssemblyLine; import assemblyline.common.machine.imprinter.BlockImprintable; @@ -20,8 +20,6 @@ public class BlockDetector extends BlockImprintable public BlockDetector(int blockID, int texture) { super("detector", blockID, UniversalElectricity.machine, TabAssemblyLine.INSTANCE); - this.blockIndexInTexture = texture; - this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH); } @Override @@ -55,11 +53,11 @@ public class BlockDetector extends BlockImprintable change = ForgeDirection.UP.ordinal(); } - world.setBlockMetadataWithNotify(x, y, z, change); + world.setBlockMetadataWithNotify(x, y, z, change,3); } @Override - public int getBlockTexture(IBlockAccess iBlockAccess, int x, int y, int z, int side) + public Icon getBlockTexture(IBlockAccess iBlockAccess, int x, int y, int z, int side) { TileEntity tileEntity = iBlockAccess.getBlockTileEntity(x, y, z); if (tileEntity instanceof TileEntityDetector) @@ -80,14 +78,7 @@ public class BlockDetector extends BlockImprintable return this.blockIndexInTexture; } - - @Override - public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) - { - world.setBlockMetadataWithNotify(x, y, z, side); - return true; - } - + @Override public int getBlockTextureFromSideAndMetadata(int side, int metadata) { @@ -98,6 +89,14 @@ public class BlockDetector extends BlockImprintable return this.blockIndexInTexture; } + @Override + public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) + { + world.setBlockMetadataWithNotify(x, y, z, side,3); + return true; + } + + @Override public void onNeighborBlockChange(World world, int x, int y, int z, int blockID) @@ -140,7 +139,7 @@ public class BlockDetector extends BlockImprintable } @Override - public boolean isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int direction) + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int direction) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); @@ -148,11 +147,11 @@ public class BlockDetector extends BlockImprintable { return ((TileEntityDetector) tileEntity).isPoweringTo(ForgeDirection.getOrientation(direction)); } - return false; + return 0; } @Override - public boolean isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction) + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction) { return isProvidingStrongPower(world, x, y, z, direction); } diff --git a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java index 41288db46..7e2530b21 100644 --- a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java +++ b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java @@ -95,13 +95,13 @@ public class TileEntityDetector extends TileEntityFilterable tag.setBoolean("powering", this.powering); } - public boolean isPoweringTo(ForgeDirection side) + public int isPoweringTo(ForgeDirection side) { return this.powering && this.getDirection() != side.getOpposite(); } public boolean isIndirectlyPoweringTo(ForgeDirection side) { - return this.isPoweringTo(side); + return this.isPoweringTo(side) > 0; } } diff --git a/src/minecraft/assemblyline/common/machine/encoder/BlockEncoder.java b/src/minecraft/assemblyline/common/machine/encoder/BlockEncoder.java index 26dacb3aa..85f8d31e0 100644 --- a/src/minecraft/assemblyline/common/machine/encoder/BlockEncoder.java +++ b/src/minecraft/assemblyline/common/machine/encoder/BlockEncoder.java @@ -14,10 +14,8 @@ public class BlockEncoder extends BlockALMachine public BlockEncoder(int id, int texture) { super(id, Material.wood); - this.blockIndexInTexture = texture; - this.setBlockName("encoder"); + this.setUnlocalizedName("encoder"); this.setCreativeTab(TabAssemblyLine.INSTANCE); - this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH); } /** @@ -61,7 +59,7 @@ public class BlockEncoder extends BlockALMachine } @Override - public TileEntity createNewTileEntity(World world, int metadata) + public TileEntity createTileEntity(World world, int metadata) { return new TileEntityEncoder(); } diff --git a/src/minecraft/assemblyline/common/machine/encoder/ItemDisk.java b/src/minecraft/assemblyline/common/machine/encoder/ItemDisk.java index 22e32eeeb..388f0bf54 100644 --- a/src/minecraft/assemblyline/common/machine/encoder/ItemDisk.java +++ b/src/minecraft/assemblyline/common/machine/encoder/ItemDisk.java @@ -16,11 +16,9 @@ public class ItemDisk extends Item public ItemDisk(int id) { super(id); - this.setItemName("disk"); - this.setIconIndex(0); + this.setUnlocalizedName("disk"); this.setCreativeTab(TabAssemblyLine.INSTANCE); this.setHasSubtypes(true); - this.setTextureFile(AssemblyLine.ITEM_TEXTURE_PATH); } @Override diff --git a/src/minecraft/assemblyline/common/machine/encoder/TileEntityEncoder.java b/src/minecraft/assemblyline/common/machine/encoder/TileEntityEncoder.java index 54f9f3be7..9841c3e78 100644 --- a/src/minecraft/assemblyline/common/machine/encoder/TileEntityEncoder.java +++ b/src/minecraft/assemblyline/common/machine/encoder/TileEntityEncoder.java @@ -201,4 +201,18 @@ public class TileEntityEncoder extends TileEntityAdvanced implements IPacketRece } } + @Override + public boolean func_94042_c() + { + //TODO ? + return false; + } + + @Override + public boolean func_94041_b(int i, ItemStack itemstack) + { + // TODO Auto-generated method stub + return false; + } + } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java index 90011fc31..49e76f93a 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprintable.java @@ -24,7 +24,7 @@ public abstract class BlockImprintable extends BlockALMachine public BlockImprintable(String name, int id, Material material, CreativeTabs creativeTab) { super(id, material); - this.setBlockName(name); + this.setUnlocalizedName(name); this.setCreativeTab(creativeTab); } @@ -114,7 +114,7 @@ public abstract class BlockImprintable extends BlockALMachine } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving, ItemStack stack) { int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int change = 2; @@ -135,7 +135,7 @@ public abstract class BlockImprintable extends BlockALMachine break; } - world.setBlockMetadataWithNotify(x, y, z, change); + world.setBlockMetadataWithNotify(x, y, z, change,3); } @Override @@ -161,7 +161,7 @@ public abstract class BlockImprintable extends BlockALMachine } - world.setBlockMetadataWithNotify(x, y, z, change); + world.setBlockMetadataWithNotify(x, y, z, change,3); return true; } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java index 655be85ea..80458d1e0 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java @@ -19,10 +19,8 @@ public class BlockImprinter extends BlockALMachine public BlockImprinter(int id, int texture) { super(id, Material.wood); - this.blockIndexInTexture = texture; - this.setBlockName("imprinter"); + this.setUnlocalizedName("imprinter"); this.setCreativeTab(TabAssemblyLine.INSTANCE); - this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH); } /** diff --git a/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java index df66a5f45..ac6326900 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java @@ -19,11 +19,9 @@ public class ItemImprinter extends Item public ItemImprinter(int id) { super(id); - this.setItemName("imprint"); - this.setIconIndex(1); + this.setUnlocalizedName("imprint"); this.setCreativeTab(TabAssemblyLine.INSTANCE); this.setHasSubtypes(true); - this.setTextureFile(AssemblyLine.ITEM_TEXTURE_PATH); } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java index 9bce1cb15..ca578b765 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityFilterable.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import universalelectricity.prefab.implement.IRotatable; import universalelectricity.prefab.network.IPacketReceiver; @@ -95,15 +96,25 @@ public abstract class TileEntityFilterable extends TileEntityAssemblyNetwork imp } @Override - public ForgeDirection getDirection() + public ForgeDirection getDirection(World world, int x, int y, int z) { return ForgeDirection.getOrientation(this.getBlockMetadata()); } @Override + public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) + { + this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3); + } + public void setDirection(ForgeDirection facingDirection) { - this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal()); + this.setDirection(worldObj, xCoord, yCoord, zCoord, facingDirection); + } + + public ForgeDirection getDirection() + { + return this.getDirection(worldObj, xCoord, yCoord, zCoord); } /** diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java index be8ea8bc4..ee6da110b 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java @@ -855,4 +855,18 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv return false; } + + @Override + public boolean func_94042_c() + { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean func_94041_b(int i, ItemStack itemstack) + { + // TODO Auto-generated method stub + return false; + } }