mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-21 16:09:30 +00:00
Update upstream, add new cherry-picked patches from other forks
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Sat, 13 Mar 2021 12:24:41 -0600
|
||||
Subject: [PATCH] Remove iterators from inventory contains
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index 96d664c28738d6090f7067761c2978dd1aa0fd0e..b1c24a02b87aca7b180a6efbce177f2300db49c1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -687,6 +687,8 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
+ // Pufferfish start - don't allocate iterators
|
||||
+ /*
|
||||
Iterator iterator = this.compartments.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -701,6 +703,18 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ */
|
||||
+ for (int i = 0; i < this.compartments.size(); i++) {
|
||||
+ List<ItemStack> list = this.compartments.get(i);
|
||||
+ for (int j = 0; j < list.size(); j++) {
|
||||
+ ItemStack itemstack1 = list.get(j);
|
||||
+
|
||||
+ if (!itemstack1.isEmpty() && ItemStack.isSameItemSameTags(itemstack1, stack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user