Fix for multiple quarry arms.

This commit is contained in:
Kyprus 2012-06-06 09:47:15 -04:00
parent 65895a1cfc
commit 1c2c729c36
2 changed files with 17 additions and 6 deletions

View file

@ -12,6 +12,7 @@ package net.minecraft.src.buildcraft.factory;
import net.minecraft.src.BuildCraftFactory; import net.minecraft.src.BuildCraftFactory;
import net.minecraft.src.Entity; import net.minecraft.src.Entity;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World; import net.minecraft.src.World;
import net.minecraft.src.buildcraft.core.EntityBlock; import net.minecraft.src.buildcraft.core.EntityBlock;
@ -32,12 +33,13 @@ public class EntityMechanicalArm extends Entity {
boolean inProgressionXZ = false; boolean inProgressionXZ = false;
boolean inProgressionY = false; boolean inProgressionY = false;
protected TileEntity parent;
public EntityMechanicalArm(World world) { public EntityMechanicalArm(World world) {
super(world); super(world);
} }
public EntityMechanicalArm(World world, double i, double j, double k, public EntityMechanicalArm(World world, double i, double j, double k, double width, double height, TileEntity parent) {
double width, double height) {
super(world); super(world);
setPosition(i, j, k); setPosition(i, j, k);
@ -79,6 +81,8 @@ public class EntityMechanicalArm extends Entity {
head.shadowSize = 1.0F; head.shadowSize = 1.0F;
updatePosition(); updatePosition();
this.parent = parent;
} }
@Override @Override
@ -186,6 +190,12 @@ public class EntityMechanicalArm extends Entity {
@Override @Override
public void onUpdate() { public void onUpdate() {
if (parent != null && worldObj.getBlockTileEntity(parent.xCoord, parent.yCoord, parent.zCoord) != parent) {
setDead();
return;
}
if (speed > 0) { if (speed > 0) {
doMove(speed); doMove(speed);
} }

View file

@ -120,7 +120,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine,
yCoord + bluePrintBuilder.bluePrint.sizeY - 1 yCoord + bluePrintBuilder.bluePrint.sizeY - 1
+ Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos, + Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos,
bluePrintBuilder.bluePrint.sizeX - 2 + Utils.pipeMinPos * 2, bluePrintBuilder.bluePrint.sizeX - 2 + Utils.pipeMinPos * 2,
bluePrintBuilder.bluePrint.sizeZ - 2 + Utils.pipeMinPos * 2); bluePrintBuilder.bluePrint.sizeZ - 2 + Utils.pipeMinPos * 2, this);
arm.listener = this; arm.listener = this;
loadArm = true; loadArm = true;
@ -456,8 +456,9 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine,
} }
@Override @Override
public void invalidate() { public void invalidate () {
destroy(); System.out.println("hi");
destroy ();
} }
@Override @Override