From 7bbc071d491c01064e0f282b79f59c1b6e1918da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=AA=E8=81=AA?= <178666380@qq.com> Date: Mon, 17 Jul 2017 07:20:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9A=84=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E9=80=A0=E6=88=90=E8=B4=9F=E6=95=B0=E7=89=A9=E5=93=81=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../minecraft/block/BlockDispenser.java.patch | 6 +++-- .../minecraft/block/BlockDropper.java.patch | 17 ++++++++++-- .../net/minecraft/item/ItemStack.java.patch | 26 +++++++++++++------ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/patches/net/minecraft/block/BlockDispenser.java.patch b/patches/net/minecraft/block/BlockDispenser.java.patch index c52cd2c..87b8e5d 100644 --- a/patches/net/minecraft/block/BlockDispenser.java.patch +++ b/patches/net/minecraft/block/BlockDispenser.java.patch @@ -18,11 +18,13 @@ { BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_); TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); -@@ -145,6 +147,7 @@ +@@ -145,7 +147,8 @@ if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider) { ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack); +- tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1); + eventFired = false; // CraftBukkit - reset event status - tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1); ++ tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize <= 0 ? null : itemstack1); } } + } diff --git a/patches/net/minecraft/block/BlockDropper.java.patch b/patches/net/minecraft/block/BlockDropper.java.patch index 5b1842d..e709e48 100644 --- a/patches/net/minecraft/block/BlockDropper.java.patch +++ b/patches/net/minecraft/block/BlockDropper.java.patch @@ -21,7 +21,7 @@ { BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_); TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); -@@ -60,10 +65,33 @@ +@@ -60,13 +65,36 @@ if (iinventory != null) { @@ -56,4 +56,17 @@ + // CraftBukkit end itemstack1 = itemstack.copy(); - if (--itemstack1.stackSize == 0) +- if (--itemstack1.stackSize == 0) ++ if (--itemstack1.stackSize <= 0) + { + itemstack1 = null; + } +@@ -80,7 +108,7 @@ + { + itemstack1 = this.field_149947_P.dispense(blocksourceimpl, itemstack); + +- if (itemstack1 != null && itemstack1.stackSize == 0) ++ if (itemstack1 != null && itemstack1.stackSize <= 0) + { + itemstack1 = null; + } diff --git a/patches/net/minecraft/item/ItemStack.java.patch b/patches/net/minecraft/item/ItemStack.java.patch index 0f572c2..5280e77 100644 --- a/patches/net/minecraft/item/ItemStack.java.patch +++ b/patches/net/minecraft/item/ItemStack.java.patch @@ -46,7 +46,17 @@ private static final String __OBFID = "CL_00000043"; private cpw.mods.fml.common.registry.RegistryDelegate delegate; -@@ -126,12 +135,14 @@ +@@ -95,6 +104,9 @@ + + public ItemStack splitStack(int p_77979_1_) + { ++ if(p_77979_1_<=0||p_77979_1_>this.stackSize) ++ return new ItemStack((Item)null,0,0); ++ + ItemStack itemstack = new ItemStack(this.field_151002_e, p_77979_1_, this.itemDamage); + + if (this.stackTagCompound != null) +@@ -126,12 +138,14 @@ public boolean tryPlaceItemIntoWorld(EntityPlayer p_77943_1_, World p_77943_2_, int p_77943_3_, int p_77943_4_, int p_77943_5_, int p_77943_6_, float p_77943_7_, float p_77943_8_, float p_77943_9_) { if (!p_77943_2_.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_77943_1_, p_77943_2_, p_77943_3_, p_77943_4_, p_77943_5_, p_77943_6_, p_77943_7_, p_77943_8_, p_77943_9_); @@ -62,7 +72,7 @@ return flag; } -@@ -143,7 +154,9 @@ +@@ -143,7 +157,9 @@ public ItemStack useItemRightClick(World p_77957_1_, EntityPlayer p_77957_2_) { @@ -73,7 +83,7 @@ } public ItemStack onFoodEaten(World p_77950_1_, EntityPlayer p_77950_2_) -@@ -227,8 +240,22 @@ +@@ -227,8 +243,22 @@ return getItem().getMaxDamage(this); } @@ -96,7 +106,7 @@ if (!this.isItemStackDamageable()) { return false; -@@ -250,6 +277,23 @@ +@@ -250,6 +280,23 @@ p_96631_1_ -= k; @@ -120,7 +130,7 @@ if (p_96631_1_ <= 0) { return false; -@@ -267,7 +311,7 @@ +@@ -267,7 +314,7 @@ { if (this.isItemStackDamageable()) { @@ -129,7 +139,7 @@ { p_77972_2_.renderBrokenItemStack(this); --this.stackSize; -@@ -288,6 +332,12 @@ +@@ -288,6 +335,12 @@ this.stackSize = 0; } @@ -142,7 +152,7 @@ this.itemDamage = 0; } } -@@ -419,6 +469,7 @@ +@@ -419,6 +472,7 @@ public void setTagCompound(NBTTagCompound p_77982_1_) { @@ -150,7 +160,7 @@ this.stackTagCompound = p_77982_1_; } -@@ -768,4 +819,12 @@ +@@ -768,4 +822,12 @@ return ichatcomponent; }