diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0103-Lithium-equipment-tracking.patch b/leaf-server/minecraft-patches/features/0188-Lithium-equipment-tracking.patch similarity index 52% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0103-Lithium-equipment-tracking.patch rename to leaf-server/minecraft-patches/features/0188-Lithium-equipment-tracking.patch index 9c174967..08cbb720 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0103-Lithium-equipment-tracking.patch +++ b/leaf-server/minecraft-patches/features/0188-Lithium-equipment-tracking.patch @@ -11,12 +11,9 @@ ArmorStand equipment changes even if the ArmorStand is no-tick This patch is based on the following mixins: * "net/caffeinemc/mods/lithium/mixin/util/item_component_and_count_tracking/PatchedDataComponentMapMixin.java" * "net/caffeinemc/mods/lithium/mixin/util/item_component_and_count_tracking/ItemStackMixin.java" -* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/equipment_changes/LivingEntityMixin.java" -* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/ArmorStandMixin.java" -* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/LivingEntityMixin.java" -* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/MobMixin.java" * "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/enchantment_ticking/LivingEntityMixin.java" -* "net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java" +* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/equipment_changes/LivingEntityMixin.java" +* "net/caffeinemc/mods/lithium/mixin/entity/equipment_tracking/EntityEquipmentMixin.java" * "net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java" * "net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java" By: 2No2Name <2No2Name@web.de> @@ -24,7 +21,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/core/component/PatchedDataComponentMap.java b/net/minecraft/core/component/PatchedDataComponentMap.java -index a8c6549f772208cd543607224fef2c2389b14f24..709631db548a16a969a373e26ebbcd6983e35590 100644 +index 3af6c1e2549ba3aeb60aa9d498a976be3680c0ee..a8ec32ec1a8c5ebbbf64639f97acf8153e1dbdb4 100644 --- a/net/minecraft/core/component/PatchedDataComponentMap.java +++ b/net/minecraft/core/component/PatchedDataComponentMap.java @@ -14,10 +14,11 @@ import java.util.Map.Entry; @@ -75,109 +72,157 @@ index a8c6549f772208cd543607224fef2c2389b14f24..709631db548a16a969a373e26ebbcd69 @Override public boolean equals(Object other) { return this == other -diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 0138bd4d95a592bfa5ccbb33fa6c1201f289fd2a..00233a7066d751821566b43993e8c45e7dad95d0 100644 ---- a/net/minecraft/world/entity/LivingEntity.java -+++ b/net/minecraft/world/entity/LivingEntity.java -@@ -159,7 +159,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; - import org.bukkit.event.player.PlayerItemConsumeEvent; - // CraftBukkit end - --public abstract class LivingEntity extends Entity implements Attackable { -+public abstract class LivingEntity extends Entity implements Attackable, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber, net.caffeinemc.mods.lithium.common.entity.EquipmentEntity, net.caffeinemc.mods.lithium.common.entity.EquipmentEntity.TickableEnchantmentTrackingEntity, net.caffeinemc.mods.lithium.common.entity.EquipmentEntity.EquipmentTrackingEntity { // Leaf - Lithium - equipment tracking - private static final Logger LOGGER = LogUtils.getLogger(); - private static final String TAG_ACTIVE_EFFECTS = "active_effects"; - private static final ResourceLocation SPEED_MODIFIER_POWDER_SNOW_ID = ResourceLocation.withDefaultNamespace("powder_snow"); -@@ -305,6 +305,10 @@ public abstract class LivingEntity extends Entity implements Attackable { - public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API - protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight +diff --git a/net/minecraft/world/entity/EntityEquipment.java b/net/minecraft/world/entity/EntityEquipment.java +index 90814ad07a2686c5a274860395f5aca29cc3bf13..d10b64f8a3ca1fda83612a8765a59538bbd69313 100644 +--- a/net/minecraft/world/entity/EntityEquipment.java ++++ b/net/minecraft/world/entity/EntityEquipment.java +@@ -7,7 +7,7 @@ import java.util.Objects; + import java.util.Map.Entry; + import net.minecraft.world.item.ItemStack; +-public class EntityEquipment { ++public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entity.EquipmentInfo, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber { // Leaf - Lithium - equipment tracking + public static final Codec CODEC = Codec.unboundedMap(EquipmentSlot.CODEC, ItemStack.CODEC).xmap(map -> { + EnumMap map1 = new EnumMap<>(EquipmentSlot.class); + map1.putAll((Map)map); +@@ -18,6 +18,11 @@ public class EntityEquipment { + return map; + }); + private final EnumMap items; + // Leaf start - Lithium - equipment tracking -+ private boolean maybeHasTickableEnchantments = this instanceof net.minecraft.world.entity.player.Player; -+ private boolean equipmentChanged = true; ++ boolean shouldTickEnchantments = false; ++ ItemStack recheckEnchantmentForStack = null; ++ boolean hasUnsentEquipmentChanges = true; + // Leaf end - Lithium - equipment tracking - @Override - public float getBukkitYaw() { - return this.getYHeadRot(); -@@ -445,7 +449,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.getSleepingPos().ifPresent(this::setPosToBed); - } -- if (this.level() instanceof ServerLevel serverLevel) { -+ if (this.maybeHasTickableEnchantments && this.level() instanceof ServerLevel serverLevel) { // Leaf - Lithium - equipment tracking - EnchantmentHelper.tickEffects(serverLevel, this); - } + private EntityEquipment(EnumMap items) { + this.items = items; +@@ -29,7 +34,11 @@ public class EntityEquipment { -@@ -738,6 +742,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (!this.level().isClientSide() && !this.isSpectator()) { - boolean flag = newItem.isEmpty() && oldItem.isEmpty(); - if (!flag && !ItemStack.isSameItemSameComponents(oldItem, newItem) && !this.firstTick) { -+ this.onEquipmentReplaced(oldItem, newItem); // Leaf - Lithium - equipment tracking - Equippable equippable = newItem.get(DataComponents.EQUIPPABLE); - if (!this.isSilent() && equippable != null && slot == equippable.slot() && !silent) { // CraftBukkit - this.level() -@@ -3355,6 +3360,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - public void detectEquipmentUpdatesPublic() { // CraftBukkit - Map map = this.collectEquipmentChanges(); - if (map != null) { -+ if (!(this instanceof net.minecraft.world.entity.player.Player)) this.equipmentChanged = false; // Leaf - Lithium - equipment tracking - this.handleHandSwap(map); - if (!map.isEmpty()) { - this.handleEquipmentChanges(map); -@@ -3364,6 +3370,10 @@ public abstract class LivingEntity extends Entity implements Attackable { - - @Nullable - private Map collectEquipmentChanges() { + public ItemStack set(EquipmentSlot slot, ItemStack stack) { + stack.getItem().verifyComponentsAfterLoad(stack); +- return Objects.requireNonNullElse(this.items.put(slot, stack), ItemStack.EMPTY); + // Leaf start - Lithium - equipment tracking -+ final boolean isArmorStandUpdateNoTick = this instanceof net.minecraft.world.entity.decoration.ArmorStand stand && !stand.canTick && stand.noTickEquipmentDirty; -+ if (!isArmorStandUpdateNoTick && !this.equipmentChanged) return null; ++ ItemStack newStack = Objects.requireNonNullElse(this.items.put(slot, stack), ItemStack.EMPTY); ++ this.onEquipmentReplaced(this.get(slot), newStack); ++ return newStack; + // Leaf end - Lithium - equipment tracking - Map map = null; - // Paper start - EntityEquipmentChangedEvent - record EquipmentChangeImpl(org.bukkit.inventory.ItemStack oldItem, org.bukkit.inventory.ItemStack newItem) implements io.papermc.paper.event.entity.EntityEquipmentChangedEvent.EquipmentChange { -@@ -4723,6 +4733,81 @@ public abstract class LivingEntity extends Entity implements Attackable { - return this.lastHurtByPlayerTime; } -+ // Leaf start - Lithium - equipment tracking -+ @Override -+ public void updateHasTickableEnchantments(ItemStack oldStack, ItemStack newStack) { -+ if (!this.maybeHasTickableEnchantments) { -+ this.maybeHasTickableEnchantments = stackHasTickableEnchantment(newStack); + public ItemStack get(EquipmentSlot slot) { +@@ -56,8 +65,21 @@ public class EntityEquipment { + } + + public void setAll(EntityEquipment equipment) { ++ this.onClear(); // Leaf - Lithium - equipment tracking + this.items.clear(); + this.items.putAll(equipment.items); ++ // Leaf start - Lithium - equipment tracking ++ for (ItemStack newStack : this.items.values()) { ++ if (!newStack.isEmpty()) { ++ if (!this.shouldTickEnchantments) { ++ this.shouldTickEnchantments = stackHasTickableEnchantment(newStack); ++ } ++ if (!newStack.isEmpty()) { ++ newStack.subscribe(this, 0); ++ } ++ } + } ++ // Leaf end - Lithium - equipment tracking + } + + public void dropAll(LivingEntity entity) { +@@ -70,6 +92,7 @@ public class EntityEquipment { + + public void clear() { + this.items.replaceAll((equipmentSlot, itemStack) -> ItemStack.EMPTY); ++ this.onClear(); // Leaf - Lithium - equipment tracking + } + + // Paper start - EntityDeathEvent +@@ -78,4 +101,99 @@ public class EntityEquipment { + return this.items.containsKey(slot); + } + // Paper end - EntityDeathEvent ++ ++ @Override ++ public boolean shouldTickEnchantments() { ++ this.processScheduledEnchantmentCheck(null); ++ return this.shouldTickEnchantments; + } + + @Override -+ public void notifyAfterEnchantmentChange(ItemStack publisher, int subscriberData) { -+ if (!this.maybeHasTickableEnchantments) { -+ this.maybeHasTickableEnchantments = stackHasTickableEnchantment(publisher); -+ } ++ public boolean hasUnsentEquipmentChanges() { ++ return this.hasUnsentEquipmentChanges; + } + + @Override -+ public void onEquipmentChanged() { -+ this.equipmentChanged = true; ++ public void onEquipmentChangesSent() { ++ this.hasUnsentEquipmentChanges = false; ++ } ++ ++ private void onClear() { ++ this.shouldTickEnchantments = false; ++ this.recheckEnchantmentForStack = null; ++ this.hasUnsentEquipmentChanges = true; ++ ++ for (ItemStack oldStack : this.items.values()) { ++ if (!oldStack.isEmpty()) { ++ oldStack.unsubscribeWithData(this, 0); ++ } ++ } ++ } ++ ++ private void onEquipmentReplaced(ItemStack oldStack, ItemStack newStack) { ++ if (!this.shouldTickEnchantments) { ++ if (this.recheckEnchantmentForStack == oldStack) { ++ this.recheckEnchantmentForStack = null; ++ } ++ this.shouldTickEnchantments = stackHasTickableEnchantment(newStack); ++ } ++ ++ this.hasUnsentEquipmentChanges = true; ++ ++ if (!oldStack.isEmpty()) { ++ oldStack.unsubscribeWithData(this, 0); ++ } ++ if (!newStack.isEmpty()) { ++ newStack.subscribe(this, 0); ++ } + } + + private static boolean stackHasTickableEnchantment(ItemStack stack) { + if (!stack.isEmpty()) { -+ net.minecraft.world.item.enchantment.ItemEnchantments enchantments = stack.get(DataComponents.ENCHANTMENTS); ++ net.minecraft.world.item.enchantment.ItemEnchantments enchantments = stack.get(net.minecraft.core.component.DataComponents.ENCHANTMENTS); + if (enchantments != null && !enchantments.isEmpty()) { -+ for (Holder enchantmentEntry : enchantments.keySet()) { ++ for (net.minecraft.core.Holder enchantmentEntry : enchantments.keySet()) { + if (!enchantmentEntry.value().getEffects(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.TICK).isEmpty()) { + return true; + } + } -+ return false; + } + } + return false; + } + + @Override -+ public void notify(@Nullable ItemStack publisher, int zero) { -+ if (this instanceof EquipmentTrackingEntity equipmentTrackingEntity) { -+ equipmentTrackingEntity.onEquipmentChanged(); ++ public void notify(@org.jetbrains.annotations.Nullable ItemStack publisher, int zero) { ++ this.hasUnsentEquipmentChanges = true; ++ ++ if (!this.shouldTickEnchantments) { ++ this.processScheduledEnchantmentCheck(publisher); ++ this.scheduleEnchantmentCheck(publisher); ++ } ++ } ++ ++ private void scheduleEnchantmentCheck(@org.jetbrains.annotations.Nullable ItemStack toCheck) { ++ this.recheckEnchantmentForStack = toCheck; ++ } ++ ++ private void processScheduledEnchantmentCheck(@org.jetbrains.annotations.Nullable ItemStack ignoredStack) { ++ if (this.recheckEnchantmentForStack != null && this.recheckEnchantmentForStack != ignoredStack) { ++ this.shouldTickEnchantments = stackHasTickableEnchantment(this.recheckEnchantmentForStack); ++ this.recheckEnchantmentForStack = null; + } + } + @@ -194,179 +239,63 @@ index 0138bd4d95a592bfa5ccbb33fa6c1201f289fd2a..00233a7066d751821566b43993e8c45e + public void forceUnsubscribe(ItemStack publisher, int zero) { + throw new UnsupportedOperationException(); + } -+ -+ @Override -+ public void onEquipmentReplaced(ItemStack oldStack, ItemStack newStack) { -+ if (this instanceof TickableEnchantmentTrackingEntity enchantmentTrackingEntity) { -+ enchantmentTrackingEntity.updateHasTickableEnchantments(oldStack, newStack); -+ } -+ -+ if (this instanceof EquipmentTrackingEntity equipmentTrackingEntity) { -+ equipmentTrackingEntity.onEquipmentChanged(); -+ } -+ -+ if (!oldStack.isEmpty()) { -+ oldStack.unsubscribeWithData(this, 0); -+ } -+ if (!newStack.isEmpty()) { -+ newStack.subscribe(this, 0); -+ } -+ } -+ // Leaf end - Lithium - equipment tracking -+ - public record Fallsounds(SoundEvent small, SoundEvent big) { - } } -diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index faf05f0c8f273bc723bbe54c70aebdd26c479a6b..54eeb0b112112bc5d3f4165c0ea43cf67931a739 100644 ---- a/net/minecraft/world/entity/Mob.java -+++ b/net/minecraft/world/entity/Mob.java -@@ -94,7 +94,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; - import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 7e9ace691bb2662afd2c0fc504007a6d22a8aec0..4a6880c044c016e9e5b0ec88afbfe169eef8e1d3 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -144,7 +144,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; + import org.bukkit.event.entity.EntityResurrectEvent; // CraftBukkit end --public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting { -+public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting, net.caffeinemc.mods.lithium.common.entity.EquipmentEntity { // Leaf - Lithium - equipment tracking - private static final EntityDataAccessor DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE); - private static final int MOB_FLAG_NO_AI = 1; - private static final int MOB_FLAG_LEFTHANDED = 2; -@@ -516,6 +516,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - - @Override - public void readAdditionalSaveData(CompoundTag compound) { -+ ItemStack prevBodyArmor = this.bodyArmorItem; // Leaf - Lithium - equipment tracking - super.readAdditionalSaveData(compound); - // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it - if (compound.contains("CanPickUpLoot", 99)) { -@@ -535,7 +536,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - - for (int i = 0; i < this.armorItems.size(); i++) { - CompoundTag compound1 = list.getCompound(i); -- this.armorItems.set(i, ItemStack.parseOptional(this.registryAccess(), compound1)); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack currStack = ItemStack.parseOptional(this.registryAccess(), compound1); -+ ItemStack prevStack = this.armorItems.set(i, currStack); -+ this.trackEquipChange(prevStack, currStack); -+ // Leaf end - Lithium - equipment tracking - } - } else { - this.armorItems.replaceAll(itemStack -> ItemStack.EMPTY); -@@ -556,7 +561,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - - for (int i = 0; i < this.handItems.size(); i++) { - CompoundTag compound1 = list.getCompound(i); -- this.handItems.set(i, ItemStack.parseOptional(this.registryAccess(), compound1)); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack currStack = ItemStack.parseOptional(this.registryAccess(), compound1); -+ ItemStack prevStack = this.handItems.set(i, currStack); -+ this.trackEquipChange(prevStack, currStack); -+ // Leaf end - Lithium - equipment tracking - } - } else { - this.handItems.replaceAll(itemStack -> ItemStack.EMPTY); -@@ -599,6 +608,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - this.ticksSinceLastInteraction = compound.getInt("Purpur.ticksSinceLastInteraction"); +-public abstract class LivingEntity extends Entity implements Attackable { ++public abstract class LivingEntity extends Entity implements Attackable, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber { // Leaf - Lithium - equipment tracking + private static final Logger LOGGER = LogUtils.getLogger(); + private static final String TAG_ACTIVE_EFFECTS = "active_effects"; + private static final ResourceLocation SPEED_MODIFIER_POWDER_SNOW_ID = ResourceLocation.withDefaultNamespace("powder_snow"); +@@ -417,7 +417,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.getSleepingPos().ifPresent(this::setPosToBed); } - // Purpur end - Entity lifespan + +- if (this.level() instanceof ServerLevel serverLevel) { ++ if ((this instanceof Player || this.equipment.shouldTickEnchantments()) && this.level() instanceof ServerLevel serverLevel) { // Leaf - Lithium - equipment tracking + EnchantmentHelper.tickEffects(serverLevel, this); + } + +@@ -3394,6 +3394,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + public void detectEquipmentUpdates() { + Map map = this.collectEquipmentChanges(); + if (map != null) { ++ if (!(this instanceof net.minecraft.world.entity.player.Player)) this.equipment.onEquipmentChangesSent();; // Leaf - Lithium - equipment tracking + this.handleHandSwap(map); + if (!map.isEmpty()) { + this.handleEquipmentChanges(map); +@@ -3403,6 +3404,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + + @Nullable + private Map collectEquipmentChanges() { + // Leaf start - Lithium - equipment tracking -+ if (prevBodyArmor != this.bodyArmorItem) { -+ this.trackEquipChange(prevBodyArmor, this.bodyArmorItem); -+ } ++ final boolean isArmorStandUpdateNoTick = this instanceof net.minecraft.world.entity.decoration.ArmorStand stand && !stand.canTick && stand.noTickEquipmentDirty; ++ if (!isArmorStandUpdateNoTick && !this.equipment.hasUnsentEquipmentChanges()) return null; + // Leaf end - Lithium - equipment tracking - } - - @Override -@@ -1750,4 +1764,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - } - } - // Purpur end - Ridables -+ -+ // Leaf start - Lithium - equipment tracking -+ private void trackEquipChange(ItemStack prevStack, ItemStack currStack) { -+ this.onEquipmentReplaced(prevStack, currStack); -+ } -+ // Leaf end - Lithium - equipment tracking - } + Map map = null; + // Paper start - EntityEquipmentChangedEvent + record EquipmentChangeImpl(org.bukkit.inventory.ItemStack oldItem, org.bukkit.inventory.ItemStack newItem) implements io.papermc.paper.event.entity.EntityEquipmentChangedEvent.EquipmentChange { diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java -index a31bbd8f3fff4fb4b1b33877d5835b93fc248f65..21153f37c169e987d7876d1b914105223ac10ee7 100644 +index 49500127eb3a471c41dc3ff32372ad6f20c6d69a..c4ef7ce572a1dc05a9ff2b4aa115ef07fd04902d 100644 --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -46,7 +46,7 @@ import net.minecraft.world.level.material.PushReaction; - import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.Vec3; - --public class ArmorStand extends LivingEntity { -+public class ArmorStand extends LivingEntity implements net.caffeinemc.mods.lithium.common.entity.EquipmentEntity { // Leaf - Lithium - equipment tracking - public static final int WOBBLE_TIME = 5; - private static final boolean ENABLE_ARMS = true; - public static final Rotations DEFAULT_HEAD_POSE = new Rotations(0.0F, 0.0F, 0.0F); -@@ -233,7 +233,11 @@ public class ArmorStand extends LivingEntity { - - for (int i = 0; i < this.armorItems.size(); i++) { - CompoundTag compound1 = list.getCompound(i); -- this.armorItems.set(i, ItemStack.parseOptional(this.registryAccess(), compound1)); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack currElement = ItemStack.parseOptional(this.registryAccess(), compound1); -+ ItemStack prevElement = this.armorItems.set(i, currElement); -+ this.trackEquipChange(prevElement, currElement); -+ // Leaf end - Lithium - equipment tracking - } - } - -@@ -242,7 +246,11 @@ public class ArmorStand extends LivingEntity { - - for (int i = 0; i < this.handItems.size(); i++) { - CompoundTag compound1 = list.getCompound(i); -- this.handItems.set(i, ItemStack.parseOptional(this.registryAccess(), compound1)); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack currStack = ItemStack.parseOptional(this.registryAccess(), compound1); -+ ItemStack prevStack = this.handItems.set(i, currStack); -+ this.trackEquipChange(prevStack, currStack); -+ // Leaf end - Lithium - equipment tracking - } - } - -@@ -578,7 +586,11 @@ public class ArmorStand extends LivingEntity { - ItemStack itemStack = this.handItems.get(i); - if (!itemStack.isEmpty()) { - this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly -- this.handItems.set(i, ItemStack.EMPTY); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack emptyStack = ItemStack.EMPTY; -+ ItemStack prevStack = this.handItems.set(i, emptyStack); -+ this.trackEquipChange(prevStack, emptyStack); -+ // Leaf end - Lithium - equipment tracking - } - } - -@@ -586,7 +598,11 @@ public class ArmorStand extends LivingEntity { - ItemStack itemStack = this.armorItems.get(ix); - if (!itemStack.isEmpty()) { - this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly -- this.armorItems.set(ix, ItemStack.EMPTY); -+ // Leaf start - Lithium - equipment tracking -+ ItemStack emptyStack = ItemStack.EMPTY; -+ ItemStack prevStack = this.armorItems.set(ix, ItemStack.EMPTY); -+ this.trackEquipChange(prevStack, emptyStack); -+ // Leaf end - Lithium - equipment tracking - } - } - return this.dropAllDeathLoot(level, damageSource); // CraftBukkit - moved from above // Paper -@@ -632,10 +648,12 @@ public class ArmorStand extends LivingEntity { - this.updatePose(); +@@ -551,8 +551,8 @@ public class ArmorStand extends LivingEntity { } -+ // Leaf start - Lithium - equipment tracking if (this.noTickEquipmentDirty) { - this.noTickEquipmentDirty = false; - this.detectEquipmentUpdatesPublic(); -+ this.noTickEquipmentDirty = false; // Remove dirty mark after handling equipment update for armor stand + this.detectEquipmentUpdates(); ++ this.noTickEquipmentDirty = false; // Leaf - Lithium - equipment tracking - Remove dirty mark after handling equipment update for armor stand } -+ // Leaf end - Lithium - equipment tracking return; - } -@@ -968,4 +986,10 @@ public class ArmorStand extends LivingEntity { +@@ -886,4 +886,10 @@ public class ArmorStand extends LivingEntity { if (this.canMovementTick && this.canMove) super.aiStep(); } // Purpur end - Movement options for armor stands @@ -378,10 +307,10 @@ index a31bbd8f3fff4fb4b1b33877d5835b93fc248f65..21153f37c169e987d7876d1b91410522 + // Leaf end - Lithium - equipment tracking } diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776535bd028 100644 +index d2d9619f8156985ba38c0ef8c0f155adc8d40f34..cf5755a313b021c42a194364641cf5cad1ccfba7 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -95,7 +95,7 @@ import net.minecraft.world.level.saveddata.maps.MapId; +@@ -97,7 +97,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import org.apache.commons.lang3.mutable.MutableBoolean; import org.slf4j.Logger; @@ -390,7 +319,7 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776 private static final List OP_NBT_WARNING = List.of( Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD), Component.translatable("item.op_warning.line2").withStyle(ChatFormatting.RED), -@@ -202,6 +202,11 @@ public final class ItemStack implements DataComponentHolder { +@@ -168,6 +168,11 @@ public final class ItemStack implements DataComponentHolder { PatchedDataComponentMap components; @Nullable private Entity entityRepresentation; @@ -400,9 +329,9 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776 + private int subscriberData; + // Leaf end - Lithium - equipment tracking - private static DataResult validateStrict(ItemStack stack) { + public static DataResult validateStrict(ItemStack stack) { DataResult dataResult = validateComponents(stack.getComponents()); -@@ -1375,6 +1380,21 @@ public final class ItemStack implements DataComponentHolder { +@@ -1403,6 +1408,21 @@ public final class ItemStack implements DataComponentHolder { } public void setCount(int count) { @@ -424,9 +353,9 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776 this.count = count; } -@@ -1430,4 +1450,87 @@ public final class ItemStack implements DataComponentHolder { - Repairable repairable = this.get(DataComponents.REPAIRABLE); - return repairable != null && repairable.isValidRepairItem(item); +@@ -1458,4 +1478,87 @@ public final class ItemStack implements DataComponentHolder { + public boolean canDestroyBlock(BlockState state, Level level, BlockPos pos, Player player) { + return this.getItem().canDestroyBlock(this, state, level, pos, player); } + + // Leaf start - Lithium - equipment tracking diff --git a/leaf-server/minecraft-patches/features/0188-C2ME-Optimize-world-gen-math.patch b/leaf-server/minecraft-patches/features/0189-C2ME-Optimize-world-gen-math.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0188-C2ME-Optimize-world-gen-math.patch rename to leaf-server/minecraft-patches/features/0189-C2ME-Optimize-world-gen-math.patch diff --git a/leaf-server/minecraft-patches/features/0189-Cache-chunk-key.patch b/leaf-server/minecraft-patches/features/0190-Cache-chunk-key.patch similarity index 99% rename from leaf-server/minecraft-patches/features/0189-Cache-chunk-key.patch rename to leaf-server/minecraft-patches/features/0190-Cache-chunk-key.patch index 1f512247..34b994e8 100644 --- a/leaf-server/minecraft-patches/features/0189-Cache-chunk-key.patch +++ b/leaf-server/minecraft-patches/features/0190-Cache-chunk-key.patch @@ -97,7 +97,7 @@ index fd3d0f6cb53bc8b6186f0d86575f21007b2c20ed..cddeeab73e7b981701a42c5aad6b4777 // Paper end - rewrite chunk system } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index fc1430cb711a86281cfc7b7c94221e7ef867da9e..d9a9a60e63e652ca83c26dba5d7bfa3a3834af35 100644 +index 7b85a9ebdbe3e8bee0a8fc100ede8a3f07eee5ce..c8c99323b6397c3e595e7a9007e5d801ee2ac14a 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -503,7 +503,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe diff --git a/leaf-server/minecraft-patches/features/0190-Cache-random-tick-block-status.patch b/leaf-server/minecraft-patches/features/0191-Cache-random-tick-block-status.patch similarity index 97% rename from leaf-server/minecraft-patches/features/0190-Cache-random-tick-block-status.patch rename to leaf-server/minecraft-patches/features/0191-Cache-random-tick-block-status.patch index 71491533..1cdab487 100644 --- a/leaf-server/minecraft-patches/features/0190-Cache-random-tick-block-status.patch +++ b/leaf-server/minecraft-patches/features/0191-Cache-random-tick-block-status.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Cache random tick block status diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java -index 03edf6dc751cc59ae1f16c23340e41668350b32a..963c51d14f87d2557a3d686fb8fe3ec9cba367b3 100644 +index df717c545472006b99532280c38c1fbef12bcf82..36c033b0ee63dfc273d721fb4b614733e8fdef19 100644 --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -21,6 +21,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ diff --git a/leaf-server/minecraft-patches/features/0191-Cache-part-of-canHoldFluid-result.patch b/leaf-server/minecraft-patches/features/0192-Cache-part-of-canHoldFluid-result.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0191-Cache-part-of-canHoldFluid-result.patch rename to leaf-server/minecraft-patches/features/0192-Cache-part-of-canHoldFluid-result.patch diff --git a/leaf-server/minecraft-patches/features/0192-Configurable-tripwire-dupe.patch b/leaf-server/minecraft-patches/features/0193-Configurable-tripwire-dupe.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0192-Configurable-tripwire-dupe.patch rename to leaf-server/minecraft-patches/features/0193-Configurable-tripwire-dupe.patch diff --git a/leaf-server/minecraft-patches/features/0193-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch b/leaf-server/minecraft-patches/features/0194-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0193-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch rename to leaf-server/minecraft-patches/features/0194-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch diff --git a/leaf-server/minecraft-patches/features/0194-Sepals-Rearrange-the-attackable-conditions.patch b/leaf-server/minecraft-patches/features/0195-Sepals-Rearrange-the-attackable-conditions.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0194-Sepals-Rearrange-the-attackable-conditions.patch rename to leaf-server/minecraft-patches/features/0195-Sepals-Rearrange-the-attackable-conditions.patch diff --git a/leaf-server/minecraft-patches/features/0195-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch b/leaf-server/minecraft-patches/features/0196-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0195-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch rename to leaf-server/minecraft-patches/features/0196-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch diff --git a/leaf-server/minecraft-patches/features/0196-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch b/leaf-server/minecraft-patches/features/0197-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch similarity index 92% rename from leaf-server/minecraft-patches/features/0196-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch rename to leaf-server/minecraft-patches/features/0197-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch index 86ad9cb3..21674588 100644 --- a/leaf-server/minecraft-patches/features/0196-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch +++ b/leaf-server/minecraft-patches/features/0197-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch @@ -9,7 +9,7 @@ By default, the server will start rewriting all map datas to the disk after load This also slows down world saving a lot if you have a lot of maps diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 3ae69b17fec1cdb2bee2b5a795026a875f197c30..1196066585582af132f8fb773bab7466d0800461 100644 +index df471cd42f4084facb895b229c261b685054c3ae..3e84cb0fe6efa95ccede9ead29cafbf1afb717d9 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -160,6 +160,7 @@ public class MapItemSavedData extends SavedData { diff --git a/leaf-server/minecraft-patches/features/0197-Optimize-checking-nearby-players-for-spawning.patch b/leaf-server/minecraft-patches/features/0198-Optimize-checking-nearby-players-for-spawning.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0197-Optimize-checking-nearby-players-for-spawning.patch rename to leaf-server/minecraft-patches/features/0198-Optimize-checking-nearby-players-for-spawning.patch diff --git a/leaf-server/minecraft-patches/features/0198-Cache-supporting-block-check.patch b/leaf-server/minecraft-patches/features/0199-Cache-supporting-block-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0198-Cache-supporting-block-check.patch rename to leaf-server/minecraft-patches/features/0199-Cache-supporting-block-check.patch diff --git a/leaf-server/minecraft-patches/features/0199-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch b/leaf-server/minecraft-patches/features/0200-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0199-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch rename to leaf-server/minecraft-patches/features/0200-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch diff --git a/leaf-server/minecraft-patches/features/0200-Replace-brain-activity-maps-with-optimized-collectio.patch b/leaf-server/minecraft-patches/features/0201-Replace-brain-activity-maps-with-optimized-collectio.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0200-Replace-brain-activity-maps-with-optimized-collectio.patch rename to leaf-server/minecraft-patches/features/0201-Replace-brain-activity-maps-with-optimized-collectio.patch diff --git a/leaf-server/minecraft-patches/features/0201-Remove-stream-in-villagers.patch b/leaf-server/minecraft-patches/features/0202-Remove-stream-in-villagers.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0201-Remove-stream-in-villagers.patch rename to leaf-server/minecraft-patches/features/0202-Remove-stream-in-villagers.patch diff --git a/leaf-server/minecraft-patches/features/0202-Optimize-baby-villager-sensor.patch b/leaf-server/minecraft-patches/features/0203-Optimize-baby-villager-sensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0202-Optimize-baby-villager-sensor.patch rename to leaf-server/minecraft-patches/features/0203-Optimize-baby-villager-sensor.patch diff --git a/leaf-server/minecraft-patches/features/0203-Only-player-pushable.patch b/leaf-server/minecraft-patches/features/0204-Only-player-pushable.patch similarity index 90% rename from leaf-server/minecraft-patches/features/0203-Only-player-pushable.patch rename to leaf-server/minecraft-patches/features/0204-Only-player-pushable.patch index e2c24394..18e7c951 100644 --- a/leaf-server/minecraft-patches/features/0203-Only-player-pushable.patch +++ b/leaf-server/minecraft-patches/features/0204-Only-player-pushable.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only player pushable Useful for extreme cases like massive entities collide together in a small area diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index eb40f810d4eb8d6a8cc130719b637a473f19cc82..9d6d8ba96acd688d07bfecc29ff9de95abcd839c 100644 +index 4a6880c044c016e9e5b0ec88afbfe169eef8e1d3..2d246bfccb8538391592dec4a0a0e47aa6ff355d 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3630,7 +3630,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3635,7 +3635,7 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf this.checkAutoSpinAttack(boundingBox, this.getBoundingBox()); } @@ -18,7 +18,7 @@ index eb40f810d4eb8d6a8cc130719b637a473f19cc82..9d6d8ba96acd688d07bfecc29ff9de95 // Paper start - Add EntityMoveEvent // Purpur start - Ridables if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { -@@ -3773,7 +3773,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3778,7 +3778,12 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf return; } // Paper end - don't run getEntities if we're not going to use its result @@ -32,7 +32,7 @@ index eb40f810d4eb8d6a8cc130719b637a473f19cc82..9d6d8ba96acd688d07bfecc29ff9de95 if (!pushableEntities.isEmpty()) { if (this.level() instanceof ServerLevel serverLevel) { // Paper - don't run getEntities if we're not going to use its result; moved up -@@ -3807,6 +3812,44 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3812,6 +3817,44 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf } } @@ -78,7 +78,7 @@ index eb40f810d4eb8d6a8cc130719b637a473f19cc82..9d6d8ba96acd688d07bfecc29ff9de95 AABB aabb = boundingBoxBeforeSpin.minmax(boundingBoxAfterSpin); List entities = this.level().getEntities(this, aabb); diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java -index 49500127eb3a471c41dc3ff32372ad6f20c6d69a..aee9711b76c76e64056b73f8581cce0ba40b0811 100644 +index c4ef7ce572a1dc05a9ff2b4aa115ef07fd04902d..9b1b99c557b06b8b1e7b791e07637333797cc07f 100644 --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java @@ -247,7 +247,7 @@ public class ArmorStand extends LivingEntity { diff --git a/leaf-server/minecraft-patches/features/0204-Remove-iterators-from-Inventory.patch b/leaf-server/minecraft-patches/features/0205-Remove-iterators-from-Inventory.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0204-Remove-iterators-from-Inventory.patch rename to leaf-server/minecraft-patches/features/0205-Remove-iterators-from-Inventory.patch diff --git a/leaf-server/minecraft-patches/features/0205-Alternative-Brain-Behaviour.patch b/leaf-server/minecraft-patches/features/0206-Alternative-Brain-Behaviour.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0205-Alternative-Brain-Behaviour.patch rename to leaf-server/minecraft-patches/features/0206-Alternative-Brain-Behaviour.patch diff --git a/leaf-server/minecraft-patches/features/0206-Cache-eligible-players-for-despawn-checks.patch b/leaf-server/minecraft-patches/features/0207-Cache-eligible-players-for-despawn-checks.patch similarity index 98% rename from leaf-server/minecraft-patches/features/0206-Cache-eligible-players-for-despawn-checks.patch rename to leaf-server/minecraft-patches/features/0207-Cache-eligible-players-for-despawn-checks.patch index bbca6a5b..97809978 100644 --- a/leaf-server/minecraft-patches/features/0206-Cache-eligible-players-for-despawn-checks.patch +++ b/leaf-server/minecraft-patches/features/0207-Cache-eligible-players-for-despawn-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Cache eligible players for despawn checks diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index d9a9a60e63e652ca83c26dba5d7bfa3a3834af35..8daa10d2e2f6276fa4c4071928d7ee5aac2054c2 100644 +index c8c99323b6397c3e595e7a9007e5d801ee2ac14a..7ca4fd418599cdb1bb1de44f4c3c57f1770a4038 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -723,6 +723,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe diff --git a/leaf-server/minecraft-patches/features/0207-Slightly-optimise-getNearestPlayer.patch b/leaf-server/minecraft-patches/features/0208-Slightly-optimise-getNearestPlayer.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0207-Slightly-optimise-getNearestPlayer.patch rename to leaf-server/minecraft-patches/features/0208-Slightly-optimise-getNearestPlayer.patch diff --git a/leaf-server/minecraft-patches/features/0208-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch b/leaf-server/minecraft-patches/features/0209-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0208-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch rename to leaf-server/minecraft-patches/features/0209-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch diff --git a/leaf-server/minecraft-patches/features/0209-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch b/leaf-server/minecraft-patches/features/0210-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0209-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch rename to leaf-server/minecraft-patches/features/0210-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch diff --git a/leaf-server/minecraft-patches/features/0210-Optimize-AABB.patch b/leaf-server/minecraft-patches/features/0211-Optimize-AABB.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0210-Optimize-AABB.patch rename to leaf-server/minecraft-patches/features/0211-Optimize-AABB.patch diff --git a/leaf-server/minecraft-patches/features/0211-Improve-sorting-in-SortedArraySet.patch b/leaf-server/minecraft-patches/features/0212-Improve-sorting-in-SortedArraySet.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0211-Improve-sorting-in-SortedArraySet.patch rename to leaf-server/minecraft-patches/features/0212-Improve-sorting-in-SortedArraySet.patch diff --git a/leaf-server/minecraft-patches/features/0212-Make-removeIf-slightly-faster.patch b/leaf-server/minecraft-patches/features/0213-Make-removeIf-slightly-faster.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0212-Make-removeIf-slightly-faster.patch rename to leaf-server/minecraft-patches/features/0213-Make-removeIf-slightly-faster.patch diff --git a/leaf-server/minecraft-patches/features/0213-Optimize-LinearPalette.patch b/leaf-server/minecraft-patches/features/0214-Optimize-LinearPalette.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0213-Optimize-LinearPalette.patch rename to leaf-server/minecraft-patches/features/0214-Optimize-LinearPalette.patch diff --git a/leaf-server/minecraft-patches/features/0214-Slightly-optimized-VarInt-write.patch b/leaf-server/minecraft-patches/features/0215-Slightly-optimized-VarInt-write.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0214-Slightly-optimized-VarInt-write.patch rename to leaf-server/minecraft-patches/features/0215-Slightly-optimized-VarInt-write.patch diff --git a/leaf-server/minecraft-patches/features/0215-Rewrite-ClientboundLightUpdatePacketData.patch b/leaf-server/minecraft-patches/features/0216-Rewrite-ClientboundLightUpdatePacketData.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0215-Rewrite-ClientboundLightUpdatePacketData.patch rename to leaf-server/minecraft-patches/features/0216-Rewrite-ClientboundLightUpdatePacketData.patch diff --git a/leaf-server/minecraft-patches/features/0216-Some-Optimizations-on-SerializableChunkData.patch b/leaf-server/minecraft-patches/features/0217-Some-Optimizations-on-SerializableChunkData.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0216-Some-Optimizations-on-SerializableChunkData.patch rename to leaf-server/minecraft-patches/features/0217-Some-Optimizations-on-SerializableChunkData.patch diff --git a/leaf-server/minecraft-patches/features/0217-Rework-ChunkHolderManager.patch b/leaf-server/minecraft-patches/features/0218-Rework-ChunkHolderManager.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0217-Rework-ChunkHolderManager.patch rename to leaf-server/minecraft-patches/features/0218-Rework-ChunkHolderManager.patch diff --git a/leaf-server/minecraft-patches/features/0218-Optimize-chunkUnload.patch b/leaf-server/minecraft-patches/features/0219-Optimize-chunkUnload.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0218-Optimize-chunkUnload.patch rename to leaf-server/minecraft-patches/features/0219-Optimize-chunkUnload.patch diff --git a/leaf-server/minecraft-patches/features/0219-Async-chunk-sending.patch b/leaf-server/minecraft-patches/features/0220-Async-chunk-sending.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0219-Async-chunk-sending.patch rename to leaf-server/minecraft-patches/features/0220-Async-chunk-sending.patch diff --git a/leaf-server/minecraft-patches/features/0220-Spawner-Configurations.patch b/leaf-server/minecraft-patches/features/0221-Spawner-Configurations.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0220-Spawner-Configurations.patch rename to leaf-server/minecraft-patches/features/0221-Spawner-Configurations.patch diff --git a/leaf-server/minecraft-patches/features/0221-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch b/leaf-server/minecraft-patches/features/0222-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0221-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch rename to leaf-server/minecraft-patches/features/0222-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch diff --git a/leaf-server/minecraft-patches/features/0222-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch b/leaf-server/minecraft-patches/features/0223-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0222-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch rename to leaf-server/minecraft-patches/features/0223-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch diff --git a/leaf-server/minecraft-patches/features/0223-Remove-streams-on-InsideBrownianWalk.patch b/leaf-server/minecraft-patches/features/0224-Remove-streams-on-InsideBrownianWalk.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0223-Remove-streams-on-InsideBrownianWalk.patch rename to leaf-server/minecraft-patches/features/0224-Remove-streams-on-InsideBrownianWalk.patch diff --git a/leaf-server/minecraft-patches/features/0224-Use-BFS-on-getSlopeDistance.patch b/leaf-server/minecraft-patches/features/0225-Use-BFS-on-getSlopeDistance.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0224-Use-BFS-on-getSlopeDistance.patch rename to leaf-server/minecraft-patches/features/0225-Use-BFS-on-getSlopeDistance.patch diff --git a/leaf-server/minecraft-patches/features/0225-Paper-PR-Throttle-failed-spawn-attempts.patch b/leaf-server/minecraft-patches/features/0226-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0225-Paper-PR-Throttle-failed-spawn-attempts.patch rename to leaf-server/minecraft-patches/features/0226-Paper-PR-Throttle-failed-spawn-attempts.patch diff --git a/leaf-server/minecraft-patches/features/0226-Improve-BlockEntity-ticking-isRemoved-check.patch b/leaf-server/minecraft-patches/features/0227-Improve-BlockEntity-ticking-isRemoved-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0226-Improve-BlockEntity-ticking-isRemoved-check.patch rename to leaf-server/minecraft-patches/features/0227-Improve-BlockEntity-ticking-isRemoved-check.patch diff --git a/leaf-server/minecraft-patches/features/0227-Raytrace-AntiXray-SDK-integration.patch b/leaf-server/minecraft-patches/features/0228-Raytrace-AntiXray-SDK-integration.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0227-Raytrace-AntiXray-SDK-integration.patch rename to leaf-server/minecraft-patches/features/0228-Raytrace-AntiXray-SDK-integration.patch diff --git a/leaf-server/minecraft-patches/features/0228-Optimize-addOrUpdateTransientModifier.patch b/leaf-server/minecraft-patches/features/0229-Optimize-addOrUpdateTransientModifier.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0228-Optimize-addOrUpdateTransientModifier.patch rename to leaf-server/minecraft-patches/features/0229-Optimize-addOrUpdateTransientModifier.patch diff --git a/leaf-server/minecraft-patches/features/0229-Optimize-ContextMap.create.patch b/leaf-server/minecraft-patches/features/0230-Optimize-ContextMap.create.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0229-Optimize-ContextMap.create.patch rename to leaf-server/minecraft-patches/features/0230-Optimize-ContextMap.create.patch diff --git a/leaf-server/minecraft-patches/features/0230-Micro-optimizations-for-random-tick.patch b/leaf-server/minecraft-patches/features/0231-Micro-optimizations-for-random-tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0230-Micro-optimizations-for-random-tick.patch rename to leaf-server/minecraft-patches/features/0231-Micro-optimizations-for-random-tick.patch diff --git a/leaf-server/minecraft-patches/features/0231-Remove-streams-on-updateConnectedPlayersWithinRange.patch b/leaf-server/minecraft-patches/features/0232-Remove-streams-on-updateConnectedPlayersWithinRange.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0231-Remove-streams-on-updateConnectedPlayersWithinRange.patch rename to leaf-server/minecraft-patches/features/0232-Remove-streams-on-updateConnectedPlayersWithinRange.patch diff --git a/leaf-server/minecraft-patches/features/0232-Remove-streams-on-PlayerDetector.patch b/leaf-server/minecraft-patches/features/0233-Remove-streams-on-PlayerDetector.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0232-Remove-streams-on-PlayerDetector.patch rename to leaf-server/minecraft-patches/features/0233-Remove-streams-on-PlayerDetector.patch diff --git a/leaf-server/minecraft-patches/features/0233-Async-Block-Finding.patch b/leaf-server/minecraft-patches/features/0234-Async-Block-Finding.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0233-Async-Block-Finding.patch rename to leaf-server/minecraft-patches/features/0234-Async-Block-Finding.patch diff --git a/leaf-server/minecraft-patches/features/0234-Use-direct-iteration-on-Sensing.tick.patch b/leaf-server/minecraft-patches/features/0235-Use-direct-iteration-on-Sensing.tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0234-Use-direct-iteration-on-Sensing.tick.patch rename to leaf-server/minecraft-patches/features/0235-Use-direct-iteration-on-Sensing.tick.patch diff --git a/leaf-server/minecraft-patches/features/0235-Optimise-non-flush-packet-sending.patch b/leaf-server/minecraft-patches/features/0236-Optimise-non-flush-packet-sending.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0235-Optimise-non-flush-packet-sending.patch rename to leaf-server/minecraft-patches/features/0236-Optimise-non-flush-packet-sending.patch diff --git a/leaf-server/minecraft-patches/features/0236-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch b/leaf-server/minecraft-patches/features/0237-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0236-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch rename to leaf-server/minecraft-patches/features/0237-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch diff --git a/leaf-server/minecraft-patches/features/0237-Async-Target-Finding.patch b/leaf-server/minecraft-patches/features/0238-Async-Target-Finding.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0237-Async-Target-Finding.patch rename to leaf-server/minecraft-patches/features/0238-Async-Target-Finding.patch diff --git a/leaf-server/minecraft-patches/features/0238-Null-handling-on-MultifaceSpreader.patch b/leaf-server/minecraft-patches/features/0239-Null-handling-on-MultifaceSpreader.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0238-Null-handling-on-MultifaceSpreader.patch rename to leaf-server/minecraft-patches/features/0239-Null-handling-on-MultifaceSpreader.patch diff --git a/leaf-server/minecraft-patches/features/0239-More-virtual-threads.patch b/leaf-server/minecraft-patches/features/0240-More-virtual-threads.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0239-More-virtual-threads.patch rename to leaf-server/minecraft-patches/features/0240-More-virtual-threads.patch diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java b/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java deleted file mode 100644 index a5a2640e..00000000 --- a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.caffeinemc.mods.lithium.common.entity; - -import net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber; -import net.minecraft.world.item.ItemStack; - -public interface EquipmentEntity { - - void onEquipmentReplaced(ItemStack oldStack, ItemStack newStack); - - interface EquipmentTrackingEntity { - void onEquipmentChanged(); - } - - interface TickableEnchantmentTrackingEntity extends ChangeSubscriber.EnchantmentSubscriber { - void updateHasTickableEnchantments(ItemStack oldStack, ItemStack newStack); - } -} diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentInfo.java b/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentInfo.java new file mode 100644 index 00000000..0a7d5800 --- /dev/null +++ b/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentInfo.java @@ -0,0 +1,10 @@ +package net.caffeinemc.mods.lithium.common.entity; + +public interface EquipmentInfo { + + boolean shouldTickEnchantments(); + + boolean hasUnsentEquipmentChanges(); + + void onEquipmentChangesSent(); +} diff --git a/todos.md b/todos.md index 4090b0b8..cfb775f6 100644 --- a/todos.md +++ b/todos.md @@ -15,5 +15,4 @@ - [ ] Check beacon issues fix - [ ] Update README.md - [ ] Remove stream in Inventory and check new changes -- [ ] Check potential upstream changes (not Paper) then release 1st exp build - [ ] Update from Leaf 1.21.4 (curr commit: `dd22d9cafffece7d469a7d702f63952abea441d2`) \ No newline at end of file