From 2636ccdd67b5f33421ab7f9152021bc4ebc147b3 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Tue, 7 Feb 2017 20:16:24 +0300 Subject: Fixed an ore dictionary recipes of Iron workbench which using wrong set of items. Fixed wire recipe input. All recipes of Iron workbench now use fluid container input and will drop an empty container. --- ihl/worldgen/ores/DebugScannerTileEntity.java | 260 +++++++++++++------------- 1 file changed, 128 insertions(+), 132 deletions(-) (limited to 'ihl/worldgen/ores/DebugScannerTileEntity.java') diff --git a/ihl/worldgen/ores/DebugScannerTileEntity.java b/ihl/worldgen/ores/DebugScannerTileEntity.java index 99778a9..df027d5 100644 --- a/ihl/worldgen/ores/DebugScannerTileEntity.java +++ b/ihl/worldgen/ores/DebugScannerTileEntity.java @@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.oredict.OreDictionary; @@ -20,142 +21,137 @@ import ic2.core.IHasGui; import ic2.core.block.TileEntityInventory; import ic2.core.block.invslot.InvSlot; -public class DebugScannerTileEntity extends TileEntityInventory implements IHasGui -{ - public final InvSlot itemsSlot; - private ItemStack lastItem; - public List oreDictionaryEntries = new ArrayList(); - - public DebugScannerTileEntity() - { - this.itemsSlot = new InvSlot(this, "drainInput", 0, InvSlot.Access.I, 2); - } - +public class DebugScannerTileEntity extends TileEntityInventory implements IHasGui { + public final InvSlot itemsSlot; + private ItemStack lastItem; + public List oreDictionaryEntries = new ArrayList(); + + public DebugScannerTileEntity() { + this.itemsSlot = new InvSlot(this, "drainInput", 0, InvSlot.Access.I, 2); + } + @Override public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { - return this.getFacing()!=(short)side && side!=0 && side!=1; + return this.getFacing() != (short) side && side != 0 && side != 1; } - - @Override - public void updateEntityClient() - { - if(IC2.platform.isRendering()) - { - if(this.itemsSlot.get(0)!=null && this.itemsSlot.get(0)!=lastItem) - { - this.oreDictionaryEntries.clear(); - int[] ids = OreDictionary.getOreIDs(this.itemsSlot.get()); - String itemNameFromIR = Item.itemRegistry.getNameForObject(this.itemsSlot.get().getItem()); - this.oreDictionaryEntries.add("ItemRegistry entry:"); - this.oreDictionaryEntries.add(" "+itemNameFromIR); - this.oreDictionaryEntries.add("Item damage: " + this.itemsSlot.get().getItemDamage()); - this.oreDictionaryEntries.add("Item class:"); - this.oreDictionaryEntries.add(" "+this.itemsSlot.get().getItem().getClass().getCanonicalName()); - if(this.itemsSlot.get().stackTagCompound!=null) - { - this.oreDictionaryEntries.add("NBT keys:"); - Iterator iterator = this.itemsSlot.get().stackTagCompound.func_150296_c().iterator(); - while(iterator.hasNext()) - { - String entry = (String) iterator.next(); - if(this.itemsSlot.get().stackTagCompound.getTag(entry) instanceof NBTTagCompound) - { - this.oreDictionaryEntries.add(" "+entry); - NBTTagCompound ct = this.itemsSlot.get().stackTagCompound.getCompoundTag(entry); - if(ct!=null && ct.func_150296_c()!=null && !ct.func_150296_c().isEmpty()) - { - this.oreDictionaryEntries.add(" -NBT compound tag subkeys:"); - Iterator stIterator = ct.func_150296_c().iterator(); - while(stIterator.hasNext()) - { - String entry2 = (String) stIterator.next(); - this.oreDictionaryEntries.add(" "+entry2+"="+ct.getString(entry2)); - } - } - } - else - { - this.oreDictionaryEntries.add(" "+entry+"="+this.itemsSlot.get().stackTagCompound.getString(entry)); - } - } - } - if(ids.length>0) - { - this.oreDictionaryEntries.add("Ore dict. entries:"); - for(int i=0;i "); - } - this.oreDictionaryEntries.add("Fluid flowing icon:"); - if(fluid.getFluid().getFlowingIcon()!=null) - { - this.oreDictionaryEntries.add(" "+fluid.getFluid().getFlowingIcon().getIconName()); - } - else - { - this.oreDictionaryEntries.add(" "); - } - } - } - lastItem=this.itemsSlot.get(1); - } - } - } - - /** - * Returns the name of the inventory - */ - @Override - public String getInventoryName() - { - return "debugScanner"; - } - @Override - public ContainerBase getGuiContainer(EntityPlayer entityPlayer) - { - return new DebugScannerContainer(entityPlayer, this); - } - - @Override - @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) - { - return new DebugScannerGui(new DebugScannerContainer(entityPlayer, this)); - } + @Override + public void updateEntityClient() { + if (IC2.platform.isRendering()) { + if (this.itemsSlot.get(0) != null && this.itemsSlot.get(0) != lastItem) { + this.oreDictionaryEntries.clear(); + int[] ids = OreDictionary.getOreIDs(this.itemsSlot.get()); + String itemNameFromIR = Item.itemRegistry.getNameForObject(this.itemsSlot.get().getItem()); + this.oreDictionaryEntries.add("ItemRegistry entry:"); + this.oreDictionaryEntries.add(" " + itemNameFromIR); + this.oreDictionaryEntries.add("Item damage: " + this.itemsSlot.get().getItemDamage()); + this.oreDictionaryEntries.add("Item class:"); + this.oreDictionaryEntries.add(" " + this.itemsSlot.get().getItem().getClass().getCanonicalName()); + if (this.itemsSlot.get().stackTagCompound != null) { + this.oreDictionaryEntries.add("NBT keys:"); + Iterator iterator = this.itemsSlot.get().stackTagCompound.func_150296_c().iterator(); + while (iterator.hasNext()) { + String entry = (String) iterator.next(); + if (this.itemsSlot.get().stackTagCompound.getTag(entry) instanceof NBTTagCompound) { + this.oreDictionaryEntries.add(" " + entry); + NBTTagCompound ct = this.itemsSlot.get().stackTagCompound.getCompoundTag(entry); + if (ct != null && ct.func_150296_c() != null && !ct.func_150296_c().isEmpty()) { + this.oreDictionaryEntries.add(" -NBT compound tag subkeys:"); + Iterator stIterator = ct.func_150296_c().iterator(); + while (stIterator.hasNext()) { + String entry2 = (String) stIterator.next(); + this.oreDictionaryEntries.add(" " + entry2 + "=" + ct.getString(entry2)); + } + } + } else { + this.oreDictionaryEntries + .add(" " + entry + "=" + this.itemsSlot.get().stackTagCompound.getString(entry)); + } + } + } + if (ids.length > 0) { + this.oreDictionaryEntries.add("Ore dict. entries:"); + for (int i = 0; i < ids.length; i++) { + this.oreDictionaryEntries.add(" " + OreDictionary.getOreName(ids[i])); + } + } + lastItem = this.itemsSlot.get(0); + } + if (this.itemsSlot.get(1) != null && this.itemsSlot.get(1) != lastItem) { + this.oreDictionaryEntries.clear(); + FluidStack fluid = null; + this.oreDictionaryEntries.add("Fluid related item type:"); + if (this.itemsSlot.get(1).getItem() instanceof IFluidContainerItem) { + this.oreDictionaryEntries.add(" IFluidContainerItem"); + fluid = ((IFluidContainerItem) this.itemsSlot.get(1).getItem()).getFluid(this.itemsSlot.get(1)); + } else if (FluidContainerRegistry.isContainer(this.itemsSlot.get(1))) { + this.oreDictionaryEntries.add(" FluidContainerRegistry entry"); + if (FluidContainerRegistry.isBucket(this.itemsSlot.get(1))) { + this.oreDictionaryEntries.add("This is bucket."); + } else { + this.oreDictionaryEntries.add("This is not a bucket."); + } + ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(this.itemsSlot.get(1)); + if (emptyContainer != null) { + this.oreDictionaryEntries.add("This container could return empty container:"); + this.oreDictionaryEntries.add(" " + emptyContainer.getDisplayName()); + } else { + this.oreDictionaryEntries.add("This container has no empty version."); + } + fluid = FluidContainerRegistry.getFluidForFilledItem(this.itemsSlot.get(1)); + } else { + this.oreDictionaryEntries.add(" none"); + } + if (fluid != null) { + this.oreDictionaryEntries.add("Internal fluid name:"); + this.oreDictionaryEntries.add(" " + fluid.getFluid().getName()); + this.oreDictionaryEntries.add("Fluid class:"); + this.oreDictionaryEntries.add(" " + fluid.getFluid().getClass().getName()); + this.oreDictionaryEntries.add("Fluid id:"); + this.oreDictionaryEntries.add(" " + fluid.getFluid().getID()); + this.oreDictionaryEntries.add("Fluid still icon:"); + if (fluid.getFluid().getStillIcon() != null) { + this.oreDictionaryEntries.add(" " + fluid.getFluid().getStillIcon().getIconName()); + } else { + this.oreDictionaryEntries.add(" "); + } + this.oreDictionaryEntries.add("Fluid flowing icon:"); + if (fluid.getFluid().getFlowingIcon() != null) { + this.oreDictionaryEntries.add(" " + fluid.getFluid().getFlowingIcon().getIconName()); + } else { + this.oreDictionaryEntries.add(" "); + } + } + lastItem = this.itemsSlot.get(1); + } + } + } + + /** + * Returns the name of the inventory + */ + @Override + public String getInventoryName() { + return "debugScanner"; + } - @Override - public void onGuiClosed(EntityPlayer entityPlayer) {} + @Override + public ContainerBase getGuiContainer(EntityPlayer entityPlayer) { + return new DebugScannerContainer(entityPlayer, this); + } + @Override + @SideOnly(Side.CLIENT) + public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) { + return new DebugScannerGui(new DebugScannerContainer(entityPlayer, this)); + } - public boolean getGui(EntityPlayer player) - { - return this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false; - } - } \ No newline at end of file + @Override + public void onGuiClosed(EntityPlayer entityPlayer) { + } + + public boolean getGui(EntityPlayer player) { + return this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) + : false; + } +} \ No newline at end of file -- cgit v1.2.3