mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Update Remove iterators from Inventory & Move TODOs to 1.21.6 tracking
This commit is contained in:
@@ -5,17 +5,16 @@ Subject: [PATCH] Remove iterators from Inventory
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
|
||||
index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0229ae188 100644
|
||||
index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a36d5f486e4b936e9107aa0dce263ad8afc30373 100644
|
||||
--- a/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -439,13 +439,16 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -439,13 +439,15 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
}
|
||||
|
||||
- for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOT_MAPPING.values()) {
|
||||
+ // Leaf start - Remove iterators from Inventory
|
||||
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
|
||||
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
if (itemStack == stack) {
|
||||
this.equipment.set(equipmentSlot, ItemStack.EMPTY);
|
||||
@@ -26,7 +25,7 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -504,17 +507,21 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -504,17 +506,20 @@ public class Inventory implements Container, Nameable {
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
@@ -40,8 +39,7 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
}
|
||||
|
||||
- for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOT_MAPPING.values()) {
|
||||
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
|
||||
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
if (!this.equipment.get(equipmentSlot).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -50,7 +48,7 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -561,31 +568,61 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -561,31 +566,58 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
@@ -62,8 +60,7 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
|
||||
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
+ if (!itemStack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack)) {
|
||||
+ return true;
|
||||
@@ -79,17 +76,16 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
+ // Leaf start - Remove iterators from Inventory
|
||||
+ for (int i = 0; i < this.items.size(); i++) {
|
||||
+ ItemStack itemStack = this.items.get(i);
|
||||
if (!itemStack.isEmpty() && itemStack.is(tag)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
|
||||
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
|
||||
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
+ if (!itemStack.isEmpty() && itemStack.is(tag)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
if (!itemStack.isEmpty() && itemStack.is(tag)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ // Leaf end - Remove iterators from Inventory
|
||||
|
||||
return false;
|
||||
@@ -100,22 +96,21 @@ index d9cb4f0ed0c4f63362c837aeef3c4194911455c9..a31b6b8b56ecced421ead0119a4423b0
|
||||
+ // Leaf start - Remove iterators from Inventory
|
||||
+ for (int i = 0; i < this.items.size(); i++) {
|
||||
+ ItemStack itemStack = this.items.get(i);
|
||||
+ if (predicate.test(itemStack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
|
||||
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
|
||||
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
if (predicate.test(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
|
||||
+ if (predicate.test(itemStack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaf end - Remove iterators from Inventory
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -605,9 +642,12 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -605,9 +637,12 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public void fillStackedContents(StackedItemContents contents) {
|
||||
|
||||
12
todos.md
12
todos.md
@@ -1,12 +0,0 @@
|
||||
# Gale TODOs
|
||||
- [ ] Do a benchmark for `Remove streams and iterators from range check`, getEffectiveRange in ChunkMap
|
||||
|
||||
# Leaf TODOs
|
||||
- [ ] Transfer patch notes to file for Gale and Leaf
|
||||
- [ ] check Dont send useless entity packets
|
||||
- [ ] Use different state to separate different configs reload
|
||||
|
||||
# 1.21.5
|
||||
- [ ] Remove stream in Inventory and check new changes
|
||||
- [ ] Check SparklyPaper's mapitem update skip
|
||||
- [ ] Update from Leaf 1.21.4 (curr commit: `03de21f0f4c0aa696d052113990ca9ee6884be0e`)
|
||||
Reference in New Issue
Block a user