Implemented filter crafting in the Imprinter
(Renamed Stamper to Imprinter)
This commit is contained in:
parent
5c42b9ae6a
commit
95f27d5408
8 changed files with 280 additions and 57 deletions
|
@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.filter.ContainerStamper;
|
||||
import assemblyline.common.machine.filter.ContainerImprinter;
|
||||
|
||||
public class GuiStamper extends GuiContainer
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public class GuiStamper extends GuiContainer
|
|||
|
||||
public GuiStamper(InventoryPlayer par1InventoryPlayer, World worldObj, Vector3 position)
|
||||
{
|
||||
super(new ContainerStamper(par1InventoryPlayer, worldObj, position));
|
||||
super(new ContainerImprinter(par1InventoryPlayer, worldObj, position));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@ import assemblyline.common.block.ItemBlockCrate;
|
|||
import assemblyline.common.machine.BlockManipulator;
|
||||
import assemblyline.common.machine.belt.BlockConveyorBelt;
|
||||
import assemblyline.common.machine.detector.BlockDetector;
|
||||
import assemblyline.common.machine.filter.BlockStamper;
|
||||
import assemblyline.common.machine.filter.BlockImprinter;
|
||||
import assemblyline.common.machine.filter.ItemFilter;
|
||||
import assemblyline.common.machine.machine.BlockRejector;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
@ -65,7 +65,7 @@ public class AssemblyLine
|
|||
public static Block blockManipulator;
|
||||
public static Block blockEngineerTable;
|
||||
public static Block blockCrate;
|
||||
public static Block blockStamper;
|
||||
public static Block blockImprinter;
|
||||
public static Block blockDetector;
|
||||
public static Block blockRejector;
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class AssemblyLine
|
|||
blockManipulator = new BlockManipulator(CONFIGURATION.getBlock("Manipulator", BLOCK_ID_PREFIX + 1).getInt());
|
||||
blockEngineerTable = new BlockEngineerTable(CONFIGURATION.getBlock("Architect's Table", BLOCK_ID_PREFIX + 2).getInt());
|
||||
blockCrate = new BlockCrate(CONFIGURATION.getBlock("Crate", BLOCK_ID_PREFIX + 3).getInt(), 0);
|
||||
blockStamper = new BlockStamper(CONFIGURATION.getBlock("Stamper", BLOCK_ID_PREFIX + 4).getInt(), 0);
|
||||
blockImprinter = new BlockImprinter(CONFIGURATION.getBlock("Imprinter", BLOCK_ID_PREFIX + 4).getInt(), 0);
|
||||
blockDetector = new BlockDetector(CONFIGURATION.getBlock("Detector", BLOCK_ID_PREFIX + 5).getInt(), 1);
|
||||
blockRejector = new BlockRejector(CONFIGURATION.getBlock("Rejector", BLOCK_ID_PREFIX + 6).getInt());
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class AssemblyLine
|
|||
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class, "Crate");
|
||||
GameRegistry.registerBlock(blockManipulator, "Manipulator");
|
||||
// GameRegistry.registerBlock(blockEngineerTable, "Engineer's Table");
|
||||
GameRegistry.registerBlock(blockStamper, "Stamper");
|
||||
GameRegistry.registerBlock(blockImprinter, "Imprinter");
|
||||
GameRegistry.registerBlock(blockDetector, "Detector");
|
||||
GameRegistry.registerBlock(blockRejector, "Rejector");
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class AssemblyLine
|
|||
GameRegistry.addRecipe(new ShapedOreRecipe(itemFilter, new Object[] { "R", "P", "I", 'P', Item.paper, 'R', Item.redstone, 'I', new ItemStack(Item.dyePowder, 1, 0) }));
|
||||
|
||||
// Stamper
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(blockStamper, new Object[] { "SIS", "SPS", "WWW", 'S', "ingotSteel", 'W', Block.wood, 'P', Block.pistonStickyBase, 'I', new ItemStack(Item.dyePowder, 1, 0) }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(blockImprinter, new Object[] { "SIS", "SPS", "WWW", 'S', "ingotSteel", 'W', Block.wood, 'P', Block.pistonStickyBase, 'I', new ItemStack(Item.dyePowder, 1, 0) }));
|
||||
|
||||
// Detector
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(blockDetector, new Object[] { "SES", "SCS", "SPS", 'S', "ingotSteel", 'C', "basicCircuit", 'E', Item.eyeOfEnder }));
|
||||
|
|
|
@ -9,7 +9,7 @@ import assemblyline.common.machine.TileEntityManipulator;
|
|||
import assemblyline.common.machine.TileEntityRejector;
|
||||
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
|
||||
import assemblyline.common.machine.detector.TileEntityDetector;
|
||||
import assemblyline.common.machine.filter.ContainerStamper;
|
||||
import assemblyline.common.machine.filter.ContainerImprinter;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CommonProxy implements IGuiHandler
|
|||
switch (ID)
|
||||
{
|
||||
case GUI_STAMPER:
|
||||
return new ContainerStamper(player.inventory, world, new Vector3(x, y, z));
|
||||
return new ContainerImprinter(player.inventory, world, new Vector3(x, y, z));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -8,9 +8,9 @@ import universalelectricity.prefab.UETab;
|
|||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.CommonProxy;
|
||||
|
||||
public class BlockStamper extends BlockMachine
|
||||
public class BlockImprinter extends BlockMachine
|
||||
{
|
||||
public BlockStamper(int id, int texture)
|
||||
public BlockImprinter(int id, int texture)
|
||||
{
|
||||
super(id, Material.wood);
|
||||
this.blockIndexInTexture = 0;
|
|
@ -13,16 +13,19 @@ import net.minecraft.item.crafting.IRecipe;
|
|||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class ContainerStamper extends Container implements IInventory
|
||||
public class ContainerImprinter extends Container implements IInventory, ISlotWatcher
|
||||
{
|
||||
private ItemStack[] containingItems = new ItemStack[5];
|
||||
private World worldObj;
|
||||
private Vector3 position;
|
||||
private InventoryPlayer inventoryPlayer;
|
||||
|
||||
public ContainerStamper(InventoryPlayer inventoryPlayer, World worldObj, Vector3 position)
|
||||
public ContainerImprinter(InventoryPlayer inventoryPlayer, World worldObj, Vector3 position)
|
||||
{
|
||||
this.worldObj = worldObj;
|
||||
this.position = position;
|
||||
|
@ -44,13 +47,13 @@ public class ContainerStamper extends Container implements IInventory
|
|||
{
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
||||
this.addSlotToContainer(new WatchedSlot(inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18, this));
|
||||
}
|
||||
}
|
||||
|
||||
for (var3 = 0; var3 < 9; ++var3)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryPlayer, var3, 8 + var3 * 18, 142));
|
||||
this.addSlotToContainer(new WatchedSlot(inventoryPlayer, var3, 8 + var3 * 18, 142, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +61,6 @@ public class ContainerStamper extends Container implements IInventory
|
|||
public void updateCraftingResults()
|
||||
{
|
||||
super.updateCraftingResults();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,9 +108,11 @@ public class ContainerStamper extends Container implements IInventory
|
|||
}
|
||||
|
||||
if (slotStack.stackSize == copyStack.stackSize) { return null; }
|
||||
|
||||
|
||||
slotObj.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
|
@ -120,9 +124,9 @@ public class ContainerStamper extends Container implements IInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int par1)
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.containingItems[par1];
|
||||
return this.containingItems[slot];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,12 +134,12 @@ public class ContainerStamper extends Container implements IInventory
|
|||
* returns them in a new stack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
public ItemStack decrStackSize(int slot, int amount)
|
||||
{
|
||||
if (this.containingItems[par1] != null)
|
||||
if (this.containingItems[slot] != null)
|
||||
{
|
||||
ItemStack var3 = this.containingItems[par1];
|
||||
this.containingItems[par1] = null;
|
||||
ItemStack var3 = this.containingItems[slot];
|
||||
this.containingItems[slot] = null;
|
||||
return var3;
|
||||
}
|
||||
else
|
||||
|
@ -149,12 +153,12 @@ public class ContainerStamper extends Container implements IInventory
|
|||
* an EntityItem - like when you close a workbench GUI.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int par1)
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
if (this.containingItems[par1] != null && par1 != 2)
|
||||
if (this.containingItems[slot] != null && slot != 2)
|
||||
{
|
||||
ItemStack var2 = this.containingItems[par1];
|
||||
this.containingItems[par1] = null;
|
||||
ItemStack var2 = this.containingItems[slot];
|
||||
this.containingItems[slot] = null;
|
||||
return var2;
|
||||
}
|
||||
else
|
||||
|
@ -228,23 +232,37 @@ public class ContainerStamper extends Container implements IInventory
|
|||
this.setInventorySlotContents(2, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO WORK IN PROGRESS. Make filters able to autocraft into its item based on what is in
|
||||
* the player's inventory
|
||||
*
|
||||
* boolean didCraft = false;
|
||||
*
|
||||
* if (this.getStackInSlot(3) != null) { if (this.getStackInSlot(3).getItem() instanceof
|
||||
* ItemFilter) { ArrayList<ItemStack> filters =
|
||||
* ItemFilter.getFilters(this.getStackInSlot(3));
|
||||
*
|
||||
* if (filters.size() > 0) { ItemStack outputStack = filters.get(0);
|
||||
*
|
||||
* if (outputStack != null) { if (this.getIdealRecipe(outputStack) != null) {
|
||||
* this.setInventorySlotContents(4, outputStack); didCraft = true; } } } } }
|
||||
*
|
||||
* if (!didCraft) { this.setInventorySlotContents(4, null); }
|
||||
*/
|
||||
// CRAFTING
|
||||
|
||||
boolean didCraft = false;
|
||||
|
||||
if (this.getStackInSlot(3) != null)
|
||||
{
|
||||
if (this.getStackInSlot(3).getItem() instanceof ItemFilter)
|
||||
{
|
||||
ArrayList<ItemStack> filters = ItemFilter.getFilters(this.getStackInSlot(3));
|
||||
|
||||
if (filters.size() > 0)
|
||||
{
|
||||
ItemStack outputStack = filters.get(0);
|
||||
|
||||
if (outputStack != null)
|
||||
{
|
||||
if (this.getIdealRecipe(outputStack) != null)
|
||||
{
|
||||
this.setInventorySlotContents(4, outputStack);
|
||||
didCraft = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!didCraft)
|
||||
{
|
||||
this.setInventorySlotContents(4, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,7 +286,79 @@ public class ContainerStamper extends Container implements IInventory
|
|||
}
|
||||
else if (object instanceof ShapelessRecipes)
|
||||
{
|
||||
if (this.doesMatch(((ShapelessRecipes) object).recipeItems.toArray(), outputItem)) { return (ItemStack[]) ((ShapelessRecipes) object).recipeItems.toArray(); }
|
||||
if (this.doesMatch(((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1]), outputItem)) { return (ItemStack[]) ((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1]); }
|
||||
}
|
||||
else if (object instanceof ShapedOreRecipe)
|
||||
{
|
||||
ShapedOreRecipe oreRecipe = (ShapedOreRecipe) object;
|
||||
Object[] oreRecipeInput = (Object[]) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, oreRecipe, "input");
|
||||
if (doesMatch(oreRecipeInput, outputItem))
|
||||
{
|
||||
ArrayList<ItemStack> finalRecipe = new ArrayList<ItemStack>();
|
||||
for (Object ingredientListObject : oreRecipeInput)
|
||||
{
|
||||
if (ingredientListObject != null)
|
||||
{
|
||||
if (ingredientListObject instanceof ArrayList)
|
||||
{
|
||||
ArrayList ingredientList = (ArrayList) ingredientListObject;
|
||||
for (Object ingredient : ingredientList)
|
||||
{
|
||||
if (ingredient != null)
|
||||
{
|
||||
if (ingredient instanceof ItemStack)
|
||||
{
|
||||
finalRecipe.add((ItemStack) ingredient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finalRecipe.size() == oreRecipeInput.length)
|
||||
{
|
||||
return finalRecipe.toArray(new ItemStack[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (object instanceof ShapelessOreRecipe)
|
||||
{
|
||||
ShapelessOreRecipe oreRecipe = (ShapelessOreRecipe) object;
|
||||
ArrayList oreRecipeInput = (ArrayList) ReflectionHelper.getPrivateValue(ShapelessOreRecipe.class, oreRecipe, "input");
|
||||
if (doesMatch(oreRecipeInput.toArray(), outputItem))
|
||||
{
|
||||
ArrayList<ItemStack> finalRecipe = new ArrayList<ItemStack>();
|
||||
for (Object ingredientListObject : oreRecipeInput)
|
||||
{
|
||||
if (ingredientListObject != null)
|
||||
{
|
||||
if (ingredientListObject instanceof ArrayList)
|
||||
{
|
||||
ArrayList ingredientList = (ArrayList) ingredientListObject;
|
||||
for (Object ingredient : ingredientList)
|
||||
{
|
||||
if (ingredient != null)
|
||||
{
|
||||
if (ingredient instanceof ItemStack)
|
||||
{
|
||||
if (this.inventoryPlayer.hasItemStack((ItemStack) ingredient))
|
||||
finalRecipe.add((ItemStack) ingredient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ingredientListObject instanceof ItemStack)
|
||||
{
|
||||
if (this.inventoryPlayer.hasItemStack((ItemStack) ingredientListObject))
|
||||
finalRecipe.add((ItemStack) ingredientListObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finalRecipe.size() == oreRecipeInput.size())
|
||||
{
|
||||
return finalRecipe.toArray(new ItemStack[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +386,7 @@ public class ContainerStamper extends Container implements IInventory
|
|||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (recipeItem.isItemEqual(checkStack))
|
||||
if (SlotCraftingResult.isItemEqual(recipeItem, checkStack))
|
||||
{
|
||||
// TODO Do NBT CHecking
|
||||
itemMatch++;
|
||||
|
@ -305,13 +395,45 @@ public class ContainerStamper extends Container implements IInventory
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (obj instanceof ArrayList)
|
||||
{
|
||||
ArrayList ingredientsList = (ArrayList) obj;
|
||||
Object[] ingredientsArray = ingredientsList.toArray();
|
||||
|
||||
optionsLoop:
|
||||
for (int x = 0; x < ingredientsArray.length; x++)
|
||||
{
|
||||
if (ingredientsArray[x] != null && ingredientsArray[x] instanceof ItemStack)
|
||||
{
|
||||
ItemStack recipeItem = (ItemStack) ingredientsArray[x];
|
||||
|
||||
if (recipeItem != null)
|
||||
{
|
||||
for (int i = 0; i < this.inventoryPlayer.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack checkStack = this.inventoryPlayer.getStackInSlot(i);
|
||||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (SlotCraftingResult.isItemEqual(recipeItem, checkStack))
|
||||
{
|
||||
// TODO Do NBT CHecking
|
||||
itemMatch++;
|
||||
break optionsLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemMatch >= recipeItems.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1)
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -327,21 +449,27 @@ public class ContainerStamper extends Container implements IInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)
|
||||
public void onCraftGuiClosed(EntityPlayer player)
|
||||
{
|
||||
super.onCraftGuiClosed(par1EntityPlayer);
|
||||
super.onCraftGuiClosed(player);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
for (int i = 0; i < this.getSizeInventory(); ++i)
|
||||
for (int slot = 0; slot < this.getSizeInventory(); ++slot)
|
||||
{
|
||||
ItemStack itemStack = this.getStackInSlotOnClosing(i);
|
||||
ItemStack itemStack = this.getStackInSlotOnClosing(slot);
|
||||
|
||||
if (itemStack != null)
|
||||
if (itemStack != null && slot != 4)
|
||||
{
|
||||
par1EntityPlayer.dropPlayerItem(itemStack);
|
||||
player.dropPlayerItem(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void slotContentsChanged()
|
||||
{
|
||||
onInventoryChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package assemblyline.common.machine.filter;
|
||||
|
||||
public interface ISlotWatcher
|
||||
{
|
||||
public void slotContentsChanged();
|
||||
}
|
|
@ -7,20 +7,27 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class SlotCraftingResult extends Slot
|
||||
{
|
||||
private ContainerStamper container;
|
||||
private ContainerImprinter container;
|
||||
|
||||
public SlotCraftingResult(ContainerStamper container, IInventory par1iInventory, int par2, int par3, int par4)
|
||||
public SlotCraftingResult(ContainerImprinter container, IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player)
|
||||
{
|
||||
return playerHasRequiredIngredients(player, getStack());
|
||||
//return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer entityPlayer, ItemStack par2ItemStack)
|
||||
{
|
||||
|
@ -40,7 +47,7 @@ public class SlotCraftingResult extends Slot
|
|||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (searchStack.isItemEqual(checkStack))
|
||||
if (isItemEqual(searchStack, checkStack))
|
||||
{
|
||||
entityPlayer.inventory.decrStackSize(i, 1);
|
||||
break;
|
||||
|
@ -51,4 +58,61 @@ public class SlotCraftingResult extends Slot
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean playerHasRequiredIngredients(EntityPlayer player, ItemStack desiredItem)
|
||||
{
|
||||
if (this.getStack() != null)
|
||||
{
|
||||
ItemStack[] idealRecipe = this.container.getIdealRecipe(this.getStack());
|
||||
if (idealRecipe != null)
|
||||
{
|
||||
ItemStack[] requiredItems = idealRecipe.clone();
|
||||
int foundItems = 0;
|
||||
|
||||
if (requiredItems != null)
|
||||
{
|
||||
for (ItemStack searchStack : requiredItems)
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack checkStack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (checkStack != null)
|
||||
{
|
||||
if (isItemEqual(searchStack, checkStack))
|
||||
{
|
||||
foundItems++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundItems >= requiredItems.length)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if items are equal for recipe comparison. If either ItemStack's metadata is less than
|
||||
* zero, meta automatically does not matter. This is because the Ore Dictionary puts "-1" onto a
|
||||
* recipe ingredient whose metadata doesn't matter.
|
||||
*
|
||||
* @param original the original item stack to test against
|
||||
* @param test the item stack to test with
|
||||
* @return whether or not the two stacks are equal
|
||||
*/
|
||||
public static boolean isItemEqual(ItemStack original, ItemStack test)
|
||||
{
|
||||
if (original.getItemDamage() < 0 || test.getItemDamage() < 0)
|
||||
{
|
||||
return original.itemID == test.itemID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return original.itemID == test.itemID && original.getItemDamage() == test.getItemDamage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package assemblyline.common.machine.filter;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class WatchedSlot extends Slot
|
||||
{
|
||||
ISlotWatcher slotWatcher;
|
||||
|
||||
public WatchedSlot(IInventory inventory, int id, int xPosition, int yPosition, ISlotWatcher slotWatcher)
|
||||
{
|
||||
super(inventory, id, xPosition, yPosition);
|
||||
this.slotWatcher = slotWatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChanged()
|
||||
{
|
||||
if (slotWatcher != null)
|
||||
{
|
||||
slotWatcher.slotContentsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue