mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Fix dupe bug caused by SPIGOT-6452
This commit is contained in:
42
patches/server/0222-Fix-dupe-bug-caused-by-SPIGOT-6452.patch
Normal file
42
patches/server/0222-Fix-dupe-bug-caused-by-SPIGOT-6452.patch
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Fri, 28 May 2021 06:48:48 -0500
|
||||||
|
Subject: [PATCH] Fix dupe bug caused by SPIGOT-6452
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/InventorySubcontainer.java b/src/main/java/net/minecraft/world/InventorySubcontainer.java
|
||||||
|
index 760e61167a053b9df73823600561ddb0cf3ff2c7..69d4f223bf142371c9a999bc54f6e22b7252aa00 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/InventorySubcontainer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/InventorySubcontainer.java
|
||||||
|
@@ -34,6 +34,16 @@ public class InventorySubcontainer implements IInventory, AutoRecipeOutput {
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Purpur start
|
||||||
|
+ public void setContents(List<ItemStack> items) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ for(int i = 0; i < items.size(); i++) {
|
||||||
|
+ this.items.set(i, items.get(i));
|
||||||
|
+ }
|
||||||
|
+ this.update();
|
||||||
|
+ }
|
||||||
|
+ // Purpur end
|
||||||
|
+
|
||||||
|
public void onOpen(CraftHumanEntity who) {
|
||||||
|
transaction.add(who);
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||||
|
index 4903d79ad1036df8f52aded6ddaca604d4a8434a..6e7b5b2ededdee6dce555d1e65f9b7418ff9fce0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||||
|
@@ -913,8 +913,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
+ List<ItemStack> contentsSnapshot = new java.util.ArrayList<>(inventorysubcontainer.getContents()); // Purpur
|
||||||
|
ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
|
||||||
|
if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack1.getCount(), false).isCancelled()) {
|
||||||
|
+ inventorysubcontainer.setContents(contentsSnapshot); // Purpur
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
Reference in New Issue
Block a user