ForgePatch/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch

122 lines
7.2 KiB
Diff
Raw Normal View History

--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
2016-11-13 22:09:54 +00:00
@@ -121,9 +121,9 @@
super.func_145839_a(p_145839_1_);
this.field_145957_n = NonNullList.<ItemStack>func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a);
ItemStackHelper.func_191283_b(p_145839_1_, this.field_145957_n);
- this.field_145956_a = p_145839_1_.func_74765_d("BurnTime");
- this.field_174906_k = p_145839_1_.func_74765_d("CookTime");
- this.field_174905_l = p_145839_1_.func_74765_d("CookTimeTotal");
+ this.field_145956_a = p_145839_1_.func_74762_e("BurnTime");
+ this.field_174906_k = p_145839_1_.func_74762_e("CookTime");
+ this.field_174905_l = p_145839_1_.func_74762_e("CookTimeTotal");
2016-11-13 22:09:54 +00:00
this.field_145963_i = func_145952_a((ItemStack)this.field_145957_n.get(1));
if (p_145839_1_.func_150297_b("CustomName", 8))
2016-11-13 22:09:54 +00:00
@@ -135,9 +135,9 @@
public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_)
{
super.func_189515_b(p_189515_1_);
- p_189515_1_.func_74777_a("BurnTime", (short)this.field_145956_a);
- p_189515_1_.func_74777_a("CookTime", (short)this.field_174906_k);
- p_189515_1_.func_74777_a("CookTimeTotal", (short)this.field_174905_l);
2016-11-13 22:09:54 +00:00
+ p_189515_1_.func_74768_a("BurnTime", (short)this.field_145956_a);
+ p_189515_1_.func_74768_a("CookTime", (short)this.field_174906_k);
+ p_189515_1_.func_74768_a("CookTimeTotal", (short)this.field_174905_l);
ItemStackHelper.func_191282_a(p_189515_1_, this.field_145957_n);
2016-11-13 22:09:54 +00:00
if (this.func_145818_k_())
@@ -196,8 +196,8 @@
2016-11-13 22:09:54 +00:00
if (itemstack.func_190926_b())
{
2016-11-13 22:09:54 +00:00
- Item item1 = item.func_77668_q();
- this.field_145957_n.set(1, item1 == null ? ItemStack.field_190927_a : new ItemStack(item1));
+ ItemStack item1 = item.getContainerItem(itemstack);
+ this.field_145957_n.set(1, item1);
}
}
}
2016-11-13 22:09:54 +00:00
@@ -260,7 +260,10 @@
else
{
ItemStack itemstack1 = (ItemStack)this.field_145957_n.get(2);
- return itemstack1.func_190926_b() ? true : (!itemstack1.func_77969_a(itemstack) ? false : (itemstack1.func_190916_E() < this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d() ? true : itemstack1.func_190916_E() < itemstack.func_77976_d()));
+ if (itemstack1.func_190926_b()) return true;
+ if (!itemstack1.func_77969_a(itemstack)) return false;
+ int result = itemstack1.func_190916_E() + itemstack.func_190916_E();
+ return result <= func_70297_j_() && result <= itemstack1.func_77976_d(); // Forge fix: make furnace respect stack sizes in furnace recipes
}
}
}
2016-06-23 06:39:36 +00:00
@@ -279,7 +282,7 @@
}
2016-11-13 22:09:54 +00:00
else if (itemstack2.func_77973_b() == itemstack1.func_77973_b())
{
2016-11-13 22:09:54 +00:00
- itemstack2.func_190917_f(1);
+ itemstack2.func_190917_f(itemstack1.func_190916_E());
}
2016-11-13 22:09:54 +00:00
if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && itemstack.func_77960_j() == 1 && !((ItemStack)this.field_145957_n.get(1)).func_190926_b() && ((ItemStack)this.field_145957_n.get(1)).func_77973_b() == Items.field_151133_ar)
@@ -300,7 +303,36 @@
else
{
Item item = p_145952_0_.func_77973_b();
- return item == Item.func_150898_a(Blocks.field_150376_bx) ? 150 : (item == Item.func_150898_a(Blocks.field_150325_L) ? 100 : (item == Item.func_150898_a(Blocks.field_150404_cg) ? 67 : (item == Item.func_150898_a(Blocks.field_150468_ap) ? 300 : (item == Item.func_150898_a(Blocks.field_150471_bO) ? 100 : (Block.func_149634_a(item).func_176223_P().func_185904_a() == Material.field_151575_d ? 300 : (item == Item.func_150898_a(Blocks.field_150402_ci) ? 16000 : (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).func_77861_e()) ? 200 : (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).func_150932_j()) ? 200 : (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).func_77842_f()) ? 200 : (item == Items.field_151055_y ? 100 : (item != Items.field_151031_f && item != Items.field_151112_aM ? (item == Items.field_151155_ap ? 200 : (item == Items.field_151044_h ? 1600 : (item == Items.field_151129_at ? 20000 : (item != Item.func_150898_a(Blocks.field_150345_g) && item != Items.field_151054_z ? (item == Items.field_151072_bj ? 2400 : (item instanceof ItemDoor && item != Items.field_151139_aw ? 200 : (item instanceof ItemBoat ? 400 : 0))) : 100)))) : 300)))))))))));
+
+ if (item instanceof net.minecraft.item.ItemBlock && Block.func_149634_a(item) != Blocks.field_150350_a)
+ {
+ Block block = Block.func_149634_a(item);
+
+ if (block == Blocks.field_150376_bx)
+ {
+ return 150;
+ }
+
+ if (block.func_176223_P().func_185904_a() == Material.field_151575_d)
+ {
+ return 300;
+ }
+
+ if (block == Blocks.field_150402_ci)
+ {
+ return 16000;
+ }
+ }
+
2016-06-23 06:39:36 +00:00
+ if (item instanceof ItemTool && "WOOD".equals(((ItemTool)item).func_77861_e())) return 200;
+ if (item instanceof ItemSword && "WOOD".equals(((ItemSword)item).func_150932_j())) return 200;
+ if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe)item).func_77842_f())) return 200;
+ if (item == Items.field_151055_y) return 100;
+ if (item == Items.field_151044_h) return 1600;
+ if (item == Items.field_151129_at) return 20000;
+ if (item == Item.func_150898_a(Blocks.field_150345_g)) return 100;
+ if (item == Items.field_151072_bj) return 2400;
+ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_);
}
}
2016-11-13 22:09:54 +00:00
@@ -418,4 +450,22 @@
{
this.field_145957_n.clear();
Add IItemHandler capability Add the actual patches that I forgot. Add simple implementations of IStorage and the factory methods. Add ItemStackHandler. A simple IItemHandler implementaton. return nulls, not throw nulls. Move the vanilla wrappers to a separate class for now. Minor clean ups of VanillaWrapper code. Inline static methods. Add comments. Minor cleanup of code. Remove redundant size field and add a validate slot index method. Minor formatting issues. Break early If stacksize to insert is 0. Remove setByte() methods. Throw exception if IItemHandler can't be modifyed in NBT loading. Replace event handler with patches Add capability to mine cart inventory entities. Change formatting and registration of capability. Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them. Reduce patch sizes Lazy initialization of the item handler for vanilla tiles. Minor formatting changes. Create a single vanilla chest item handler that will merge with adjacent chests when detected. Added hooks to reset the cached adjacent value when a block update is detected and when a chunk loads. Revert "Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them." This reverts commit 306d4a37fd0e8c8a0754411c013b750dfe8e2c87. Fix furnace derp Replace double chest code with a simpler method. Vanilla wrappers implement IItemHandlerModifiable (since they are modifiable) Minor code cleanups Add an onContentsChanged() and onLoad() callback methods.to the default implementation. Add slot as a parameter in the callback method. Change IItemHandlerModifiable.setStackInSlot() to void, and added a note about not being intended for cross-mod use. Improve ItemStackHandler handling of errored NBT. Make the stacks array protected. Fix a lot of derps in SlotItemHandler. Fix derp in ItemStackHandler Clarify comments on IItemHandler ItemStackHandler no longer caches the stack array in local variable. Clean up the Chests code to make intentions clearer Vanilla hoppers have their cooldown activated when an item is inserted. Made this behavior part of an item handler (rather than the insertion code) Fix mistake in ItemStackHandler More documentation of potential edge cases in getStackInSlot() Make limit checking more resiliant.
2016-01-17 16:41:34 +00:00
}
+
+ net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP);
+ net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN);
+ net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST);
+
+ @SuppressWarnings("unchecked")
Add IItemHandler capability Add the actual patches that I forgot. Add simple implementations of IStorage and the factory methods. Add ItemStackHandler. A simple IItemHandler implementaton. return nulls, not throw nulls. Move the vanilla wrappers to a separate class for now. Minor clean ups of VanillaWrapper code. Inline static methods. Add comments. Minor cleanup of code. Remove redundant size field and add a validate slot index method. Minor formatting issues. Break early If stacksize to insert is 0. Remove setByte() methods. Throw exception if IItemHandler can't be modifyed in NBT loading. Replace event handler with patches Add capability to mine cart inventory entities. Change formatting and registration of capability. Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them. Reduce patch sizes Lazy initialization of the item handler for vanilla tiles. Minor formatting changes. Create a single vanilla chest item handler that will merge with adjacent chests when detected. Added hooks to reset the cached adjacent value when a block update is detected and when a chunk loads. Revert "Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them." This reverts commit 306d4a37fd0e8c8a0754411c013b750dfe8e2c87. Fix furnace derp Replace double chest code with a simpler method. Vanilla wrappers implement IItemHandlerModifiable (since they are modifiable) Minor code cleanups Add an onContentsChanged() and onLoad() callback methods.to the default implementation. Add slot as a parameter in the callback method. Change IItemHandlerModifiable.setStackInSlot() to void, and added a note about not being intended for cross-mod use. Improve ItemStackHandler handling of errored NBT. Make the stacks array protected. Fix a lot of derps in SlotItemHandler. Fix derp in ItemStackHandler Clarify comments on IItemHandler ItemStackHandler no longer caches the stack array in local variable. Clean up the Chests code to make intentions clearer Vanilla hoppers have their cooldown activated when an item is inserted. Made this behavior part of an item handler (rather than the insertion code) Fix mistake in ItemStackHandler More documentation of potential edge cases in getStackInSlot() Make limit checking more resiliant.
2016-01-17 16:41:34 +00:00
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ if (facing == EnumFacing.DOWN)
+ return (T) handlerBottom;
+ else if (facing == EnumFacing.UP)
+ return (T) handlerTop;
+ else
+ return (T) handlerSide;
+ return super.getCapability(capability, facing);
+ }
}