Cleaned up some logic

This commit is contained in:
Taylor Shuler 2014-05-11 16:27:51 -04:00
parent 138274e1e9
commit 5a5b29a709
2 changed files with 7 additions and 39 deletions

View File

@ -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);
}
}

View File

@ -206,13 +206,12 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
if (worldObj != null && !worldObj.isRemote && numUsingPlayers != 0 && (ticksSinceSync + xCoord + yCoord + zCoord) % 200 == 0) {
numUsingPlayers = 0;
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()) {
EntityPlayer var4 = var3.next();
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)));
Iterator<EntityPlayer> player = playerlist.iterator();
if (var4.openContainer instanceof ContainerIronChest) {
while (player.hasNext()) {
if (player.next().openContainer instanceof ContainerIronChest) {
++numUsingPlayers;
}
}
@ -261,13 +260,10 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
public boolean receiveClientEvent(int i, int j) {
if (i == 1) {
numUsingPlayers = j;
} else if (i == 2) {
facing = (byte) j;
} else if (i == 3) {
facing = (byte) (j & 0x7);
numUsingPlayers = (j & 0xF8) >> 3;
}
return true;
} else {
return super.receiveClientEvent(i, j);
}
}
@Override