Removed unneeded slot stuff

This commit is contained in:
Taylor Shuler 2014-07-30 15:32:33 -04:00
parent 6bb69755ab
commit 3d340acdca
5 changed files with 94 additions and 154 deletions

View File

@ -10,13 +10,13 @@
******************************************************************************/
package cpw.mods.ironchest;
import invtweaks.api.container.ChestContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import invtweaks.api.container.ChestContainer;
@ChestContainer(isLargeChest = true)
public class ContainerIronChest extends Container {
@ -85,13 +85,13 @@ public class ContainerIronChest extends Container {
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
{
if (type == IronChestType.DIRTCHEST9000) {
addSlotToContainer(type.makeSlot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
addSlotToContainer(new Slot(chestInventory, 0, 12 + 4 * 18, 8 + 2 * 18));
} else {
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
{
for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
{
addSlotToContainer(type.makeSlot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
addSlotToContainer(new Slot(chestInventory, chestCol + chestRow * type.getRowLength(), 12 + chestCol * 18, 8 + chestRow * 18));
}
}
}

View File

@ -13,11 +13,10 @@ package cpw.mods.ironchest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagByte;
@ -246,11 +245,6 @@ public enum IronChestType {
private static String[] sideNames = { "top", "front", "side" };
private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 };
public Slot makeSlot(IInventory chestInventory, int index, int x, int y)
{
return new ValidatingSlot(chestInventory, index, x, y, this);
}
public boolean acceptsStack(ItemStack itemstack)
{
return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter;

View File

@ -1,33 +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

@ -1,21 +0,0 @@
package cpw.mods.ironchest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ValidatingSlot extends Slot {
private IronChestType type;
public ValidatingSlot(IInventory par1iInventory, int par2, int par3, int par4, IronChestType type)
{
super(par1iInventory, par2, par3, par4);
this.type = type;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
return type.acceptsStack(par1ItemStack);
}
}