Removed unnecessary slot stuff
This commit is contained in:
parent
a560211cc6
commit
33a406311f
|
|
@ -1,12 +1,12 @@
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import invtweaks.api.container.ChestContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import invtweaks.api.container.ChestContainer;
|
|
||||||
|
|
||||||
@ChestContainer(isLargeChest = true)
|
@ChestContainer(isLargeChest = true)
|
||||||
public class ContainerIronChest extends Container {
|
public class ContainerIronChest extends Container {
|
||||||
|
|
@ -75,13 +75,13 @@ public class ContainerIronChest extends Container {
|
||||||
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||||
{
|
{
|
||||||
if (type == IronChestType.DIRTCHEST9000) {
|
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 {
|
} else {
|
||||||
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
|
for (int chestRow = 0; chestRow < type.getRowCount(); chestRow++)
|
||||||
{
|
{
|
||||||
for (int chestCol = 0; chestCol < type.getRowLength(); chestCol++)
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,10 @@ package cpw.mods.ironchest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagByte;
|
import net.minecraft.nbt.NBTTagByte;
|
||||||
|
|
@ -94,10 +93,6 @@ public enum IronChestType {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerTranslations()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
public static void registerBlocksAndRecipes(BlockIronChest blockResult)
|
||||||
{
|
{
|
||||||
ItemStack previous = new ItemStack(Blocks.chest);
|
ItemStack previous = new ItemStack(Blocks.chest);
|
||||||
|
|
@ -229,22 +224,17 @@ public enum IronChestType {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side)
|
public IIcon getIcon(int side)
|
||||||
{
|
{
|
||||||
|
|
||||||
return icons[sideMapping[side]];
|
return icons[sideMapping[side]];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] sideNames = { "top", "front", "side" };
|
private static String[] sideNames = { "top", "front", "side" };
|
||||||
private static int[] sideMapping = { 0, 0, 2, 1, 2, 2, 2 };
|
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)
|
public boolean acceptsStack(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter;
|
return itemFilter == null || itemstack == null || itemstack.getItem() == itemFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adornItemDrop(ItemStack item)
|
public void adornItemDrop(ItemStack item)
|
||||||
{
|
{
|
||||||
if (this == DIRTCHEST9000)
|
if (this == DIRTCHEST9000)
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue