ForgePatch/forge/patches/minecraft_server/net/minecraft/src/EntityPlayerMP.java.patch
2012-05-02 11:12:45 -07:00

69 lines
4 KiB
Diff

--- ../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
@@ -551,6 +551,7 @@
public void displayWorkbenchGUI(int par1, int par2, int par3)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 1, "Crafting", 9));
this.craftingInventory = new ContainerWorkbench(this.inventory, this.worldObj, par1, par2, par3);
this.craftingInventory.windowId = this.currentWindowId;
@@ -560,6 +561,7 @@
public void displayGUIEnchantment(int par1, int par2, int par3)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 4, "Enchanting", 9));
this.craftingInventory = new ContainerEnchantment(this.inventory, this.worldObj, par1, par2, par3);
this.craftingInventory.windowId = this.currentWindowId;
@@ -572,6 +574,7 @@
public void displayGUIChest(IInventory par1IInventory)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 0, par1IInventory.getInvName(), par1IInventory.getSizeInventory()));
this.craftingInventory = new ContainerChest(this.inventory, par1IInventory);
this.craftingInventory.windowId = this.currentWindowId;
@@ -584,6 +587,7 @@
public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 2, par1TileEntityFurnace.getInvName(), par1TileEntityFurnace.getSizeInventory()));
this.craftingInventory = new ContainerFurnace(this.inventory, par1TileEntityFurnace);
this.craftingInventory.windowId = this.currentWindowId;
@@ -596,6 +600,7 @@
public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 3, par1TileEntityDispenser.getInvName(), par1TileEntityDispenser.getSizeInventory()));
this.craftingInventory = new ContainerDispenser(this.inventory, par1TileEntityDispenser);
this.craftingInventory.windowId = this.currentWindowId;
@@ -608,6 +613,7 @@
public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand)
{
this.getNextWindowId();
+ closeCraftingGui(); //NOTE: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 5, par1TileEntityBrewingStand.getInvName(), par1TileEntityBrewingStand.getSizeInventory()));
this.craftingInventory = new ContainerBrewingStand(this.inventory, par1TileEntityBrewingStand);
this.craftingInventory.windowId = this.currentWindowId;
@@ -805,4 +811,18 @@
this.playerNetServerHandler.sendPacket(new Packet202PlayerAbilities(this.capabilities));
}
}
+
+ /* These functions are added to have compatibility with PlayerAPI.
+ * If Divisor does not implement these functions, it is his fault,
+ * these are specifically the functions he told me to use and would be guaranteed to be in PAPI.
+ */
+ public final void realGetNextWidowId()
+ {
+ getNextWindowId();
+ }
+
+ public final int getCurrentWindowIdField()
+ {
+ return currentWindowId;
+ }
}