Further refine logic

This commit is contained in:
Aikar 2017-07-28 00:04:01 -04:00
parent 8ff15ca2af
commit b4131ee68f

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix Recipe Books
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 682211cdd..0f7e82d27 100644 index 682211cdd..5b9021939 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -52,19 +52,29 @@ index 682211cdd..0f7e82d27 100644
packetplayinautorecipe_a = (PacketPlayInAutoRecipe.a) iterator.next(); packetplayinautorecipe_a = (PacketPlayInAutoRecipe.a) iterator.next();
itemstack = this.player.inventory.getItem(packetplayinautorecipe_a.c); itemstack = this.player.inventory.getItem(packetplayinautorecipe_a.c);
- if (this.a(packetplayinautorecipe_a.a, itemstack)) { - if (this.a(packetplayinautorecipe_a.a, itemstack)) {
+ if (this.a(packetplayinautorecipe_a.a, itemstack) && itemstack.getCount() >= packetplayinautorecipe_a.a.getCount()) { // Paper + // Paper start
+ ItemStack ref = packetplayinautorecipe_a.a;
+ ItemStack to = this.player.activeContainer.getSlot(packetplayinautorecipe_a.b).getItem();
+ if (this.a(ref, itemstack) && (ref.getCount() + to.getCount() <= ref.getMaxStackSize())) {
+ // Paper end
i = packetplayinautorecipe_a.a.getCount(); i = packetplayinautorecipe_a.a.getCount();
if (itemstack.getCount() == i) { if (itemstack.getCount() == i) {
this.player.inventory.splitWithoutUpdate(packetplayinautorecipe_a.c); this.player.inventory.splitWithoutUpdate(packetplayinautorecipe_a.c);
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
itemstack.subtract(i);
}
this.player.activeContainer.b(packetplayinautorecipe_a.b, packetplayinautorecipe_a.a); - this.player.activeContainer.b(packetplayinautorecipe_a.b, packetplayinautorecipe_a.a);
} + // Paper start
+ // Paper start + if (to.isEmpty()) {
+ else { + this.player.activeContainer.b(packetplayinautorecipe_a.b, packetplayinautorecipe_a.a);
+ } else {
+ to.add(i);
+ }
+ } else {
+ this.player.getBukkitEntity().updateInventory(); + this.player.getBukkitEntity().updateInventory();
+ return; + return;
+ } }
+ // Paper end + // Paper end
} }
} }