@@ -5,7 +5,7 @@ Subject: [PATCH] Replace entity equipment items to array
55
66
77diff --git a/net/minecraft/world/entity/EntityEquipment.java b/net/minecraft/world/entity/EntityEquipment.java
8- index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b1500945c 100644
8+ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..c26f7fb2fb47ea1656cc2daf239ced943570c6c2 100644
99--- a/net/minecraft/world/entity/EntityEquipment.java
1010+++ b/net/minecraft/world/entity/EntityEquipment.java
1111@@ -13,11 +13,19 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
@@ -31,13 +31,14 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
3131 // Leaf start - Lithium - equipment tracking
3232 boolean shouldTickEnchantments = false;
3333 ItemStack recheckEnchantmentForStack = null;
34- @@ -26,7 +34,15 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
34+ @@ -26,7 +34,16 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
3535 // Leaf end - Lithium - equipment tracking
3636
3737 private EntityEquipment(EnumMap<EquipmentSlot, ItemStack> items) {
3838- this.items = items;
3939+ // Leaf start - Replace entity equipment items to array
4040+ ItemStack[] self = new ItemStack[EquipmentSlot.VALUES_ARRAY.length];
41+ + java.util.Arrays.fill(self, ItemStack.EMPTY);
4142+ if (!items.isEmpty()) {
4243+ for (Entry<EquipmentSlot, ItemStack> e : items.entrySet()) {
4344+ self[e.getKey().ordinal()] = e.getValue();
@@ -48,7 +49,7 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
4849 }
4950
5051 public EntityEquipment() {
51- @@ -35,21 +51 ,25 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
52+ @@ -35,21 +52 ,25 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
5253
5354 public ItemStack set(EquipmentSlot slot, ItemStack stack) {
5455 // Leaf start - Lithium - equipment tracking
@@ -79,7 +80,7 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
7980 return false;
8081 }
8182 }
82- @@ -59,23 +79 ,25 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
83+ @@ -59,23 +80 ,25 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
8384 }
8485
8586 public void tick(Entity entity) {
@@ -111,7 +112,7 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
111112 entity.drop(itemStack, true, false);
112113 }
113114
114- @@ -83,14 +105 ,14 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
115+ @@ -83,14 +106 ,14 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
115116 }
116117
117118 public void clear() {
@@ -128,7 +129,7 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
128129 }
129130 // Paper end - EntityDeathEvent
130131
131- @@ -213,7 +235 ,7 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
132+ @@ -213,7 +236 ,7 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
132133 this.recheckEnchantmentForStack = null;
133134 this.hasUnsentEquipmentChanges = true;
134135
@@ -137,7 +138,7 @@ index 2e7c404e3808c39c0835e1e39fd238af4cf41022..2a45165a23c62d7df097a3358f7e8c4b
137138 if (!oldStack.isEmpty()) {
138139 //noinspection unchecked
139140 oldStack.lithium$unsubscribeWithData(this, 0);
140- @@ -226,7 +248 ,7 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
141+ @@ -226,7 +249 ,7 @@ public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entit
141142 this.recheckEnchantmentForStack = null;
142143 this.hasUnsentEquipmentChanges = true;
143144
0 commit comments