diff --git a/src/resonantinduction/contractor/BlockEMContractor.java b/src/resonantinduction/contractor/BlockEMContractor.java index b6d63bdec..4294987dd 100644 --- a/src/resonantinduction/contractor/BlockEMContractor.java +++ b/src/resonantinduction/contractor/BlockEMContractor.java @@ -30,7 +30,7 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - if(par1World.isRemote && !par5EntityPlayer.isSneaking()) + if(!par5EntityPlayer.isSneaking()) { TileEntityEMContractor contractor = (TileEntityEMContractor)par1World.getBlockTileEntity(par2, par3, par4); contractor.incrementFacing(); diff --git a/src/resonantinduction/contractor/TileEntityEMContractor.java b/src/resonantinduction/contractor/TileEntityEMContractor.java index 6d0a8d2e2..b4c9c8ff0 100644 --- a/src/resonantinduction/contractor/TileEntityEMContractor.java +++ b/src/resonantinduction/contractor/TileEntityEMContractor.java @@ -1,16 +1,61 @@ package resonantinduction.contractor; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.ForgeDirection; public class TileEntityEMContractor extends TileEntity { + public static int MAX_REACH = 40; + public ForgeDirection facing = ForgeDirection.UP; + /** + * true = suck, false = push + */ + public boolean suck; + @Override public void updateEntity() { + AxisAlignedBB box = null; + if(!worldObj.isRemote) + { + switch(facing) + { + case DOWN: + box = AxisAlignedBB.getBoundingBox(xCoord, Math.max(yCoord-MAX_REACH, 1), zCoord, xCoord+1, yCoord, zCoord+1); + break; + case UP: + box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, Math.min(yCoord+MAX_REACH, 255), zCoord+1); + break; + case NORTH: + box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+MAX_REACH, yCoord+1, zCoord+1); + break; + case SOUTH: + box = AxisAlignedBB.getBoundingBox(xCoord-MAX_REACH, yCoord, zCoord, xCoord, yCoord+1, zCoord+1); + break; + case WEST: + box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+MAX_REACH); + break; + case EAST: + box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord-MAX_REACH, xCoord+1, yCoord+1, zCoord); + break; + } + + List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, box); + + System.out.println(facing.ordinal()); + + if(!list.isEmpty()) + { + System.out.println("Good!"); + } + } } public void incrementFacing() diff --git a/src/resonantinduction/render/RenderEMContractor.java b/src/resonantinduction/render/RenderEMContractor.java index 5855fbdeb..1819d0c70 100644 --- a/src/resonantinduction/render/RenderEMContractor.java +++ b/src/resonantinduction/render/RenderEMContractor.java @@ -24,12 +24,12 @@ public class RenderEMContractor extends TileEntitySpecialRenderer switch(((TileEntityEMContractor)t).facing) { - case UP: - break; case DOWN: GL11.glRotatef(180, 0, 0, 1); GL11.glTranslatef(0, -2, 0); break; + case UP: + break; case NORTH: GL11.glTranslatef(-1, 1, 0); GL11.glRotatef(-90, 0, 0, 1);