3
0

Implement Bukkit's inventory for modded inventories, fix #257

This commit is contained in:
Sergey Shatunov
2016-02-01 04:54:40 +07:00
parent e3bc245aa4
commit 6c2be10dc9
4 changed files with 165 additions and 27 deletions

View File

@ -1818,7 +1818,7 @@
finally
{
@@ -1135,19 +2442,18 @@
{
if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book)
{
- itemstack1.setTagInfo("author", new NBTTagString(this.playerEntity.getCommandSenderName()));

View File

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/network/rcon/RConThreadClient.java
+++ ../src-work/minecraft/net/minecraft/network/rcon/RConThreadClient.java
@@ -41,20 +41,21 @@
@@ -41,9 +41,9 @@
public void run()
{
@ -10,24 +10,22 @@
- try
+ while (true)
{
- if (!this.running)
+ if (!this.running || clientSocket == null)
if (!this.running)
{
break;
}
@@ -53,6 +53,12 @@
BufferedInputStream bufferedinputstream = new BufferedInputStream(this.clientSocket.getInputStream());
int i = bufferedinputstream.read(this.buffer, 0, 1460);
-
- if (10 > i)
+
+ if (i < 10)
{
+ this.running = false; // Cauldron
return;
}
@@ -110,26 +111,23 @@
+ if (i < 10)
+ {
+ this.running = false; // Cauldron
+ return;
+ }
+
if (10 <= i)
{
byte b0 = 0;
@@ -110,26 +116,23 @@
}
}
}
@ -57,7 +55,7 @@
}
private void sendResponse(int p_72654_1_, int p_72654_2_, String p_72654_3_) throws IOException
@@ -167,6 +165,7 @@
@@ -167,6 +170,7 @@
private void closeSocket()
{

View File

@ -149,14 +149,14 @@
return false;
}
}
@@ -427,11 +526,70 @@
@@ -427,11 +526,66 @@
if (itemstack != null && func_145890_b(p_145892_1_, itemstack, p_145892_2_, p_145892_3_))
{
ItemStack itemstack1 = itemstack.copy();
- ItemStack itemstack2 = func_145889_a(p_145892_0_, p_145892_1_.decrStackSize(p_145892_2_, 1), -1);
+ // CraftBukkit start - Call event on collection of items from inventories into the hopper
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(p_145892_1_.decrStackSize(p_145892_2_, 1));
+ Inventory sourceInventory;
+ Inventory sourceInventory = null;
+ // Have to special case large chests as they work oddly
+ if (p_145892_1_ instanceof InventoryLargeChest)
@ -172,15 +172,11 @@
+ {
+ sourceInventory = p_145892_1_.getOwner().getInventory();
+ }
+ else
+ {
+ // TODO: create a mod inventory for passing to the event, instead of null
+ sourceInventory = null;
+ }
+ }
+ catch (AbstractMethodError e)
+ {
+ sourceInventory = null;
+ {} finally {
+ if (sourceInventory == null)
+ sourceInventory = new kcauldron.CraftInventoryWrapper(p_145892_1_);
+ }
+ // Cauldron end
+ }
@ -222,7 +218,7 @@
return true;
}
@@ -451,6 +609,20 @@
@@ -451,6 +605,20 @@
}
else
{