From f7968b472998f32171e0721d43f456d295d9ab2c Mon Sep 17 00:00:00 2001 From: Henry Mao Date: Sat, 15 Dec 2012 12:53:22 +0800 Subject: [PATCH] Belt Direction Fix --- .../assemblyline/api/ConveyorIgnore.java | 30 +++ src/minecraft/assemblyline/api/IBelt.java | 21 +- .../client/render/RenderConveyorBelt.java | 27 +- .../common/block/TileEntityCrate.java | 55 +++- .../common/machine/TileEntityRejector.java | 5 +- .../machine/belt/BlockConveyorBelt.java | 238 ++++++++---------- .../machine/belt/TileEntityConveyorBelt.java | 93 +++---- 7 files changed, 244 insertions(+), 225 deletions(-) create mode 100644 src/minecraft/assemblyline/api/ConveyorIgnore.java diff --git a/src/minecraft/assemblyline/api/ConveyorIgnore.java b/src/minecraft/assemblyline/api/ConveyorIgnore.java new file mode 100644 index 000000000..b7a904fbc --- /dev/null +++ b/src/minecraft/assemblyline/api/ConveyorIgnore.java @@ -0,0 +1,30 @@ +package assemblyline.api; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; + +/** + * A class that allows you to ignore specific entities on the Conveyor Belt. + * + * @author Calclavia + * + */ +public class ConveyorIgnore +{ + private static final List entityIgnoreList = new ArrayList(); + + public static void ignore(Entity entity) + { + if (!entityIgnoreList.contains(entity)) + { + entityIgnoreList.add(entity); + } + } + + public static boolean isIgnore(Entity entity) + { + return entityIgnoreList.contains(entity); + } +} diff --git a/src/minecraft/assemblyline/api/IBelt.java b/src/minecraft/assemblyline/api/IBelt.java index 8a2763f28..0eadbfe2f 100644 --- a/src/minecraft/assemblyline/api/IBelt.java +++ b/src/minecraft/assemblyline/api/IBelt.java @@ -5,24 +5,13 @@ import java.util.List; import net.minecraft.entity.Entity; import net.minecraftforge.common.ForgeDirection; +/** + * An interface applied to the tile entity of a conveyor belt. + * @author Calclavia + * + */ public interface IBelt { - /** - * Gets the facing direction of the belt, used but other machines to know which direction to - * start an item at - * - * @return - */ - public ForgeDirection getFacing(); - - /** - * Causes the belt to ignore the entity for a few updates help in cases where another machine - * needs to affect this particular entity without the belt interfering - * - * @param entity - entity being ignored - */ - public void ignoreEntity(Entity entity); - /** * Used to get a list of entities the belt exerts an effect upon. * diff --git a/src/minecraft/assemblyline/client/render/RenderConveyorBelt.java b/src/minecraft/assemblyline/client/render/RenderConveyorBelt.java index 77bfb6d0c..74ef7bbbc 100644 --- a/src/minecraft/assemblyline/client/render/RenderConveyorBelt.java +++ b/src/minecraft/assemblyline/client/render/RenderConveyorBelt.java @@ -18,32 +18,23 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f) { - String flip = "";// if(tileEntity.flip){flip - // = "F";} + String flip = ""; boolean mid = tileEntity.getIsMiddleBelt(); - int face = tileEntity.getBeltDirection(); + int face = tileEntity.getDirection().ordinal(); GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180f, 0f, 0f, 1f); - bindTextureByName(AssemblyLine.TEXTURE_PATH + "BeltTexture" + flip + ".png"); - if (face == 2) + this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "BeltTexture" + flip + ".png"); + switch(face) { - GL11.glRotatef(180f, 0f, 1f, 0f); - } - else if (face == 3) - { - GL11.glRotatef(0f, 0f, 1f, 0f); - } - else if (face == 4) - { - GL11.glRotatef(90f, 0f, 1f, 0f); - } - else if (face == 5) - { - GL11.glRotatef(270f, 0f, 1f, 0f); + case 2: GL11.glRotatef(0f, 0f, 1f, 0f);break; + case 3: GL11.glRotatef(180f, 0f, 1f, 0f);break; + case 4: GL11.glRotatef(-90f, 0f, 1f, 0f);break; + case 5: GL11.glRotatef(90f, 0f, 1f, 0f);break; } + int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); model.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsBackCap(), tileEntity.getIsFrontCap(), false); diff --git a/src/minecraft/assemblyline/common/block/TileEntityCrate.java b/src/minecraft/assemblyline/common/block/TileEntityCrate.java index d9233655f..9c91a525f 100644 --- a/src/minecraft/assemblyline/common/block/TileEntityCrate.java +++ b/src/minecraft/assemblyline/common/block/TileEntityCrate.java @@ -1,17 +1,64 @@ package assemblyline.common.block; +import assemblyline.common.AssemblyLine; + +import com.google.common.io.ByteArrayDataInput; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; +import universalelectricity.prefab.network.IPacketReceiver; +import universalelectricity.prefab.network.PacketManager; import universalelectricity.prefab.tile.TileEntityAdvanced; -public class TileEntityCrate extends TileEntityAdvanced implements ISidedInventory +public class TileEntityCrate extends TileEntityAdvanced implements ISidedInventory, IPacketReceiver { public ItemStack[] containingItems = new ItemStack[1]; + @Override + public boolean canUpdate() + { + return false; + } + + @Override + public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) + { + if (this.worldObj.isRemote) + { + try + { + if (this.containingItems[0] == null) + { + this.containingItems[0] = new ItemStack(dataStream.readInt(), dataStream.readInt(), dataStream.readInt()); + } + else + { + this.containingItems[0].itemID = dataStream.readInt(); + this.containingItems[0].stackSize = dataStream.readInt(); + this.containingItems[0].setItemDamage(dataStream.readInt()); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + @Override + public Packet getDescriptionPacket() + { + if (this.containingItems[0] != null) { return PacketManager.getPacket(AssemblyLine.CHANNEL, this, this.containingItems[0].itemID, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage()); } + return null; + } + /** * Inventory functions. */ @@ -75,6 +122,11 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); + + if (!this.worldObj.isRemote) + { + PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj); + } } } @@ -168,5 +220,4 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento { return 1; } - } diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java index 80a048e4e..ef04e6b35 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java @@ -176,11 +176,12 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements public void throwItem(ForgeDirection side, Entity entity) { this.firePiston = true; + if (this.beltSide != null) { - this.beltSide.ignoreEntity(entity); - + // this.beltSide.ignoreEntity(entity); } + entity.motionX = (double) side.offsetX * 0.15; entity.motionY += 0.10000000298023224D; entity.motionZ = (double) side.offsetZ * 0.15; diff --git a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java index 4c8bec9e9..0c585e798 100644 --- a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java @@ -6,7 +6,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.UniversalElectricity; +import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.BlockMachine; import universalelectricity.prefab.UETab; import assemblyline.client.render.RenderHelper; @@ -25,152 +27,128 @@ public class BlockConveyorBelt extends BlockMachine this.setCreativeTab(UETab.INSTANCE); } - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) + /** + * Is this conveyor belt slanted towards a direction? + * + * @return The ForgeDirection in which this conveyor belt is slanting against. The direction + * given is the high point of the slant. Return Unknown if not slanting. + */ + public ForgeDirection getSlant(World world, Vector3 position) { - int meta = world.getBlockMetadata(x, y, z); - int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - world.setBlockMetadataWithNotify(x, y, z, meta + angle); + TileEntity t = position.getTileEntity(world); + + if (t != null) + { + if (t instanceof TileEntityConveyorBelt) + { + TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t; + Vector3 highCheck = position.clone(); + highCheck.modifyPositionFromSide(tileEntity.getDirection()); + } + } + + return ForgeDirection.UNKNOWN; } @Override - public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) { - int metadata = par1World.getBlockMetadata(x, y, z); + int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int change = 2; - if (metadata >= 0 && metadata < 8) + switch (angle) { - if (metadata >= 3) - { - par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 0); - return true; - } - else if (metadata >= 7) - { - par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 4); - return true; - } - else - { - par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, metadata + 1); - return true; - } + case 0: + change = 3; + break; + case 1: + change = 4; + break; + case 2: + change = 2; + break; + case 3: + change = 5; + break; + } + world.setBlockMetadataWithNotify(x, y, z, change); + } + + @Override + public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) + { + int original = world.getBlockMetadata(x, y, z); + int change = 2; + + switch (original) + { + case 2: + change = 5; + break; + case 5: + change = 4; + break; + case 4: + change = 3; + break; + case 3: + change = 2; + break; + } + + world.setBlockMetadataWithNotify(x, y, z, change); return true; } /** + * Function WIP. + * * @author AtomicStryker */ - // @Override - public void onEntityCollidedWithBlockTest(World world, int x, int y, int z, Entity entity) + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z); - if (tileEntity.running) + // if (tileEntity.running) { - int metadata = tileEntity.getBeltDirection(); - if (metadata == 4) - { - entity.setVelocity(0.1D, 0.2D, 0.0D); - entity.onGround = false; - } - else if (metadata == 5) - { - entity.setVelocity(0.0D, 0.2D, 0.1D); - entity.onGround = false; - } - else if (metadata == 6) - { - entity.setVelocity(-0.1D, 0.2D, 0.0D); - entity.onGround = false; - } - else if (metadata == 7) - { - entity.setVelocity(0.0D, 0.2D, -0.1D); - entity.onGround = false; - } - else if (metadata == 8) - { - entity.setVelocity(0.1D, 0.0D, 0.0D); - entity.onGround = false; - } - else if (metadata == 9) - { - entity.setVelocity(0.0D, 0.0D, 0.1D); - entity.onGround = false; - } - else if (metadata == 10) - { - entity.setVelocity(-0.1D, 0.0D, 0.0D); - entity.onGround = false; - } - else if (metadata == 11) - { - entity.setVelocity(0.0D, 0.0D, -0.1D); - entity.onGround = false; - } - else if (metadata == 0) - { - if (entity.posZ > (double) z + 0.55D) - { - entity.setVelocity(0.05D, 0.0D, -0.05D); - } - else if (entity.posZ < (double) z + 0.45D) - { - entity.setVelocity(0.05D, 0.0D, 0.05D); - } - else - { - entity.setVelocity(0.1D, 0.0D, 0.0D); - } - } - else if (metadata == 1) - { - if (entity.posX > (double) x + 0.55D) - { - entity.setVelocity(-0.05D, 0.0D, 0.05D); - } - else if (entity.posX < (double) x + 0.45D) - { - entity.setVelocity(0.05D, 0.0D, 0.05D); - } - else - { - entity.setVelocity(0.0D, 0.0D, 0.1D); - } - } - else if (metadata == 2) - { - if (entity.posZ > (double) z + 0.55D) - { - entity.setVelocity(-0.05D, 0.0D, -0.05D); - } - else if (entity.posZ < (double) z + 0.45D) - { - entity.setVelocity(-0.05D, 0.0D, 0.05D); - } - else - { - entity.setVelocity(-0.1D, 0.0D, 0.0D); - } - } - else if (metadata == 3) - { - if (entity.posX > (double) x + 0.55D) - { - entity.setVelocity(-0.05D, 0.0D, -0.05D); - } - else if (entity.posX < (double) x + 0.45D) - { - entity.setVelocity(0.05D, 0.0D, -0.05D); - } - else - { - entity.setVelocity(0.0D, 0.0D, -0.1D); - } - } + ForgeDirection direction = tileEntity.getDirection(); + + entity.addVelocity(direction.offsetX * tileEntity.speed, direction.offsetY * tileEntity.speed, direction.offsetZ * tileEntity.speed); + entity.onGround = false; + /* + * else if (metadata == 9) { entity.setVelocity(0.0D, 0.0D, 0.1D); entity.onGround = + * false; } else if (metadata == 10) { entity.setVelocity(-0.1D, 0.0D, 0.0D); + * entity.onGround = false; } else if (metadata == 11) { entity.setVelocity(0.0D, 0.0D, + * -0.1D); entity.onGround = false; } + */ + + /* + * if (metadata == 4) { entity.setVelocity(0.1D, 0.2D, 0.0D); entity.onGround = false; } + * else if (metadata == 5) { entity.setVelocity(0.0D, 0.2D, 0.1D); entity.onGround = + * false; } else if (metadata == 6) { entity.setVelocity(-0.1D, 0.2D, 0.0D); + * entity.onGround = false; } else if (metadata == 7) { entity.setVelocity(0.0D, 0.2D, + * -0.1D); entity.onGround = false; } else if (metadata == 8) { entity.setVelocity(0.1D, + * 0.0D, 0.0D); entity.onGround = false; } else if (metadata == 9) { + * entity.setVelocity(0.0D, 0.0D, 0.1D); entity.onGround = false; } else if (metadata == + * 10) { entity.setVelocity(-0.1D, 0.0D, 0.0D); entity.onGround = false; } else if + * (metadata == 11) { entity.setVelocity(0.0D, 0.0D, -0.1D); entity.onGround = false; } + * else if (metadata == 0) { if (entity.posZ > (double) z + 0.55D) { + * entity.setVelocity(0.05D, 0.0D, -0.05D); } else if (entity.posZ < (double) z + 0.45D) + * { entity.setVelocity(0.05D, 0.0D, 0.05D); } else { entity.setVelocity(0.1D, 0.0D, + * 0.0D); } } else if (metadata == 1) { if (entity.posX > (double) x + 0.55D) { + * entity.setVelocity(-0.05D, 0.0D, 0.05D); } else if (entity.posX < (double) x + 0.45D) + * { entity.setVelocity(0.05D, 0.0D, 0.05D); } else { entity.setVelocity(0.0D, 0.0D, + * 0.1D); } } else if (metadata == 2) { if (entity.posZ > (double) z + 0.55D) { + * entity.setVelocity(-0.05D, 0.0D, -0.05D); } else if (entity.posZ < (double) z + + * 0.45D) { entity.setVelocity(-0.05D, 0.0D, 0.05D); } else { entity.setVelocity(-0.1D, + * 0.0D, 0.0D); } } else if (metadata == 3) { if (entity.posX > (double) x + 0.55D) { + * entity.setVelocity(-0.05D, 0.0D, -0.05D); } else if (entity.posX < (double) x + + * 0.45D) { entity.setVelocity(0.05D, 0.0D, -0.05D); } else { entity.setVelocity(0.0D, + * 0.0D, -0.1D); } } + */ } } @@ -178,11 +156,9 @@ public class BlockConveyorBelt extends BlockMachine * Returns the TileEntity used by this block. */ @Override - public TileEntity createNewTileEntity(World var1, int metadata) + public TileEntity createNewTileEntity(World var1) { - if (metadata >= 0 && metadata < 4) { return new TileEntityConveyorBelt(); } - if (metadata >= 4 && metadata < 8) { return new TileEntityCoveredBelt(); } - return null; + return new TileEntityConveyorBelt(); } @Override diff --git a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java index c18f9e78f..ef69cc32c 100644 --- a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java @@ -1,6 +1,5 @@ package assemblyline.common.machine.belt; -import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -16,15 +15,17 @@ import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.electricity.ElectricityConnections; import universalelectricity.core.implement.IConductor; import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRotatable; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; import universalelectricity.prefab.tile.TileEntityElectricityReceiver; +import assemblyline.api.ConveyorIgnore; import assemblyline.api.IBelt; import assemblyline.common.AssemblyLine; import com.google.common.io.ByteArrayDataInput; -public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implements IPacketReceiver, IBelt +public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implements IPacketReceiver, IBelt, IRotatable { /** * Joules required to run this thing. @@ -36,15 +37,14 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem */ public double wattsReceived = 0; - private float speed = -0.045F; + public float speed = 0.02f; + public float wheelRotation = 0; public boolean running = false; public boolean textureFlip = false; public TileEntityConveyorBelt[] adjBelts = { null, null, null, null }; - public int clearCount = 0; public int powerTransferRange = 0; - public List entityIgnoreList = new ArrayList(); public TileEntityConveyorBelt() { @@ -189,7 +189,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem { int direction = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - if (!this.entityIgnoreList.contains(entity)) + if (!ConveyorIgnore.isIgnore(entity)) { if (!(entity instanceof EntityPlayer && ((EntityPlayer) entity).isSneaking())) { @@ -216,12 +216,6 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem } } - if (this.clearCount++ >= 4) - { - // clear the temp ignore - // list every 2 second - this.entityIgnoreList.clear(); - } if (entity instanceof EntityItem) { EntityItem entityItem = (EntityItem) entity; @@ -249,71 +243,61 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem return PacketManager.getPacket(AssemblyLine.CHANNEL, this, this.wattsReceived); } - public int getBeltDirection() - { - int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); - if (meta >= 0 && meta < 4) - { - switch (meta) - { - case 0: - return 2; - case 1: - return 5; - case 2: - return 3; - case 3: - return 4; - } - } - return 0; - } - + /** + * Is this belt in the middile of two belts? Used for rendering. + */ public boolean getIsMiddleBelt() { - ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection()); - ForgeDirection back = ForgeDirection.getOrientation(getBeltDirection()).getOpposite(); + ForgeDirection front = this.getDirection(); + ForgeDirection back = this.getDirection().getOpposite(); TileEntity fBelt = worldObj.getBlockTileEntity(xCoord + front.offsetX, yCoord + front.offsetY, zCoord + front.offsetZ); TileEntity BBelt = worldObj.getBlockTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); if (fBelt instanceof TileEntityConveyorBelt && BBelt instanceof TileEntityConveyorBelt) { - int fD = ((TileEntityConveyorBelt) fBelt).getBeltDirection(); - int BD = ((TileEntityConveyorBelt) BBelt).getBeltDirection(); - int TD = this.getBeltDirection(); - if (fD == TD && BD == TD) { return true; } + ForgeDirection fD = ((TileEntityConveyorBelt) fBelt).getDirection(); + ForgeDirection BD = ((TileEntityConveyorBelt) BBelt).getDirection(); + ForgeDirection TD = this.getDirection(); + return fD == TD && BD == TD; } return false; } + /** + * Is this belt in the front of a conveyor line? Used for rendering. + */ public boolean getIsFrontCap() { - ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection()); - ForgeDirection back = ForgeDirection.getOrientation(getBeltDirection()).getOpposite(); + ForgeDirection front = this.getDirection(); + ForgeDirection back = this.getDirection().getOpposite(); TileEntity fBelt = worldObj.getBlockTileEntity(xCoord + front.offsetX, yCoord + front.offsetY, zCoord + front.offsetZ); TileEntity BBelt = worldObj.getBlockTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); if (fBelt instanceof TileEntityConveyorBelt) { - int fD = ((TileEntityConveyorBelt) fBelt).getBeltDirection(); - int TD = this.getBeltDirection(); - if (fD == TD) { return true; } + ForgeDirection fD = ((TileEntityConveyorBelt) fBelt).getDirection(); + ForgeDirection TD = this.getDirection(); + return fD == TD; } return false; } + /** + * Is this belt in the back of a conveyor line? Used for rendering. + */ public boolean getIsBackCap() { - ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection()); - ForgeDirection back = ForgeDirection.getOrientation(getBeltDirection()).getOpposite(); + ForgeDirection front = this.getDirection(); + ForgeDirection back = this.getDirection().getOpposite(); TileEntity fBelt = worldObj.getBlockTileEntity(xCoord + front.offsetX, yCoord + front.offsetY, zCoord + front.offsetZ); TileEntity BBelt = worldObj.getBlockTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); + if (BBelt instanceof TileEntityConveyorBelt) { - int BD = ((TileEntityConveyorBelt) BBelt).getBeltDirection(); - int TD = this.getBeltDirection(); - if (BD == TD) { return true; } + ForgeDirection BD = ((TileEntityConveyorBelt) BBelt).getDirection(); + ForgeDirection TD = this.getDirection(); + return BD == TD; } return false; } @@ -335,19 +319,16 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem } - public void ignoreEntity(Entity entity) + @Override + public void setDirection(ForgeDirection facingDirection) { - if (!this.entityIgnoreList.contains(entity)) - { - this.entityIgnoreList.add(entity); - } - + this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal()); } @Override - public ForgeDirection getFacing() + public ForgeDirection getDirection() { - return ForgeDirection.getOrientation(this.getBeltDirection()); + return ForgeDirection.getOrientation(this.getBlockMetadata()); } @Override