From eb22f42fea02192f9508558a53adab13e19f82e4 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 5 Dec 2018 18:08:27 -0800 Subject: [PATCH] More patch work, our async chunk loading doesn't appear to be viable for 1.13. --- .../block/state/IBlockState.java.patch | 12 +- .../multiplayer/PlayerControllerMP.java.patch | 4 +- .../minecraft/inventory/Container.java.patch | 43 +++ .../inventory/ContainerBeacon.java.patch | 25 ++ .../ContainerBrewingStand.java.patch | 29 ++ .../inventory/ContainerEnchantment.java.patch | 90 ++++++ .../inventory/ContainerPlayer.java.patch | 11 + .../inventory/ContainerRepair.java.patch | 41 +++ .../inventory/SlotCrafting.java.patch | 12 + .../dedicated/DedicatedServer.java.patch | 43 ++- .../dedicated/ServerHangWatchdog.java.patch | 11 + .../server/gui/MinecraftServerGui.java.patch | 19 ++ .../management/PlayerChunkMapEntry.java.patch | 133 ++++++++ .../PlayerInteractionManager.java.patch | 232 ++++++++++++++ .../minecraft/inventory/Container.java.patch | 47 --- .../inventory/ContainerBeacon.java.patch | 27 -- .../ContainerBrewingStand.java.patch | 29 -- .../inventory/ContainerEnchantment.java.patch | 98 ------ .../inventory/ContainerPlayer.java.patch | 11 - .../inventory/ContainerRepair.java.patch | 51 ---- .../dedicated/DedicatedServer.java.patch | 78 ----- .../dedicated/ServerHangWatchdog.java.patch | 11 - .../server/gui/MinecraftServerGui.java.patch | 24 -- .../management/PlayerChunkMapEntry.java.patch | 162 ---------- .../PlayerInteractionManager.java.patch | 286 ------------------ .../SlotCrafting.java.patch | 10 - .../SlotFurnaceOutput.java.patch | 0 .../minecraftforge/common/ForgeConfig.java | 18 +- .../common/extensions/IForgeBlockState.java | 1 + .../common/extensions/IForgeItem.java | 10 +- .../common/extensions/IForgeItemStack.java | 40 ++- .../items/wrapper/PlayerArmorInvWrapper.java | 2 +- src/main/resources/forge_at.cfg | 2 +- 33 files changed, 750 insertions(+), 862 deletions(-) create mode 100644 patches/minecraft/net/minecraft/inventory/Container.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch create mode 100644 patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch create mode 100644 patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/Container.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/inventory/ContainerRepair.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch delete mode 100644 patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch rename {patches_old/minecraft/net/minecraft/inventory => patches_old_unknown}/SlotCrafting.java.patch (50%) rename {patches_old/minecraft/net/minecraft/inventory => patches_old_unknown}/SlotFurnaceOutput.java.patch (100%) diff --git a/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch b/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch index 1843b7303..e3f4d07d9 100644 --- a/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch @@ -9,11 +9,19 @@ ThreadLocal> field_208776_a = ThreadLocal.>withInitial(() -> { Object2ByteOpenHashMap object2byteopenhashmap = new Object2ByteOpenHashMap(); object2byteopenhashmap.defaultReturnValue((byte)127); -@@ -109,6 +109,7 @@ +@@ -97,6 +97,7 @@ + return this.func_177230_c().func_149750_m(this); + } + ++ @Deprecated //Forge: Use position sensitive version + default boolean func_196958_f() { + return this.func_177230_c().func_196261_e(this); + } +@@ -109,6 +110,7 @@ return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_); } -+ @Deprecated//Forge: Use position sensitive version ++ @Deprecated //Forge: Use position sensitive version default IBlockState func_185907_a(Rotation p_185907_1_) { return this.func_177230_c().func_185499_a(this, p_185907_1_); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 1e325683d..29a4fc9bb 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -4,7 +4,7 @@ } } -+ if (!field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; ++ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; + World world = this.field_78776_a.field_71441_e; IBlockState iblockstate = world.func_180495_p(p_187103_1_); @@ -33,7 +33,7 @@ } } -+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); ++ boolean flag = iblockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); + if (flag) block.func_176206_d(world, p_187103_1_, iblockstate); return flag; } diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch new file mode 100644 index 000000000..2841fb14c --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -0,0 +1,43 @@ +--- a/net/minecraft/inventory/Container.java ++++ b/net/minecraft/inventory/Container.java +@@ -67,9 +67,11 @@ + ItemStack itemstack = ((Slot)this.field_75151_b.get(i)).func_75211_c(); + ItemStack itemstack1 = this.field_75153_a.get(i); + if (!ItemStack.func_77989_b(itemstack1, itemstack)) { ++ boolean clientStackChanged = !ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack); + itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); + this.field_75153_a.set(i, itemstack1); + ++ if (clientStackChanged) + for(int j = 0; j < this.field_75149_d.size(); ++j) { + ((IContainerListener)this.field_75149_d.get(j)).func_71111_a(this, i, itemstack1); + } +@@ -430,14 +432,15 @@ + ItemStack itemstack = slot.func_75211_c(); + if (!itemstack.func_190926_b() && func_195929_a(p_75135_1_, itemstack)) { + int j = itemstack.func_190916_E() + p_75135_1_.func_190916_E(); +- if (j <= p_75135_1_.func_77976_d()) { ++ int maxSize = Math.min(slot.func_75219_a(), p_75135_1_.func_77976_d()); ++ if (j <= maxSize) { + p_75135_1_.func_190920_e(0); + itemstack.func_190920_e(j); + slot.func_75218_e(); + flag = true; +- } else if (itemstack.func_190916_E() < p_75135_1_.func_77976_d()) { +- p_75135_1_.func_190918_g(p_75135_1_.func_77976_d() - itemstack.func_190916_E()); +- itemstack.func_190920_e(p_75135_1_.func_77976_d()); ++ } else if (itemstack.func_190916_E() < maxSize) { ++ p_75135_1_.func_190918_g(maxSize - itemstack.func_190916_E()); ++ itemstack.func_190920_e(maxSize); + slot.func_75218_e(); + flag = true; + } +@@ -538,7 +541,7 @@ + p_94525_2_.func_190920_e(1); + break; + case 2: +- p_94525_2_.func_190920_e(p_94525_2_.func_77973_b().func_77639_j()); ++ p_94525_2_.func_190920_e(p_94525_2_.func_77976_d()); + } + + p_94525_2_.func_190917_f(p_94525_3_); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch new file mode 100644 index 000000000..1fe539ab9 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -0,0 +1,25 @@ +--- a/net/minecraft/inventory/ContainerBeacon.java ++++ b/net/minecraft/inventory/ContainerBeacon.java +@@ -71,10 +71,8 @@ + } + + slot.func_75220_a(itemstack1, itemstack); +- } else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.func_190916_E() == 1) { +- if (!this.func_75135_a(itemstack1, 0, 1, false)) { +- return ItemStack.field_190927_a; +- } ++ } else if (this.func_75135_a(itemstack1, 0, 1, false)) { //Forge Fix Shift Clicking in beacons with stacks larger then 1. ++ return ItemStack.field_190927_a; + } else if (p_82846_2_ >= 1 && p_82846_2_ < 28) { + if (!this.func_75135_a(itemstack1, 28, 37, false)) { + return ItemStack.field_190927_a; +@@ -109,8 +107,7 @@ + } + + public boolean func_75214_a(ItemStack p_75214_1_) { +- Item item = p_75214_1_.func_77973_b(); +- return item == Items.field_151166_bC || item == Items.field_151045_i || item == Items.field_151043_k || item == Items.field_151042_j; ++ return p_75214_1_.isBeaconPayment(); + } + + public int func_75219_a() { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 000000000..442a54fe9 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/inventory/ContainerBrewingStand.java ++++ b/net/minecraft/inventory/ContainerBrewingStand.java +@@ -149,7 +149,7 @@ + } + + public boolean func_75214_a(ItemStack p_75214_1_) { +- return PotionBrewing.func_185205_a(p_75214_1_); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); + } + + public int func_75219_a() { +@@ -173,6 +173,7 @@ + public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) { + PotionType potiontype = PotionUtils.func_185191_c(p_190901_2_); + if (p_190901_1_ instanceof EntityPlayerMP) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(p_190901_1_, p_190901_2_); + CriteriaTriggers.field_192130_j.func_192173_a((EntityPlayerMP)p_190901_1_, potiontype); + } + +@@ -181,8 +182,7 @@ + } + + public static boolean func_75243_a_(ItemStack p_75243_0_) { +- Item item = p_75243_0_.func_77973_b(); +- return item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); + } + } + } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch new file mode 100644 index 000000000..39d7a1083 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -0,0 +1,90 @@ +--- a/net/minecraft/inventory/ContainerEnchantment.java ++++ b/net/minecraft/inventory/ContainerEnchantment.java +@@ -66,7 +66,7 @@ + }); + this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { + public boolean func_75214_a(ItemStack p_75214_1_) { +- return p_75214_1_.func_77973_b() == Items.field_196128_bn; ++ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_199685_a_(p_75214_1_.func_77973_b()); + } + }); + +@@ -126,40 +126,29 @@ + + } + ++ private float getPower(BlockPos pos) { ++ return field_75172_h.func_180495_p(pos).getEnchantPowerBonus(field_75172_h, pos); ++ } ++ + public void func_75130_a(IInventory p_75130_1_) { + if (p_75130_1_ == this.field_75168_e) { + ItemStack itemstack = p_75130_1_.func_70301_a(0); + if (!itemstack.func_190926_b() && itemstack.func_77956_u()) { + if (!this.field_75172_h.field_72995_K) { + int l = 0; ++ float power = 0; + + for(int j = -1; j <= 1; ++j) { + for(int k = -1; k <= 1; ++k) { + if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) { +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } ++ power += getPower(field_178150_j.func_177982_a(k * 2, 0, j * 2)); ++ power += getPower(field_178150_j.func_177982_a(k * 2, 1, j * 2)); + +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } +- + if (k != 0 && j != 0) { +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } +- +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } +- +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } +- +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++l; +- } ++ power += getPower(field_178150_j.func_177982_a(k * 2, 0, j)); ++ power += getPower(field_178150_j.func_177982_a(k * 2, 1, j)); ++ power += getPower(field_178150_j.func_177982_a(k, 0, j * 2)); ++ power += getPower(field_178150_j.func_177982_a(k, 1, j * 2)); + } + } + } +@@ -168,12 +157,13 @@ + this.field_75169_l.setSeed((long)this.field_178149_f); + + for(int i1 = 0; i1 < 3; ++i1) { +- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, l, itemstack); ++ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); + this.field_185001_h[i1] = -1; + this.field_185002_i[i1] = -1; + if (this.field_75167_g[i1] < i1 + 1) { + this.field_75167_g[i1] = 0; + } ++ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(field_75172_h, field_178150_j, i1, (int)power, itemstack, field_75167_g[i1]); + } + + for(int j1 = 0; j1 < 3; ++j1) { +@@ -305,9 +295,8 @@ + return ItemStack.field_190927_a; + } + +- if (itemstack1.func_77942_o() && itemstack1.func_190916_E() == 1) { +- ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77946_l()); +- itemstack1.func_190920_e(0); ++ if (itemstack1.func_77942_o()) { // Forge: Fix MC-17431 ++ ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77979_a(1)); + } else if (!itemstack1.func_190926_b()) { + ((Slot)this.field_75151_b.get(0)).func_75215_d(new ItemStack(itemstack1.func_77973_b())); + itemstack1.func_190918_g(1); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 000000000..67aab5019 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/inventory/ContainerPlayer.java ++++ b/net/minecraft/inventory/ContainerPlayer.java +@@ -38,7 +38,7 @@ + } + + public boolean func_75214_a(ItemStack p_75214_1_) { +- return entityequipmentslot == EntityLiving.func_184640_d(p_75214_1_); ++ return p_75214_1_.canEquip(entityequipmentslot, field_82862_h); + } + + public boolean func_82869_a(EntityPlayer p_82869_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch new file mode 100644 index 000000000..1abe0912f --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/inventory/ContainerRepair.java ++++ b/net/minecraft/inventory/ContainerRepair.java +@@ -63,6 +63,8 @@ + p_190901_1_.func_82242_a(-ContainerRepair.this.field_82854_e); + } + ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_190901_1_, p_190901_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); ++ + ContainerRepair.this.field_82853_g.func_70299_a(0, ItemStack.field_190927_a); + if (ContainerRepair.this.field_82856_l > 0) { + ItemStack itemstack = ContainerRepair.this.field_82853_g.func_70301_a(1); +@@ -79,7 +81,7 @@ + ContainerRepair.this.field_82854_e = 0; + IBlockState iblockstate1 = p_i45807_2_.func_180495_p(p_i45807_3_); + if (!p_i45807_2_.field_72995_K) { +- if (!p_190901_1_.field_71075_bZ.field_75098_d && iblockstate1.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < 0.12F) { ++ if (!p_190901_1_.field_71075_bZ.field_75098_d && iblockstate1.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < breakChance) { + IBlockState iblockstate = BlockAnvil.func_196433_f(iblockstate1); + if (iblockstate == null) { + p_i45807_2_.func_175698_g(p_i45807_3_); +@@ -132,8 +134,11 @@ + Map map = EnchantmentHelper.func_82781_a(itemstack1); + j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A()); + this.field_82856_l = 0; ++ boolean flag = false; ++ + if (!itemstack2.func_190926_b()) { +- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).isEmpty(); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, j)) return; ++ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).isEmpty(); + if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) { + int l2 = Math.min(itemstack1.func_77952_i(), itemstack1.func_77958_k() / 4); + if (l2 <= 0) { +@@ -250,6 +255,7 @@ + i += k; + itemstack1.func_200302_a(new TextComponentString(this.field_82857_m)); + } ++ if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.field_190927_a; + + this.field_82854_e = j + i; + if (i <= 0) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch new file mode 100644 index 000000000..4d62ca7fc --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/inventory/SlotCrafting.java ++++ b/net/minecraft/inventory/SlotCrafting.java +@@ -47,7 +47,9 @@ + + public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) { + this.func_75208_c(p_190901_2_); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_190901_1_); + NonNullList nonnulllist = p_190901_1_.field_70170_p.func_199532_z().func_199513_c(this.field_75239_a, p_190901_1_.field_70170_p); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); + + for(int i = 0; i < nonnulllist.size(); ++i) { + ItemStack itemstack = this.field_75239_a.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 9b5413a54..08e26b4b4 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,6 +1,14 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -110,6 +110,7 @@ +@@ -89,6 +89,7 @@ + public boolean func_71197_b() throws IOException { + Thread thread = new Thread("Server console handler") { + public void run() { ++ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); + + String s4; +@@ -110,6 +111,7 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -8,7 +16,7 @@ field_155771_h.info("Loading properties"); this.field_71340_o = new PropertyManager(new File("server.properties")); this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -181,6 +182,7 @@ +@@ -181,6 +183,7 @@ if (!PreYggdrasilConverter.func_152714_a(this.field_71340_o)) { return false; } else { @@ -16,7 +24,7 @@ this.func_184105_a(new DedicatedPlayerList(this)); long j = Util.func_211178_c(); if (this.func_71270_I() == null) { -@@ -218,6 +220,7 @@ +@@ -218,6 +221,7 @@ TileEntitySkull.func_184293_a(this.func_152358_ax()); TileEntitySkull.func_184294_a(this.func_147130_as()); PlayerProfileCache.func_187320_a(this.func_71266_T()); @@ -24,7 +32,15 @@ field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); JsonObject jsonobject = new JsonObject(); if (worldtype == WorldType.field_77138_c) { -@@ -257,7 +260,8 @@ +@@ -230,6 +234,7 @@ + long i1 = Util.func_211178_c() - j; + String s3 = String.format(Locale.ROOT, "%.3fs", (double)i1 / 1.0E9D); + field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s3); ++ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (this.field_71340_o.func_187239_a("announce-player-achievements")) { + this.func_200252_aR().func_82764_b("announceAdvancements", this.field_71340_o.func_73670_a("announce-player-achievements", true) ? "true" : "false", this); + this.field_71340_o.func_187238_b("announce-player-achievements"); +@@ -257,7 +262,8 @@ } Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); @@ -34,3 +50,22 @@ } } } +@@ -436,7 +442,7 @@ + } + + public boolean func_175579_a(World p_175579_1_, BlockPos p_175579_2_, EntityPlayer p_175579_3_) { +- if (p_175579_1_.field_73011_w.func_186058_p().func_186068_a() != 0) { ++ if (p_175579_1_.field_73011_w.getId() != 0) { + return false; + } else if (this.func_184103_al().func_152603_m().func_152690_d()) { + return false; +@@ -566,4 +572,9 @@ + this.func_195571_aL().func_197059_a(this.field_184115_n.func_195540_f(), p_71252_1_); + return this.field_184115_n.func_70008_c(); + } ++ ++ @Override //Forge: Enable formated text for colors in console. ++ public void func_145747_a(net.minecraft.util.text.ITextComponent message) { ++ field_155771_h.info(message.func_150254_d()); ++ } + } diff --git a/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch new file mode 100644 index 000000000..bee1dd90e --- /dev/null +++ b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/dedicated/ServerHangWatchdog.java ++++ b/net/minecraft/server/dedicated/ServerHangWatchdog.java +@@ -36,7 +36,7 @@ + ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); + ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true); + StringBuilder stringbuilder = new StringBuilder(); +- Error error = new Error(); ++ Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error + + for(ThreadInfo threadinfo : athreadinfo) { + if (threadinfo.getThreadId() == this.field_180249_b.func_175583_aK().getId()) { diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch new file mode 100644 index 000000000..3d605342a --- /dev/null +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/server/gui/MinecraftServerGui.java ++++ b/net/minecraft/server/gui/MinecraftServerGui.java +@@ -129,11 +129,16 @@ + return jpanel; + } + ++ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); + public void func_206931_a() { + this.field_206932_d.start(); ++ latch.countDown(); + } + + public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { ++ try { ++ latch.await(); ++ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. + if (!SwingUtilities.isEventDispatchThread()) { + SwingUtilities.invokeLater(() -> { + this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_); diff --git a/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch new file mode 100644 index 000000000..76f22b284 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch @@ -0,0 +1,133 @@ +--- a/net/minecraft/server/management/PlayerChunkMapEntry.java ++++ b/net/minecraft/server/management/PlayerChunkMapEntry.java +@@ -30,11 +30,17 @@ + private int field_187288_h; + private long field_187289_i; + private boolean field_187290_j; ++ /*private boolean loading = true; ++ private final Runnable loadedRunnable;*/ + + public PlayerChunkMapEntry(PlayerChunkMap p_i1518_1_, int p_i1518_2_, int p_i1518_3_) { + this.field_187282_b = p_i1518_1_; + this.field_187284_d = new ChunkPos(p_i1518_2_, p_i1518_3_); ++ //this.loadedRunnable = () -> { + this.field_187286_f = p_i1518_1_.func_72688_a().func_72863_F().func_201714_b(p_i1518_2_, p_i1518_3_); ++ /*this.loading = false; ++ }; Forge: Pending if we find a better way to async load/gen chunks. ++ mapIn.getWorld().getChunkProvider().loadChunk(chunkX, chunkZ, this.loadedRunnable);*/ + } + + public ChunkPos func_187264_a() { +@@ -52,6 +58,8 @@ + this.field_187283_c.add(p_187276_1_); + if (this.field_187290_j) { + this.func_187278_c(p_187276_1_); ++ // chunk watch event - the chunk is ready ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, p_187276_1_)); + } + + } +@@ -59,11 +67,26 @@ + + public void func_187277_b(EntityPlayerMP p_187277_1_) { + if (this.field_187283_c.contains(p_187277_1_)) { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (this.field_187286_f == null) { ++ this.field_187283_c.remove(p_187277_1_); ++ ++ if (this.field_187283_c.isEmpty()) { ++ /*if (this.loading) ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.getWorld(), this.pos.x, this.pos.z, this.loadedRunnable); ++ */ ++ this.field_187282_b.func_187305_b(this); ++ } ++ ++ return; ++ } ++ + if (this.field_187290_j) { + p_187277_1_.field_71135_a.func_147359_a(new SPacketUnloadChunk(this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b)); + } + + this.field_187283_c.remove(p_187277_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(this.field_187286_f, p_187277_1_)); + if (this.field_187283_c.isEmpty()) { + this.field_187282_b.func_187305_b(this); + } +@@ -72,6 +95,7 @@ + } + + public boolean func_187268_a(boolean p_187268_1_) { ++ //if (this.loading) return false; + if (this.field_187286_f != null) { + return true; + } else { +@@ -96,11 +120,14 @@ + this.field_187287_g = 0; + this.field_187288_h = 0; + this.field_187290_j = true; ++ if (this.field_187283_c.isEmpty()) return true; // Forge: fix MC-120780 + Packet packet = new SPacketChunkData(this.field_187286_f, 65535); + + for(EntityPlayerMP entityplayermp : this.field_187283_c) { + entityplayermp.field_71135_a.func_147359_a(packet); + this.field_187282_b.func_72688_a().func_73039_n().func_85172_a(entityplayermp, this.field_187286_f); ++ // chunk watch event - delayed to here as the chunk wasn't ready in addPlayer ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, entityplayermp)); + } + + return true; +@@ -130,7 +157,7 @@ + } + + this.field_187288_h |= 1 << (p_187265_2_ >> 4); +- if (this.field_187287_g < 64) { ++ { //Forge; Cache everything, so always run + short short1 = (short)(p_187265_1_ << 12 | p_187265_3_ << 8 | p_187265_2_); + + for(int i = 0; i < this.field_187287_g; ++i) { +@@ -139,6 +166,8 @@ + } + } + ++ if (this.field_187287_g == this.field_187285_e.length) ++ this.field_187285_e = java.util.Arrays.copyOf(this.field_187285_e, this.field_187285_e.length << 1); + this.field_187285_e[this.field_187287_g++] = short1; + } + +@@ -163,20 +192,22 @@ + int k = (this.field_187285_e[0] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; + BlockPos blockpos = new BlockPos(i, j, k); + this.func_187267_a(new SPacketBlockChange(this.field_187282_b.func_72688_a(), blockpos)); +- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos).func_177230_c().func_149716_u()) { ++ if (this.field_187282_b.func_72688_a().func_180495_p(blockpos).hasTileEntity()) { + this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos)); + } +- } else if (this.field_187287_g == 64) { ++ } else if (this.field_187287_g >= net.minecraftforge.common.ForgeConfig.GENERAL.clumpingThreshold()) { + this.func_187267_a(new SPacketChunkData(this.field_187286_f, this.field_187288_h)); ++ //TODO: Fix Mojang's fuckup to modded by combining all TE data into the chunk data packet... seriously... packet size explosion! + } else { + this.func_187267_a(new SPacketMultiBlockChange(this.field_187287_g, this.field_187285_e, this.field_187286_f)); +- ++ //} Keep this in the else until we figure out a fix for mojang's derpitude on the data packet so we don't double send crap. ++ //{// Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small + for(int l = 0; l < this.field_187287_g; ++l) { + int i1 = (this.field_187285_e[l] >> 12 & 15) + this.field_187284_d.field_77276_a * 16; + int j1 = this.field_187285_e[l] & 255; + int k1 = (this.field_187285_e[l] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; + BlockPos blockpos1 = new BlockPos(i1, j1, k1); +- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos1).func_177230_c().func_149716_u()) { ++ if (this.field_187282_b.func_72688_a().func_180495_p(blockpos1).hasTileEntity()) { + this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos1)); + } + } +@@ -240,4 +271,8 @@ + + return d0; + } ++ ++ public List getWatchingPlayers() { ++ return func_187274_e() ? java.util.Collections.unmodifiableList(field_187283_c) : java.util.Collections.emptyList(); ++ } + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch new file mode 100644 index 000000000..4da9d6b66 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -0,0 +1,232 @@ +--- a/net/minecraft/server/management/PlayerInteractionManager.java ++++ b/net/minecraft/server/management/PlayerInteractionManager.java +@@ -75,7 +75,7 @@ + if (this.field_73097_j) { + int i = this.field_73100_i - this.field_73093_n; + IBlockState iblockstate = this.field_73092_a.func_180495_p(this.field_180241_i); +- if (iblockstate.func_196958_f()) { ++ if (iblockstate.isAir(field_73092_a, this.field_180241_i)) { + this.field_73097_j = false; + } else { + float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(i + 1); +@@ -92,13 +92,13 @@ + } + } else if (this.field_73088_d) { + IBlockState iblockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); +- if (iblockstate1.func_196958_f()) { ++ if (iblockstate1.isAir(field_73092_a, this.field_180240_f)) { + this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); + this.field_73094_o = -1; + this.field_73088_d = false; + } else { + int k = this.field_73100_i - this.field_73089_e; +- float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); ++ float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position + int l = (int)(f1 * 10.0F); + if (l != this.field_73094_o) { + this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, l); +@@ -110,6 +110,13 @@ + } + + public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { ++ double reachDist = field_73090_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, reachDist + 1)); ++ if (event.isCanceled()) { // Restore block and te data ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); ++ return; ++ } + if (this.func_73083_d()) { + if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) { + this.func_180237_b(p_180784_1_); +@@ -134,16 +141,30 @@ + } + } + +- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + this.field_73089_e = this.field_73100_i; + float f = 1.0F; + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180784_1_); +- if (!iblockstate.func_196958_f()) { ++ if (!iblockstate.isAir(field_73092_a, p_180784_1_)) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) { + iblockstate.func_196942_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); ++ } else { // Restore block and te data ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); ++ } + f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); + } + +- if (!iblockstate.func_196958_f() && f >= 1.0F) { ++ ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ if (f >= 1.0F) { // Restore block and te data ++ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); ++ } ++ return; ++ } ++ ++ if (!iblockstate.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) { + this.func_180237_b(p_180784_1_); + } else { + this.field_73088_d = true; +@@ -161,7 +182,7 @@ + if (p_180785_1_.equals(this.field_180240_f)) { + int i = this.field_73100_i - this.field_73089_e; + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); +- if (!iblockstate.func_196958_f()) { ++ if (!iblockstate.isAir(field_73092_a, p_180785_1_)) { + float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); + if (f >= 0.7F) { + this.field_73088_d = false; +@@ -184,11 +205,14 @@ + } + + private boolean func_180235_c(BlockPos p_180235_1_) { +- IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); +- iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); ++ return removeBlock(p_180235_1_, false); ++ } ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) { ++ IBlockState iblockstate = this.field_73092_a.func_180495_p(pos); ++ boolean flag = iblockstate.removedByPlayer(field_73092_a, pos, field_73090_b, canHarvest, field_73092_a.func_204610_c(pos)); ++ + if (flag) { +- iblockstate.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, iblockstate); ++ iblockstate.func_177230_c().func_176206_d(this.field_73092_a, pos, iblockstate); + } + + return flag; +@@ -196,7 +220,8 @@ + + public boolean func_180237_b(BlockPos p_180237_1_) { + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); +- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(iblockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) { ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); ++ if (exp == -1) { + return false; + } else { + TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); +@@ -205,6 +230,11 @@ + this.field_73092_a.func_184138_a(p_180237_1_, iblockstate, iblockstate, 3); + return false; + } else { ++ ItemStack stack = field_73090_b.func_184614_ca(); ++ if (stack.onBlockStartBreak(p_180237_1_, field_73090_b)) { ++ return false; ++ } ++ + if (this.field_73091_c.func_82752_c()) { + if (this.field_73091_c == GameType.SPECTATOR) { + return false; +@@ -223,17 +253,28 @@ + } + } + +- boolean flag1 = this.func_180235_c(p_180237_1_); ++ boolean flag1 = false; + if (!this.func_73083_d()) { + ItemStack itemstack2 = this.field_73090_b.func_184614_ca(); +- boolean flag = this.field_73090_b.func_184823_b(iblockstate); ++ ItemStack copy = itemstack2.func_77946_l(); ++ boolean flag = iblockstate.canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); + itemstack2.func_179548_a(this.field_73092_a, iblockstate, p_180237_1_, this.field_73090_b); ++ if (itemstack2.func_190926_b() && !copy.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, EnumHand.MAIN_HAND); ++ } ++ flag1 = this.func_180235_c(p_180237_1_); + if (flag1 && flag) { + ItemStack itemstack1 = itemstack2.func_190926_b() ? ItemStack.field_190927_a : itemstack2.func_77946_l(); + iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack1); + } ++ } else { ++ flag1 = this.func_180235_c(p_180237_1_); + } + ++ if (!this.func_73083_d() && flag1 && exp > 0) { // Drop experience ++ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ } ++ + return flag1; + } + } +@@ -245,8 +286,11 @@ + } else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) { + return EnumActionResult.PASS; + } else { ++ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); ++ if (cancelResult != null) return cancelResult; + int i = p_187250_3_.func_190916_E(); + int j = p_187250_3_.func_77952_i(); ++ ItemStack copyBeforeUse = p_187250_3_.func_77946_l(); + ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); + ItemStack itemstack = actionresult.func_188398_b(); + if (itemstack == p_187250_3_ && itemstack.func_190916_E() == i && itemstack.func_77988_m() <= 0 && itemstack.func_77952_i() == j) { +@@ -263,6 +307,7 @@ + } + + if (itemstack.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, copyBeforeUse, p_187250_4_); + p_187250_1_.func_184611_a(p_187250_4_, ItemStack.field_190927_a); + } + +@@ -297,19 +342,50 @@ + + return EnumActionResult.PASS; + } else { +- boolean flag = !p_187251_1_.func_184614_ca().func_190926_b() || !p_187251_1_.func_184592_cb().func_190926_b(); ++ double reachDist = p_187251_1_.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks ++ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187251_1_, reachDist + 1)); ++ if (event.isCanceled()) return event.getCancellationResult(); ++ ++ EnumActionResult result = EnumActionResult.PASS; ++ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ result = p_187251_3_.onItemUseFirst(new ItemUseContext(p_187251_1_, p_187251_3_, p_187251_5_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)); ++ if (result != EnumActionResult.PASS) { ++ return result; ++ } ++ } ++ ++ boolean flag = !(p_187251_1_.func_184614_ca().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_) && p_187251_1_.func_184592_cb().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_)); + boolean flag1 = p_187251_1_.func_70093_af() && flag; +- if (!flag1 && iblockstate.func_196943_a(p_187251_2_, p_187251_5_, p_187251_1_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) { +- return EnumActionResult.SUCCESS; +- } else if (!p_187251_3_.func_190926_b() && !p_187251_1_.func_184811_cZ().func_185141_a(p_187251_3_.func_77973_b())) { ++ ++ if ((!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) && ++ event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && ++ iblockstate.func_196943_a(p_187251_2_, p_187251_5_, p_187251_1_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) { ++ result = EnumActionResult.SUCCESS; ++ } ++ ++ if (!p_187251_3_.func_190926_b() && !p_187251_1_.func_184811_cZ().func_185141_a(p_187251_3_.func_77973_b())) { + ItemUseContext itemusecontext = new ItemUseContext(p_187251_1_, p_187251_1_.func_184586_b(p_187251_4_), p_187251_5_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); + if (this.func_73083_d()) { + int i = p_187251_3_.func_190916_E(); ++ if ((result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || ++ (result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { + EnumActionResult enumactionresult = p_187251_3_.func_196084_a(itemusecontext); + p_187251_3_.func_190920_e(i); + return enumactionresult; ++ } else { ++ return result; ++ } + } else { +- return p_187251_3_.func_196084_a(itemusecontext); ++ if ((result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || ++ (result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { ++ ItemStack copyBeforeUse = p_187251_3_.func_77946_l(); ++ result = p_187251_3_.func_196084_a(itemusecontext); ++ if (p_187251_3_.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187251_1_, copyBeforeUse, p_187251_4_); ++ } ++ } ++ return result; + } + } else { + return EnumActionResult.PASS; diff --git a/patches_old/minecraft/net/minecraft/inventory/Container.java.patch b/patches_old/minecraft/net/minecraft/inventory/Container.java.patch deleted file mode 100644 index db903339d..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/Container.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Container.java -+++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -81,9 +81,11 @@ - - if (!ItemStack.func_77989_b(itemstack1, itemstack)) - { -+ boolean clientStackChanged = !ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack); - itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); - this.field_75153_a.set(i, itemstack1); - -+ if (clientStackChanged) - for (int j = 0; j < this.field_75149_d.size(); ++j) - { - ((IContainerListener)this.field_75149_d.get(j)).func_71111_a(this, i, itemstack1); -@@ -589,18 +591,19 @@ - if (!itemstack.func_190926_b() && itemstack.func_77973_b() == p_75135_1_.func_77973_b() && (!p_75135_1_.func_77981_g() || p_75135_1_.func_77960_j() == itemstack.func_77960_j()) && ItemStack.func_77970_a(p_75135_1_, itemstack)) - { - int j = itemstack.func_190916_E() + p_75135_1_.func_190916_E(); -+ int maxSize = Math.min(slot.func_75219_a(), p_75135_1_.func_77976_d()); - -- if (j <= p_75135_1_.func_77976_d()) -+ if (j <= maxSize) - { - p_75135_1_.func_190920_e(0); - itemstack.func_190920_e(j); - slot.func_75218_e(); - flag = true; - } -- else if (itemstack.func_190916_E() < p_75135_1_.func_77976_d()) -+ else if (itemstack.func_190916_E() < maxSize) - { -- p_75135_1_.func_190918_g(p_75135_1_.func_77976_d() - itemstack.func_190916_E()); -- itemstack.func_190920_e(p_75135_1_.func_77976_d()); -+ p_75135_1_.func_190918_g(maxSize - itemstack.func_190916_E()); -+ itemstack.func_190920_e(maxSize); - slot.func_75218_e(); - flag = true; - } -@@ -738,7 +741,7 @@ - p_94525_2_.func_190920_e(1); - break; - case 2: -- p_94525_2_.func_190920_e(p_94525_2_.func_77973_b().func_77639_j()); -+ p_94525_2_.func_190920_e(p_94525_2_.func_77976_d()); - } - - p_94525_2_.func_190917_f(p_94525_3_); diff --git a/patches_old/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches_old/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch deleted file mode 100644 index 4ff44b321..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -90,12 +90,9 @@ - - slot.func_75220_a(itemstack1, itemstack); - } -- else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.func_190916_E() == 1) -+ else if (this.func_75135_a(itemstack1, 0, 1, false)) //Forge Fix Shift Clicking in beacons with stacks larger then 1. - { -- if (!this.func_75135_a(itemstack1, 0, 1, false)) -- { -- return ItemStack.field_190927_a; -- } -+ return ItemStack.field_190927_a; - } - else if (p_82846_2_ >= 1 && p_82846_2_ < 28) - { -@@ -145,8 +142,7 @@ - - public boolean func_75214_a(ItemStack p_75214_1_) - { -- Item item = p_75214_1_.func_77973_b(); -- return item == Items.field_151166_bC || item == Items.field_151045_i || item == Items.field_151043_k || item == Items.field_151042_j; -+ return p_75214_1_.func_77973_b().isBeaconPayment(p_75214_1_); - } - - public int func_75219_a() diff --git a/patches_old/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches_old/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index f5b404c23..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -197,7 +197,7 @@ - - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return PotionHelper.func_185205_a(p_75214_1_); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); - } - - public int func_75219_a() -@@ -229,6 +229,7 @@ - - if (p_190901_1_ instanceof EntityPlayerMP) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(p_190901_1_, p_190901_2_); - CriteriaTriggers.field_192130_j.func_192173_a((EntityPlayerMP)p_190901_1_, potiontype); - } - -@@ -238,8 +239,7 @@ - - public static boolean func_75243_a_(ItemStack p_75243_0_) - { -- Item item = p_75243_0_.func_77973_b(); -- return item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); - } - } - } diff --git a/patches_old/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches_old/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch deleted file mode 100644 index c08121be8..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -73,9 +73,12 @@ - }); - this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) - { -+ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_.func_77973_b() == Items.field_151100_aR && EnumDyeColor.func_176766_a(p_75214_1_.func_77960_j()) == EnumDyeColor.BLUE; -+ for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, p_75214_1_, false)) return true; -+ return false; - } - }); - -@@ -160,6 +163,7 @@ - if (!this.field_75172_h.field_72995_K) - { - int l = 0; -+ float power = 0; - - for (int j = -1; j <= 1; ++j) - { -@@ -167,37 +171,14 @@ - { - if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) - { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -- -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j * 2)); - if (k != 0 && j != 0) - { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) -- { -- ++l; -- } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 1, j * 2)); - } - } - } -@@ -207,7 +188,7 @@ - - for (int i1 = 0; i1 < 3; ++i1) - { -- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, l, itemstack); -+ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); - this.field_185001_h[i1] = -1; - this.field_185002_i[i1] = -1; - -@@ -215,6 +196,7 @@ - { - this.field_75167_g[i1] = 0; - } -+ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(field_75172_h, field_178150_j, i1, (int)power, itemstack, field_75167_g[i1]); - } - - for (int j1 = 0; j1 < 3; ++j1) -@@ -400,10 +382,9 @@ - return ItemStack.field_190927_a; - } - -- if (itemstack1.func_77942_o() && itemstack1.func_190916_E() == 1) -+ if (itemstack1.func_77942_o())// Forge: Fix MC-17431 - { -- ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77946_l()); -- itemstack1.func_190920_e(0); -+ ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77979_a(1)); - } - else if (!itemstack1.func_190926_b()) - { diff --git a/patches_old/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches_old/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 6fea935b0..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -43,7 +43,7 @@ - } - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return entityequipmentslot == EntityLiving.func_184640_d(p_75214_1_); -+ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, entityequipmentslot, field_82862_h); - } - public boolean func_82869_a(EntityPlayer p_82869_1_) - { diff --git a/patches_old/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches_old/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index 65af6163c..000000000 --- a/patches_old/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -70,6 +70,8 @@ - p_190901_1_.func_82242_a(-ContainerRepair.this.field_82854_e); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_190901_1_, p_190901_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); -+ - ContainerRepair.this.field_82853_g.func_70299_a(0, ItemStack.field_190927_a); - - if (ContainerRepair.this.field_82856_l > 0) -@@ -94,7 +96,7 @@ - ContainerRepair.this.field_82854_e = 0; - IBlockState iblockstate = p_i45807_2_.func_180495_p(p_i45807_3_); - -- if (!p_190901_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_190901_1_.func_70681_au().nextFloat() < 0.12F) -+ if (!p_190901_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_190901_1_.func_70681_au().nextFloat() < breakChance) - { - int l = ((Integer)iblockstate.func_177229_b(BlockAnvil.field_176505_b)).intValue(); - ++l; -@@ -163,10 +165,12 @@ - Map map = EnchantmentHelper.func_82781_a(itemstack1); - j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A()); - this.field_82856_l = 0; -+ boolean flag = false; - - if (!itemstack2.func_190926_b()) - { -- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).func_82582_d(); -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, j)) return; -+ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).func_82582_d(); - - if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) - { -@@ -213,7 +217,7 @@ - l1 = 0; - } - -- if (l1 < itemstack1.func_77960_j()) -+ if (l1 < itemstack1.func_77952_i()) // vanilla uses metadata here instead of damage. - { - itemstack1.func_77964_b(l1); - i += 2; -@@ -317,6 +321,7 @@ - i += k; - itemstack1.func_151001_c(this.field_82857_m); - } -+ if (flag && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = ItemStack.field_190927_a; - - this.field_82854_e = j + i; - diff --git a/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch deleted file mode 100644 index 3da2d686a..000000000 --- a/patches_old/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -62,6 +62,7 @@ - private boolean field_71338_p; - private GameType field_71337_q; - private boolean field_71335_s; -+ public static boolean allowPlayerLogins = false; - - public DedicatedServer(File p_i47086_1_, DataFixer p_i47086_2_, YggdrasilAuthenticationService p_i47086_3_, MinecraftSessionService p_i47086_4_, GameProfileRepository p_i47086_5_, PlayerProfileCache p_i47086_6_) - { -@@ -95,6 +96,7 @@ - { - public void run() - { -+ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); - String s4; - -@@ -120,6 +122,8 @@ - field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); -+ - field_155771_h.info("Loading properties"); - this.field_71340_o = new PropertyManager(new File("server.properties")); - this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -212,6 +216,7 @@ - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.func_184105_a(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -@@ -260,11 +265,13 @@ - TileEntitySkull.func_184293_a(this.func_152358_ax()); - TileEntitySkull.func_184294_a(this.func_147130_as()); - PlayerProfileCache.func_187320_a(this.func_71266_T()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); - this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); - long i1 = System.nanoTime() - j; - String s3 = String.format("%.3fs", (double)i1 / 1.0E9D); - field_155771_h.info("Done ({})! For help, type \"help\" or \"?\"", (Object)s3); -+ this.field_175591_ab = func_130071_aq(); - - if (this.field_71340_o.func_187239_a("announce-player-achievements")) - { -@@ -296,7 +303,8 @@ - } - - Items.field_190931_a.func_150895_a(CreativeTabs.field_78027_g, NonNullList.func_191196_a()); -- return true; -+ // <3 you Grum for this, saves us ~30 patch files! --^ -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - } - } -@@ -515,7 +523,7 @@ - - public boolean func_175579_a(World p_175579_1_, BlockPos p_175579_2_, EntityPlayer p_175579_3_) - { -- if (p_175579_1_.field_73011_w.func_186058_p().func_186068_a() != 0) -+ if (p_175579_1_.field_73011_w.getDimension() != 0) - { - return false; - } -@@ -584,6 +592,9 @@ - return this.field_71340_o.func_73669_a("network-compression-threshold", super.func_175577_aI()); - } - -+ //Forge: Enable formated text for colors in console. -+ @Override public void func_145747_a(net.minecraft.util.text.ITextComponent message) { field_155771_h.info(message.func_150254_d()); } -+ - protected boolean func_152368_aE() throws IOException - { - boolean flag = false; diff --git a/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch deleted file mode 100644 index 8317ea164..000000000 --- a/patches_old/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java -@@ -44,7 +44,7 @@ - ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); - ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true); - StringBuilder stringbuilder = new StringBuilder(); -- Error error = new Error(); -+ Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error - - for (ThreadInfo threadinfo : athreadinfo) - { diff --git a/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch deleted file mode 100644 index 8b9416cb1..000000000 --- a/patches_old/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -77,6 +77,7 @@ - System.exit(0); - } - }); -+ minecraftservergui.latch.countDown(); - } - - public MinecraftServerGui(DedicatedServer p_i2362_1_) -@@ -161,8 +162,13 @@ - return jpanel; - } - -+ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); - public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) - { -+ try -+ { -+ latch.await(); -+ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. - if (!SwingUtilities.isEventDispatchThread()) - { - SwingUtilities.invokeLater(new Runnable() diff --git a/patches_old/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch b/patches_old/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch deleted file mode 100644 index 78684574e..000000000 --- a/patches_old/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch +++ /dev/null @@ -1,162 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java -@@ -32,12 +32,21 @@ - private int field_187288_h; - private long field_187289_i; - private boolean field_187290_j; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerChunkMapEntry.this.field_187286_f = PlayerChunkMapEntry.this.field_187282_b.func_72688_a().func_72863_F().func_186028_c(PlayerChunkMapEntry.this.field_187284_d.field_77276_a, PlayerChunkMapEntry.this.field_187284_d.field_77275_b); -+ PlayerChunkMapEntry.this.loading = false; -+ } -+ }; -+ private boolean loading = true; - - public PlayerChunkMapEntry(PlayerChunkMap p_i1518_1_, int p_i1518_2_, int p_i1518_3_) - { - this.field_187282_b = p_i1518_1_; - this.field_187284_d = new ChunkPos(p_i1518_2_, p_i1518_3_); -- this.field_187286_f = p_i1518_1_.func_72688_a().func_72863_F().func_186028_c(p_i1518_2_, p_i1518_3_); -+ p_i1518_1_.func_72688_a().func_72863_F().loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); - } - - public ChunkPos func_187264_a() -@@ -63,6 +72,8 @@ - if (this.field_187290_j) - { - this.func_187278_c(p_187276_1_); -+ // chunk watch event - the chunk is ready -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, p_187276_1_)); - } - } - } -@@ -71,6 +82,20 @@ - { - if (this.field_187283_c.contains(p_187277_1_)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (this.field_187286_f == null) -+ { -+ this.field_187283_c.remove(p_187277_1_); -+ -+ if (this.field_187283_c.isEmpty()) -+ { -+ if (this.loading) net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(this.field_187282_b.func_72688_a(), this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b, this.loadedRunnable); -+ this.field_187282_b.func_187305_b(this); -+ } -+ -+ return; -+ } -+ - if (this.field_187290_j) - { - p_187277_1_.field_71135_a.func_147359_a(new SPacketUnloadChunk(this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b)); -@@ -78,6 +103,8 @@ - - this.field_187283_c.remove(p_187277_1_); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(this.field_187286_f, p_187277_1_)); -+ - if (this.field_187283_c.isEmpty()) - { - this.field_187282_b.func_187305_b(this); -@@ -87,6 +114,7 @@ - - public boolean func_187268_a(boolean p_187268_1_) - { -+ if (this.loading) return false; - if (this.field_187286_f != null) - { - return true; -@@ -125,12 +153,15 @@ - this.field_187287_g = 0; - this.field_187288_h = 0; - this.field_187290_j = true; -+ if (this.field_187283_c.isEmpty()) return true; // Forge: fix MC-120780 - Packet packet = new SPacketChunkData(this.field_187286_f, 65535); - - for (EntityPlayerMP entityplayermp : this.field_187283_c) - { - entityplayermp.field_71135_a.func_147359_a(packet); - this.field_187282_b.func_72688_a().func_73039_n().func_85172_a(entityplayermp, this.field_187286_f); -+ // chunk watch event - delayed to here as the chunk wasn't ready in addPlayer -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, entityplayermp)); - } - - return true; -@@ -169,7 +200,7 @@ - - this.field_187288_h |= 1 << (p_187265_2_ >> 4); - -- if (this.field_187287_g < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(p_187265_1_ << 12 | p_187265_3_ << 8 | p_187265_2_); - -@@ -180,7 +211,8 @@ - return; - } - } -- -+ if (this.field_187287_g == this.field_187285_e.length) -+ this.field_187285_e = java.util.Arrays.copyOf(this.field_187285_e, this.field_187285_e.length << 1); - this.field_187285_e[this.field_187287_g++] = short1; - } - } -@@ -197,6 +229,7 @@ - } - } - -+ @SuppressWarnings("unused") - public void func_187280_d() - { - if (this.field_187290_j && this.field_187286_f != null) -@@ -210,28 +243,32 @@ - int k = (this.field_187285_e[0] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; - BlockPos blockpos = new BlockPos(i, j, k); - this.func_187267_a(new SPacketBlockChange(this.field_187282_b.func_72688_a(), blockpos)); -+ net.minecraft.block.state.IBlockState state = this.field_187282_b.func_72688_a().func_180495_p(blockpos); - -- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos).func_177230_c().func_149716_u()) -+ if (state.func_177230_c().hasTileEntity(state)) - { - this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos)); - } - } -- else if (this.field_187287_g == 64) -+ else if (this.field_187287_g >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - this.func_187267_a(new SPacketChunkData(this.field_187286_f, this.field_187288_h)); -+ //TODO: FDix Mojang's fuckup to modded by combining all TE data into the chunk data packet... seriously... packet size explosion! - } - else - { - this.func_187267_a(new SPacketMultiBlockChange(this.field_187287_g, this.field_187285_e, this.field_187286_f)); -- -+ //} Keep this in the else until we figure out a fix for mojang's derpitude on the data packet so we don't double send crap. -+ //{// Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small - for (int l = 0; l < this.field_187287_g; ++l) - { - int i1 = (this.field_187285_e[l] >> 12 & 15) + this.field_187284_d.field_77276_a * 16; - int j1 = this.field_187285_e[l] & 255; - int k1 = (this.field_187285_e[l] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; - BlockPos blockpos1 = new BlockPos(i1, j1, k1); -+ net.minecraft.block.state.IBlockState state = this.field_187282_b.func_72688_a().func_180495_p(blockpos1); - -- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos1).func_177230_c().func_149716_u()) -+ if (state.func_177230_c().hasTileEntity(state)) - { - this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos1)); - } -@@ -311,4 +348,9 @@ - - return d0; - } -+ -+ public List getWatchingPlayers() -+ { -+ return func_187274_e() ? java.util.Collections.unmodifiableList(field_187283_c) : java.util.Collections.emptyList(); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch deleted file mode 100644 index c14361b2c..000000000 --- a/patches_old/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ /dev/null @@ -1,286 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerInteractionManager.java -@@ -88,7 +88,7 @@ - int i = this.field_73100_i - this.field_73093_n; - IBlockState iblockstate = this.field_73092_a.func_180495_p(this.field_180241_i); - -- if (iblockstate.func_185904_a() == Material.field_151579_a) -+ if (iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, field_180241_i)) - { - this.field_73097_j = false; - } -@@ -114,7 +114,7 @@ - { - IBlockState iblockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); - -- if (iblockstate1.func_185904_a() == Material.field_151579_a) -+ if (iblockstate1.func_177230_c().isAir(iblockstate1, field_73092_a, field_180240_f)) - { - this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); - this.field_73094_o = -1; -@@ -123,7 +123,7 @@ - else - { - int k = this.field_73100_i - this.field_73089_e; -- float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); -+ float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position - int l = (int)(f1 * 10.0F); - - if (l != this.field_73094_o) -@@ -137,6 +137,16 @@ - - public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) - { -+ double reachDist = field_73090_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, reachDist + 1)); -+ if (event.isCanceled()) -+ { -+ // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); -+ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); -+ return; -+ } -+ - if (this.func_73083_d()) - { - if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) -@@ -172,17 +182,36 @@ - } - } - -- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); - this.field_73089_e = this.field_73100_i; - float f = 1.0F; - -- if (iblockstate.func_185904_a() != Material.field_151579_a) -+ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_)) - { -- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ if (event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); -+ } -+ else -+ { -+ // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); -+ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); -+ } - f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); - } -+ if (event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ if (f >= 1.0F) -+ { -+ // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); -+ field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); -+ } -+ return; -+ } - -- if (iblockstate.func_185904_a() != Material.field_151579_a && f >= 1.0F) -+ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180784_1_) && f >= 1.0F) - { - this.func_180237_b(p_180784_1_); - } -@@ -204,7 +233,7 @@ - int i = this.field_73100_i - this.field_73089_e; - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); - -- if (iblockstate.func_185904_a() != Material.field_151579_a) -+ if (!iblockstate.func_177230_c().isAir(iblockstate, field_73092_a, p_180785_1_)) - { - float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); - -@@ -233,13 +262,17 @@ - - private boolean func_180235_c(BlockPos p_180235_1_) - { -- IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); -- iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); -+ return removeBlock(p_180235_1_, false); -+ } - -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { -+ IBlockState iblockstate = this.field_73092_a.func_180495_p(pos); -+ boolean flag = iblockstate.func_177230_c().removedByPlayer(iblockstate, field_73092_a, pos, field_73090_b, canHarvest); -+ - if (flag) - { -- iblockstate.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, iblockstate); -+ iblockstate.func_177230_c().func_176206_d(this.field_73092_a, pos, iblockstate); - } - - return flag; -@@ -247,7 +280,8 @@ - - public boolean func_180237_b(BlockPos p_180237_1_) - { -- if (this.field_73091_c.func_77145_d() && !this.field_73090_b.func_184614_ca().func_190926_b() && this.field_73090_b.func_184614_ca().func_77973_b() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); -+ if (exp == -1) - { - return false; - } -@@ -264,53 +298,41 @@ - } - else - { -- if (this.field_73091_c.func_82752_c()) -- { -- if (this.field_73091_c == GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = field_73090_b.func_184614_ca(); -+ if (!stack.func_190926_b() && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; - -- if (!this.field_73090_b.func_175142_cm()) -- { -- ItemStack itemstack = this.field_73090_b.func_184614_ca(); -- -- if (itemstack.func_190926_b()) -- { -- return false; -- } -- -- if (!itemstack.func_179544_c(block)) -- { -- return false; -- } -- } -- } -- - this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); -- boolean flag1 = this.func_180235_c(p_180237_1_); -+ boolean flag1 = false; - - if (this.func_73083_d()) - { -+ flag1 = this.func_180235_c(p_180237_1_); - this.field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(this.field_73092_a, p_180237_1_)); - } - else - { - ItemStack itemstack1 = this.field_73090_b.func_184614_ca(); - ItemStack itemstack2 = itemstack1.func_190926_b() ? ItemStack.field_190927_a : itemstack1.func_77946_l(); -- boolean flag = this.field_73090_b.func_184823_b(iblockstate); -+ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); - - if (!itemstack1.func_190926_b()) - { - itemstack1.func_179548_a(this.field_73092_a, iblockstate, p_180237_1_, this.field_73090_b); -+ if (itemstack1.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack2, EnumHand.MAIN_HAND); - } - -+ flag1 = this.removeBlock(p_180237_1_, flag); - if (flag1 && flag) - { - iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack2); - } - } - -+ // Drop experience -+ if (!this.func_73083_d() && flag1 && exp > 0) -+ { -+ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); -+ } - return flag1; - } - } -@@ -328,8 +350,11 @@ - } - else - { -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); -+ if (cancelResult != null) return cancelResult; - int i = p_187250_3_.func_190916_E(); - int j = p_187250_3_.func_77960_j(); -+ ItemStack copyBeforeUse = p_187250_3_.func_77946_l(); - ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); - ItemStack itemstack = actionresult.func_188398_b(); - -@@ -357,6 +382,7 @@ - - if (itemstack.func_190926_b()) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187250_1_, copyBeforeUse, p_187250_4_); - p_187250_1_.func_184611_a(p_187250_4_, ItemStack.field_190927_a); - } - -@@ -402,13 +428,27 @@ - } - else - { -- if (!p_187251_1_.func_70093_af() || p_187251_1_.func_184614_ca().func_190926_b() && p_187251_1_.func_184592_cb().func_190926_b()) -+ double reachDist = p_187251_1_.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks -+ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187251_1_, reachDist + 1)); -+ if (event.isCanceled()) return event.getCancellationResult(); -+ -+ EnumActionResult result = EnumActionResult.PASS; -+ if (event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- IBlockState iblockstate = p_187251_2_.func_180495_p(p_187251_5_); -+ result = p_187251_3_.onItemUseFirst(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); -+ if (result != EnumActionResult.PASS) return result ; -+ } - -+ boolean bypass = p_187251_1_.func_184614_ca().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_) && p_187251_1_.func_184592_cb().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_); -+ -+ if (!p_187251_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ IBlockState iblockstate = p_187251_2_.func_180495_p(p_187251_5_); -+ if(event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - if (iblockstate.func_177230_c().func_180639_a(p_187251_2_, p_187251_5_, iblockstate, p_187251_1_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) - { -- return EnumActionResult.SUCCESS; -+ result = EnumActionResult.SUCCESS; - } - } - -@@ -436,14 +476,22 @@ - { - int j = p_187251_3_.func_77960_j(); - int i = p_187251_3_.func_190916_E(); -+ if (result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY -+ || result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) { - EnumActionResult enumactionresult = p_187251_3_.func_179546_a(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); - p_187251_3_.func_77964_b(j); - p_187251_3_.func_190920_e(i); - return enumactionresult; -+ } else return result; - } - else - { -- return p_187251_3_.func_179546_a(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); -+ if (result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY -+ || result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) { -+ ItemStack copyBeforeUse = p_187251_3_.func_77946_l(); -+ result = p_187251_3_.func_179546_a(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); -+ if (p_187251_3_.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187251_1_, copyBeforeUse, p_187251_4_); -+ } return result; - } - } - } -@@ -453,4 +501,16 @@ - { - this.field_73092_a = p_73080_1_; - } -+ -+ @Deprecated // use the attribute directly -+ public double getBlockReachDistance() -+ { -+ return field_73090_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ } -+ -+ @Deprecated // use an attribute modifier -+ public void setBlockReachDistance(double distance) -+ { -+ field_73090_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111128_a(distance); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches_old_unknown/SlotCrafting.java.patch similarity index 50% rename from patches_old/minecraft/net/minecraft/inventory/SlotCrafting.java.patch rename to patches_old_unknown/SlotCrafting.java.patch index 8d60d550e..73d292815 100644 --- a/patches_old/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches_old_unknown/SlotCrafting.java.patch @@ -8,13 +8,3 @@ } this.field_75237_g = 0; -@@ -67,7 +68,9 @@ - public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) - { - this.func_75208_c(p_190901_2_); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_190901_1_); - NonNullList nonnulllist = CraftingManager.func_180303_b(this.field_75239_a, p_190901_1_.field_70170_p); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - - for (int i = 0; i < nonnulllist.size(); ++i) - { diff --git a/patches_old/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches_old_unknown/SlotFurnaceOutput.java.patch similarity index 100% rename from patches_old/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch rename to patches_old_unknown/SlotFurnaceOutput.java.patch diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 3629b33b8..40c7a4c28 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -75,20 +75,19 @@ public class ForgeConfig .translation("forge.configgui.fixVanillaCascading") .define("fixVanillaCascading", false) - .comment("The time in ticks the server will wait when a dimension was queued to unload. This can be useful when rapidly loading and unloading dimensions, like e.g. throwing items through a nether portal a few time per second.") .translation("forge.configgui.dimensionUnloadQueueDelay") .defineInRange("dimensionUnloadQueueDelay", 0, 0, Integer.MAX_VALUE) + + .comment("Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024") + .translation("forge.configgui.clumpingThreshold") + .worldRestart() + .defineInRange("clumpingThreshold", 64, 64, 1024) .pop() //Client .comment("Client only settings, mostly things related to rendering") .push("client") - .comment("Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024") - .translation("forge.configgui.clumpingThreshold") - .worldRestart() - .defineInRange("clumpingThreshold", 64, 64, 1024) - .comment("Toggle off to make missing model text in the gui fit inside the slot.") .translation("forge.configgui.zoomInMissingModelTextInGui") .define("zoomInMissingModelTextInGui", false) @@ -149,8 +148,11 @@ public class ForgeConfig public static double zombieBaseSummonChance() { return ForgeConfig.INSTANCE.configData.getOrElse("general.zombieBaseSummonChance", (double)0.01F); } - public static float zombieBabyChance() { - return ForgeConfig.INSTANCE.configData.getOrElse("general.zombieBabyChance", 0.05F); + public static double zombieBabyChance() { + return ForgeConfig.INSTANCE.configData.getOrElse("general.zombieBabyChance", 0.05D); + } + public static int clumpingThreshold() { + return ForgeConfig.INSTANCE.configData.getOrElse("general.clumpingThreshold", 64); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 77bc4b8fe..c819fce55 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -31,6 +31,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntitySpawnPlacementRegistry.SpawnPlacementType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.fluid.IFluidState; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index f4a7210ff..c1b20e439 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -34,7 +34,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.HorseArmorType; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.IItemPropertyGetter; @@ -42,7 +41,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; @@ -50,7 +48,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.RegistrySimple; -import net.minecraft.world.GameType; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -329,16 +326,14 @@ public interface IForgeItem * Determines if the specific ItemStack can be placed in the specified armor * slot, for the entity. * - * TODO: Change name to canEquip in 1.13? - * * @param stack The ItemStack * @param armorType Armor slot to be verified. * @param entity The entity trying to equip the armor * @return True if the given ItemStack can be inserted in the slot */ - default boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) + default boolean canEquip(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) { - return net.minecraft.entity.EntityLiving.getSlotForItemStack(stack) == armorType; + return EntityLiving.getSlotForItemStack(stack) == armorType; } /** @@ -739,6 +734,7 @@ public interface IForgeItem * @return an enum constant of type {@code HorseArmorType}. Return * HorseArmorType.NONE if this is not horse armor */ + @SuppressWarnings("deprecation") default HorseArmorType getHorseArmorType(ItemStack stack) { return HorseArmorType.getByItem(stack.getItem()); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index 21e1588b1..44a062b81 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -26,16 +26,15 @@ import javax.annotation.Nullable; import net.minecraft.block.state.BlockWorldState; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.HorseArmorType; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; -import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; @@ -145,7 +144,7 @@ public interface IForgeItemStack extends ICapabilitySerializable */ default boolean onBlockStartBreak(BlockPos pos, EntityPlayer player) { - return getStack().isEmpty() || getStack().getItem().onBlockStartBreak(getStack(), pos, player); + return !getStack().isEmpty() && getStack().getItem().onBlockStartBreak(getStack(), pos, player); } /** @@ -300,4 +299,39 @@ public interface IForgeItemStack extends ICapabilitySerializable { getStack().getItem().onHorseArmorTick(getStack(), world, horse); } + + /** + * Whether this Item can be used as a payment to activate the vanilla beacon. + * + * @return true if this Item can be used + */ + default boolean isBeaconPayment() + { + return getStack().getItem().isBeaconPayment(getStack()); + } + + /** + * Determines if the specific ItemStack can be placed in the specified armor + * slot, for the entity. + * + * @param armorType Armor slot to be verified. + * @param entity The entity trying to equip the armor + * @return True if the given ItemStack can be inserted in the slot + */ + default boolean canEquip(EntityEquipmentSlot armorType, Entity entity) + { + return getStack().getItem().canEquip(getStack(), armorType, entity); + } + + /** + * Allow or forbid the specific book/item combination as an anvil enchant + * + * @param stack The item + * @param book The book + * @return if the enchantment is allowed + */ + default boolean isBookEnchantable(ItemStack book) + { + return getStack().getItem().isBookEnchantable(getStack(), book); + } } diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java index 6c35c00e3..3631f38a0 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerArmorInvWrapper.java @@ -49,7 +49,7 @@ public class PlayerArmorInvWrapper extends RangedWrapper } } // check if it's valid for the armor slot - if (equ != null && slot < 4 && !stack.isEmpty() && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player)) + if (equ != null && slot < 4 && !stack.isEmpty() && stack.canEquip(equ, getInventoryPlayer().player)) { return super.insertItem(slot, stack, simulate); } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 8848604db..4aace6deb 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -211,7 +211,7 @@ public net.minecraft.client.Minecraft func_71370_a(II)V # resize public net.minecraft.client.Minecraft func_180510_a(Lnet/minecraft/client/renderer/texture/TextureManager;)V # drawSplashScreen public net.minecraft.client.Minecraft func_184119_a(Lnet/minecraft/item/ItemStack;Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/item/ItemStack; # storeTEInStack # MinecraftServer -protected net.minecraft.server.MinecraftServer field_175591_ab # currentTime +protected net.minecraft.server.MinecraftServer field_211151_aa # serverTime ## DedicatedServer public net.minecraft.server.dedicated.DedicatedServer field_71341_l # pendingCommandList ## SaveFormatOld