Fixed armbot and manipulator dupe bug

This commit is contained in:
Henry Mao 2013-02-18 23:06:13 +08:00
parent b75bf7d092
commit d9f4c6146c
4 changed files with 22 additions and 9 deletions

View file

@ -1 +1 @@
81
82

View file

@ -72,4 +72,5 @@ x AssemblyLine_v0.2.4.64.jar AssemblyLine_v0.2.4.64_api.zip
@ AssemblyLine_v0.2.6.77.jar AssemblyLine_v0.2.6.77_api.zip
@ AssemblyLine_v0.2.6.79.jar AssemblyLine_v0.2.6.79_api.zip
@ AssemblyLine_v0.2.7.80.jar AssemblyLine_v0.2.7.80_api.zip
* AssemblyLine_v0.2.7.81.jar AssemblyLine_v0.2.7.81_api.zip
@ AssemblyLine_v0.2.7.81.jar AssemblyLine_v0.2.7.81_api.zip
* AssemblyLine_v0.2.7.82.jar AssemblyLine_v0.2.7.82_api.zip

View file

@ -12,10 +12,10 @@ public interface IManipulator
* Find items going into the manipulator and input them into an inventory behind this
* manipulator.
*/
public void eject();
public void inject();
/**
* Injects items
*/
public void inject();
public void eject();
}

View file

@ -65,7 +65,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
{
if (!this.isOutput)
{
this.inject();
this.eject();
}
else
{
@ -79,7 +79,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
*/
if (this.isRedstonePowered)
{
this.eject();
this.inject();
}
}
}
@ -91,7 +91,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
* manipulator.
*/
@Override
public void inject()
public void eject()
{
Vector3 inputPosition = new Vector3(this);
@ -104,6 +104,17 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
Vector3 outputPosition = new Vector3(this);
outputPosition.modifyPositionFromSide(this.getDirection().getOpposite());
/**
* Prevents manipulators from spamming and duping items.
*/
if (outputPosition.getTileEntity(this.worldObj) instanceof TileEntityManipulator)
{
if (((TileEntityManipulator) outputPosition.getTileEntity(this.worldObj)).getDirection() == this.getDirection().getOpposite())
{
return;
}
}
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(inputPosition.x, inputPosition.y, inputPosition.z, inputPosition.x + 1, inputPosition.y + 1, inputPosition.z + 1);
List<EntityItem> itemsInBound = this.worldObj.getEntitiesWithinAABB(EntityItem.class, bounds);
@ -111,6 +122,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
{
if (entity.isDead)
continue;
/**
* Try top first, then bottom, then the sides to see if it is possible to insert the
* item into a inventory.
@ -142,10 +154,10 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
}
/**
* Injects items
* Inject items
*/
@Override
public void eject()
public void inject()
{
this.onPowerOff();