mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 08:29:28 +00:00
[ci skip] cleanup
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Taiyou06 <kaandindar21@gmail.com>
|
||||
Date: Thu, 13 Feb 2025 01:25:40 +0100
|
||||
Subject: [PATCH] Remove iterators from Inventory#contains
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
|
||||
index 839cbb67d3d38960d9114a4db5bab911b66a573c..e2237ffebadc8f010688c6e7336f4278193a1a20 100644
|
||||
--- a/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -568,9 +568,13 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
- for (List<ItemStack> list : this.compartments) {
|
||||
- for (ItemStack itemStack : list) {
|
||||
- if (!itemStack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack)) {
|
||||
+ // Leaf start - Remove iterators from Inventory#contains
|
||||
+ 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.isSameItemSameComponents(itemstack1, stack)) {
|
||||
+ // Leaf end - Remove iterators from Inventory#contains
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -580,9 +584,13 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(TagKey<Item> tag) {
|
||||
- for (List<ItemStack> list : this.compartments) {
|
||||
- for (ItemStack itemStack : list) {
|
||||
- if (!itemStack.isEmpty() && itemStack.is(tag)) {
|
||||
+ // Leaf start - Remove iterators from Inventory#contains
|
||||
+ 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 itemstack = list.get(j);
|
||||
+ if (!itemstack.isEmpty() && itemstack.is(tag)) {
|
||||
+ // Leaf end - Remove iterators from Inventory#contains
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -592,9 +600,13 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(Predicate<ItemStack> predicate) {
|
||||
- for (List<ItemStack> list : this.compartments) {
|
||||
- for (ItemStack itemStack : list) {
|
||||
- if (predicate.test(itemStack)) {
|
||||
+ // Leaf start - Remove iterators from Inventory#contains
|
||||
+ 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 itemstack = list.get(j);
|
||||
+ if (predicate.test(itemstack)) {
|
||||
+ // Leaf end - Remove iterators from Inventory#contains
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user