mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-22 08:29:24 +00:00
Add Airplane patches
I've only added the ones that compile correctly, because some of them doesn't seem to compile with Paper/Tuinity's latest changes
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 c7e16e96633e17b951f0681599c5b3efc3ce1e6c..8d329bca0818033df41fbd781028919c73e052a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -688,6 +688,8 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
+ // Airplane start - don't allocate iterators
|
||||
+ /*
|
||||
Iterator iterator = this.compartments.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -702,6 +704,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() && itemstack1.sameItem(stack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Airplane end
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user