diff --git a/forge/patches/minecraft/net/minecraft/src/Item.java.patch b/forge/patches/minecraft/net/minecraft/src/Item.java.patch index 55c85b9e8..0e38fc5fa 100644 --- a/forge/patches/minecraft/net/minecraft/src/Item.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Item.java.patch @@ -18,6 +18,15 @@ protected Item(int i) { maxStackSize = 64; +@@ -449,7 +453,7 @@ + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; +- double d3 = 5D; ++ double d3 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance(); + Vec3D vec3d1 = vec3d.addVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, flag, !flag); + return movingobjectposition; @@ -469,6 +473,109 @@ { return getIconFromDamage(i); diff --git a/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch index bb5e0577b..86b5be7d6 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch @@ -19,7 +19,15 @@ if (itemInUseCount <= 25 && itemInUseCount % 4 == 0) { func_35208_b(itemstack, 5); -@@ -433,7 +438,16 @@ +@@ -274,6 +279,7 @@ + + protected void usePersonalCraftingInventory() + { ++ currentCraftingInventory.onCraftGuiClosed(this); + currentCraftingInventory = personalCraftingInventory; + } + +@@ -433,7 +439,16 @@ public void dropCurrentItem() { @@ -37,7 +45,7 @@ } public void dropPlayerItem(ItemStack itemstack) -@@ -480,6 +494,8 @@ +@@ -480,6 +495,8 @@ worldObj.spawnEntityInWorld(entityitem); } @@ -46,7 +54,7 @@ public float getCurrentPlayerStrVsBlock(Block block) { float f = inventory.getStrVsBlock(block); -@@ -508,6 +524,45 @@ +@@ -508,6 +525,45 @@ return f1; } @@ -92,7 +100,7 @@ public boolean canHarvestBlock(Block block) { return inventory.canHarvestBlock(block); -@@ -707,6 +762,26 @@ +@@ -707,6 +763,26 @@ protected void damageEntity(DamageSource damagesource, int i) { @@ -119,7 +127,7 @@ if (!damagesource.isUnblockable() && isBlocking()) { i = 1 + i >> 1; -@@ -758,7 +833,9 @@ +@@ -758,7 +834,9 @@ public void destroyCurrentEquippedItem() { @@ -129,7 +137,7 @@ } public double getYOffset() -@@ -884,6 +961,11 @@ +@@ -884,6 +962,11 @@ public EnumStatus sleepInBedAt(int i, int j, int k) { diff --git a/forge/patches/minecraft_server/net/minecraft/src/EntityPlayerMP.java.patch b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayerMP.java.patch new file mode 100644 index 000000000..6fd927383 --- /dev/null +++ b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayerMP.java.patch @@ -0,0 +1,50 @@ +--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayerMP.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayerMP.java 0000-00-00 00:00:00.000000000 -0000 +@@ -405,6 +405,7 @@ + public void displayWorkbenchGUI(int i, int j, int k) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 1, "Crafting", 9)); + currentCraftingInventory = new ContainerWorkbench(inventory, worldObj, i, j, k); + currentCraftingInventory.windowId = currentWindowId; +@@ -414,6 +415,7 @@ + public void displayGUIEnchantment(int i, int j, int k) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 4, "Enchanting", 9)); + currentCraftingInventory = new ContainerEnchantment(inventory, worldObj, i, j, k); + currentCraftingInventory.windowId = currentWindowId; +@@ -423,6 +425,7 @@ + public void displayGUIChest(IInventory iinventory) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 0, iinventory.getInvName(), iinventory.getSizeInventory())); + currentCraftingInventory = new ContainerChest(inventory, iinventory); + currentCraftingInventory.windowId = currentWindowId; +@@ -432,6 +435,7 @@ + public void displayGUIFurnace(TileEntityFurnace tileentityfurnace) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 2, tileentityfurnace.getInvName(), tileentityfurnace.getSizeInventory())); + currentCraftingInventory = new ContainerFurnace(inventory, tileentityfurnace); + currentCraftingInventory.windowId = currentWindowId; +@@ -441,6 +445,7 @@ + public void displayGUIDispenser(TileEntityDispenser tileentitydispenser) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 3, tileentitydispenser.getInvName(), tileentitydispenser.getSizeInventory())); + currentCraftingInventory = new ContainerDispenser(inventory, tileentitydispenser); + currentCraftingInventory.windowId = currentWindowId; +@@ -450,6 +455,7 @@ + public void displayGUIBrewingStand(TileEntityBrewingStand tileentitybrewingstand) + { + getNextWidowId(); ++ closeCraftingGui(); + playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 5, tileentitybrewingstand.getInvName(), tileentitybrewingstand.getSizeInventory())); + currentCraftingInventory = new ContainerBrewingStand(inventory, tileentitybrewingstand); + currentCraftingInventory.windowId = currentWindowId; diff --git a/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch b/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch index 961616c15..bd2645667 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch @@ -18,7 +18,15 @@ protected Item(int i) { maxStackSize = 64; -@@ -393,6 +397,109 @@ +@@ -389,10 +393,117 @@ + float f8 = f6; + float f9 = f3 * f5; + double d3 = 5D; ++ if (entityplayer instanceof EntityPlayerMP) ++ { ++ d3 = ((EntityPlayerMP)entityplayer).itemInWorldManager.getBlockReachDistance(); ++ } + Vec3D vec3d1 = vec3d.addVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3); MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, flag, !flag); return movingobjectposition; } diff --git a/forge/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch b/forge/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch index 10d4db877..ea329762f 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/ItemInWorldManager.java.patch @@ -1,14 +1,17 @@ --- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000 -@@ -1,5 +1,7 @@ +@@ -1,7 +1,10 @@ package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooks; + public class ItemInWorldManager { ++ private double blockReachDistance; public World thisWorld; -@@ -71,7 +73,7 @@ + public EntityPlayer thisPlayer; + private int gameType; +@@ -71,7 +74,7 @@ if (j != 0) { Block block = Block.blocksList[j]; @@ -17,7 +20,7 @@ if (f >= 1.0F) { field_22050_k = false; -@@ -99,7 +101,7 @@ +@@ -99,7 +102,7 @@ { Block.blocksList[i1].onBlockClicked(thisWorld, i, j, k, thisPlayer); } @@ -26,7 +29,7 @@ { blockHarvessted(i, j, k); } -@@ -120,7 +122,7 @@ +@@ -120,7 +123,7 @@ if (i1 != 0) { Block block = Block.blocksList[i1]; @@ -35,7 +38,7 @@ if (f >= 0.7F) { blockHarvessted(i, j, k); -@@ -142,8 +144,13 @@ +@@ -142,8 +145,13 @@ { Block block = Block.blocksList[thisWorld.getBlockId(i, j, k)]; int l = thisWorld.getBlockMetadata(i, j, k); @@ -51,7 +54,7 @@ { block.onBlockDestroyedByPlayer(thisWorld, i, j, k, l); } -@@ -152,6 +159,11 @@ +@@ -152,6 +160,11 @@ public boolean blockHarvessted(int i, int j, int k) { @@ -63,7 +66,7 @@ int l = thisWorld.getBlockId(i, j, k); int i1 = thisWorld.getBlockMetadata(i, j, k); thisWorld.playAuxSFXAtEntity(thisPlayer, 2001, i, j, k, l + thisWorld.getBlockMetadata(i, j, k) * 256); -@@ -162,8 +174,7 @@ +@@ -162,8 +175,7 @@ } else { @@ -73,7 +76,7 @@ if (itemstack != null) { itemstack.onDestroyBlock(l, i, j, k, thisPlayer); -@@ -197,6 +208,7 @@ +@@ -197,6 +209,7 @@ if (itemstack1.stackSize == 0) { entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null; @@ -81,7 +84,7 @@ } return true; } -@@ -208,6 +220,14 @@ +@@ -208,6 +221,14 @@ public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) { @@ -96,7 +99,7 @@ int i1 = world.getBlockId(i, j, k); if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) { -@@ -228,7 +248,15 @@ +@@ -228,7 +249,15 @@ } else { @@ -113,3 +116,17 @@ } } +@@ -236,4 +265,13 @@ + { + thisWorld = worldserver; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/forge/patches/minecraft_server/net/minecraft/src/ModLoader.java.patch b/forge/patches/minecraft_server/net/minecraft/src/ModLoader.java.patch new file mode 100644 index 000000000..924e0e91c --- /dev/null +++ b/forge/patches/minecraft_server/net/minecraft/src/ModLoader.java.patch @@ -0,0 +1,10 @@ +--- ../src_base/minecraft_server/net/minecraft/src/ModLoader.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/ModLoader.java 0000-00-00 00:00:00.000000000 -0000 +@@ -1317,6 +1317,7 @@ + { + method_getNextWindowId.invoke(entityplayermp, new Object[0]); + int j = field_currentWindowId.getInt(entityplayermp); ++ entityplayermp.closeCraftingGui(); + entityplayermp.playerNetServerHandler.sendPacket(new Packet100OpenWindow(j, i, iinventory.getInvName(), iinventory.getSizeInventory())); + entityplayermp.currentCraftingInventory = container; + entityplayermp.currentCraftingInventory.windowId = j; diff --git a/forge/patches/minecraft_server/net/minecraft/src/NetServerHandler.java.patch b/forge/patches/minecraft_server/net/minecraft/src/NetServerHandler.java.patch new file mode 100644 index 000000000..1fb62cff2 --- /dev/null +++ b/forge/patches/minecraft_server/net/minecraft/src/NetServerHandler.java.patch @@ -0,0 +1,24 @@ +--- ../src_base/minecraft_server/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src_work/minecraft_server/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000 +@@ -295,7 +295,9 @@ + double d1 = (playerEntity.posY - ((double)j + 0.5D)) + 1.5D; + double d3 = playerEntity.posZ - ((double)k + 0.5D); + double d5 = d * d + d1 * d1 + d3 * d3; +- if (d5 > 36D) ++ double dist = playerEntity.itemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ if (d5 > dist) + { + return; + } +@@ -366,7 +368,9 @@ + { + j1 = i1; + } +- if (hasMoved && playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64D && (j1 > 16 || flag)) ++ double dist = playerEntity.itemInWorldManager.getBlockReachDistance() + 3; ++ dist *= dist; ++ if (hasMoved && playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && (j1 > 16 || flag)) + { + playerEntity.itemInWorldManager.activeBlockOrUseItem(playerEntity, worldserver, itemstack, i, j, k, l); + }