Cleaned up some logic
This commit is contained in:
parent
138274e1e9
commit
5a5b29a709
|
|
@ -1,28 +0,0 @@
|
||||||
package cpw.mods.ironchest;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class MappableItemStackWrapper {
|
|
||||||
private ItemStack wrap;
|
|
||||||
|
|
||||||
public MappableItemStackWrapper(ItemStack toWrap) {
|
|
||||||
wrap = toWrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (!(obj instanceof MappableItemStackWrapper))
|
|
||||||
return false;
|
|
||||||
MappableItemStackWrapper isw = (MappableItemStackWrapper) obj;
|
|
||||||
if (wrap.getHasSubtypes()) {
|
|
||||||
return isw.wrap.isItemEqual(wrap);
|
|
||||||
} else {
|
|
||||||
return isw.wrap == wrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return System.identityHashCode(wrap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -206,13 +206,12 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
if (worldObj != null && !worldObj.isRemote && numUsingPlayers != 0 && (ticksSinceSync + xCoord + yCoord + zCoord) % 200 == 0) {
|
if (worldObj != null && !worldObj.isRemote && numUsingPlayers != 0 && (ticksSinceSync + xCoord + yCoord + zCoord) % 200 == 0) {
|
||||||
numUsingPlayers = 0;
|
numUsingPlayers = 0;
|
||||||
float var1 = 5.0F;
|
float var1 = 5.0F;
|
||||||
List<EntityPlayer> var2 = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double) ((float) xCoord - var1), (double) ((float) yCoord - var1), (double) ((float) zCoord - var1), (double) ((float) (xCoord + 1) + var1), (double) ((float) (yCoord + 1) + var1), (double) ((float) (zCoord + 1) + var1)));
|
|
||||||
Iterator<EntityPlayer> var3 = var2.iterator();
|
|
||||||
|
|
||||||
while (var3.hasNext()) {
|
List<EntityPlayer> playerlist = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double) ((float) xCoord - var1), (double) ((float) yCoord - var1), (double) ((float) zCoord - var1), (double) ((float) (xCoord + 1) + var1), (double) ((float) (yCoord + 1) + var1), (double) ((float) (zCoord + 1) + var1)));
|
||||||
EntityPlayer var4 = var3.next();
|
Iterator<EntityPlayer> player = playerlist.iterator();
|
||||||
|
|
||||||
if (var4.openContainer instanceof ContainerIronChest) {
|
while (player.hasNext()) {
|
||||||
|
if (player.next().openContainer instanceof ContainerIronChest) {
|
||||||
++numUsingPlayers;
|
++numUsingPlayers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -261,13 +260,10 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
public boolean receiveClientEvent(int i, int j) {
|
public boolean receiveClientEvent(int i, int j) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
numUsingPlayers = j;
|
numUsingPlayers = j;
|
||||||
} else if (i == 2) {
|
return true;
|
||||||
facing = (byte) j;
|
} else {
|
||||||
} else if (i == 3) {
|
return super.receiveClientEvent(i, j);
|
||||||
facing = (byte) (j & 0x7);
|
|
||||||
numUsingPlayers = (j & 0xF8) >> 3;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue