Added un-imprinting feature

This commit is contained in:
Henry Mao 2012-12-29 17:05:40 +08:00
parent 008e22a35a
commit 8c5d407ca1
4 changed files with 20 additions and 24 deletions

View file

@ -2,7 +2,7 @@
{
"modid" : "AssemblyLine",
"name" : "Assembly Line",
"version" : "0.1.9",
"version" : "0.2.0",
"url" : "http://calclavia.com/universalelectricity/?m=18",
"credits" : "",
"authors": [

View file

@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import universalelectricity.core.vector.Vector3;
import assemblyline.client.gui.GuiStamper;
import assemblyline.client.gui.GuiImprinter;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.client.render.RenderConveyorBelt;
import assemblyline.client.render.RenderCrate;
@ -52,7 +52,7 @@ public class ClientProxy extends CommonProxy
switch (ID)
{
case GUI_STAMPER:
return new GuiStamper(player.inventory, world, new Vector3(x, y, z));
return new GuiImprinter(player.inventory, world, new Vector3(x, y, z));
}
return null;

View file

@ -11,12 +11,12 @@ import universalelectricity.prefab.TranslationHelper;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.filter.ContainerImprinter;
public class GuiStamper extends GuiContainer
public class GuiImprinter extends GuiContainer
{
private int containerWidth;
private int containerHeight;
public GuiStamper(InventoryPlayer par1InventoryPlayer, World worldObj, Vector3 position)
public GuiImprinter(InventoryPlayer par1InventoryPlayer, World worldObj, Vector3 position)
{
super(new ContainerImprinter(par1InventoryPlayer, worldObj, position));
}
@ -27,7 +27,7 @@ public class GuiStamper extends GuiContainer
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString(TranslationHelper.getLocal("tile.stamper.name"), 68, 6, 4210752);
this.fontRenderer.drawString(TranslationHelper.getLocal("tile.imprinter.name"), 68, 6, 4210752);
this.fontRenderer.drawString(TranslationHelper.getLocal("assemblyline.gui.crafting") + ":", 25, 55, 4210752);
}

View file

@ -85,7 +85,7 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
if (slot == 2)
{
setInventorySlotContents(0, null); // prevent filter from being duplicated
setInventorySlotContents(0, null); // Prevents filter from being duplicated
}
if (slot > 4)
@ -108,10 +108,10 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
}
if (slotStack.stackSize == copyStack.stackSize) { return null; }
slotObj.onPickupFromSlot(player, slotStack);
}
onInventoryChanged();
return copyStack;
@ -207,23 +207,26 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
ItemStack outputStack = this.getStackInSlot(0).copy();
outputStack.stackSize = 1;
ArrayList<ItemStack> filters = ItemFilter.getFilters(outputStack);
boolean failedCheck = false;
boolean filteringItemExists = false;
for (ItemStack filteredStack : filters)
{
if (filteredStack.isItemEqual(this.getStackInSlot(1)))
{
failedCheck = true;
filters.remove(filteredStack);
filteringItemExists = true;
break;
}
}
if (!failedCheck)
if (!filteringItemExists)
{
filters.add(this.getStackInSlot(1));
ItemFilter.setFilters(outputStack, filters);
this.setInventorySlotContents(2, outputStack);
didStamp = true;
}
ItemFilter.setFilters(outputStack, filters);
this.setInventorySlotContents(2, outputStack);
didStamp = true;
}
}
@ -233,7 +236,6 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
}
// CRAFTING
boolean didCraft = false;
if (this.getStackInSlot(3) != null)
@ -315,10 +317,7 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
}
}
}
if (finalRecipe.size() == oreRecipeInput.length)
{
return finalRecipe.toArray(new ItemStack[1]);
}
if (finalRecipe.size() == oreRecipeInput.length) { return finalRecipe.toArray(new ItemStack[1]); }
}
}
else if (object instanceof ShapelessOreRecipe)
@ -354,10 +353,7 @@ public class ContainerImprinter extends Container implements IInventory, ISlotWa
}
}
}
if (finalRecipe.size() == oreRecipeInput.size())
{
return finalRecipe.toArray(new ItemStack[1]);
}
if (finalRecipe.size() == oreRecipeInput.size()) { return finalRecipe.toArray(new ItemStack[1]); }
}
}
}