Added EM contractor link and pathfind
This commit is contained in:
parent
43f770fd66
commit
98c15becad
2 changed files with 40 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -49,8 +49,9 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
|
|||
*/
|
||||
public boolean suck = true;
|
||||
|
||||
private Pathfinding pathfinder;
|
||||
private Pathfinder pathfinder;
|
||||
private Set<EntityItem> pathfindingTrackers = new HashSet<EntityItem>();
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue