diff --git a/src/resonantinduction/contractor/BlockEMContractor.java b/src/resonantinduction/contractor/BlockEMContractor.java index 02287e636..d70eabb38 100644 --- a/src/resonantinduction/contractor/BlockEMContractor.java +++ b/src/resonantinduction/contractor/BlockEMContractor.java @@ -9,6 +9,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import resonantinduction.ResonantInduction; import resonantinduction.base.BlockBase; +import resonantinduction.entangler.ItemCoordLink; import resonantinduction.render.BlockRenderingHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,11 +30,26 @@ 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) + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { TileEntityEMContractor contractor = (TileEntityEMContractor) par1World.getBlockTileEntity(par2, par3, par4); - if (!par5EntityPlayer.isSneaking()) + if (entityPlayer.getCurrentEquippedItem() != null) + { + if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink) + { + ItemCoordLink link = ((ItemCoordLink) entityPlayer.getCurrentEquippedItem().getItem()); + + if (link.getLink(entityPlayer.getCurrentEquippedItem()) != null) + { + + } + + return false; + } + } + + if (!entityPlayer.isSneaking()) { contractor.incrementFacing(); } diff --git a/src/resonantinduction/contractor/TileEntityEMContractor.java b/src/resonantinduction/contractor/TileEntityEMContractor.java index 912028c75..a80338cac 100644 --- a/src/resonantinduction/contractor/TileEntityEMContractor.java +++ b/src/resonantinduction/contractor/TileEntityEMContractor.java @@ -49,8 +49,9 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec */ public boolean suck = true; - private Pathfinding pathfinder; + private Pathfinder pathfinder; private Set pathfindingTrackers = new HashSet(); + private TileEntityEMContractor linked; @Override public void updateEntity() @@ -426,4 +427,24 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec { return true; } + + /** + * Link between two TileEntities, do pathfinding operation. + */ + public void setLink(TileEntityEMContractor tileEntity) + { + this.linked = tileEntity; + this.updatePath(); + } + + public void updatePath() + { + this.pathfinder = null; + + if (this.linked != null) + { + this.pathfinder = new Pathfinder(new Vector3(this.linked)); + this.pathfinder.find(new Vector3(this)); + } + } }