|
|
|
@@ -11,12 +11,9 @@ ArmorStand equipment changes even if the ArmorStand is no-tick
|
|
|
|
This patch is based on the following mixins:
|
|
|
|
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/PatchedDataComponentMapMixin.java"
|
|
|
|
* "net/caffeinemc/mods/lithium/mixin/util/item_component_and_count_tracking/ItemStackMixin.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/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/ChangePublisher.java"
|
|
|
|
* "net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java"
|
|
|
|
* "net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java"
|
|
|
|
By: 2No2Name <2No2Name@web.de>
|
|
|
|
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)
|
|
|
|
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
|
|
|
|
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
|
|
|
|
--- a/net/minecraft/core/component/PatchedDataComponentMap.java
|
|
|
|
+++ b/net/minecraft/core/component/PatchedDataComponentMap.java
|
|
|
|
+++ b/net/minecraft/core/component/PatchedDataComponentMap.java
|
|
|
|
@@ -14,10 +14,11 @@ import java.util.Map.Entry;
|
|
|
|
@@ -14,10 +14,11 @@ import java.util.Map.Entry;
|
|
|
|
@@ -75,109 +72,157 @@ index a8c6549f772208cd543607224fef2c2389b14f24..709631db548a16a969a373e26ebbcd69
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object other) {
|
|
|
|
public boolean equals(Object other) {
|
|
|
|
return this == other
|
|
|
|
return this == other
|
|
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
diff --git a/net/minecraft/world/entity/EntityEquipment.java b/net/minecraft/world/entity/EntityEquipment.java
|
|
|
|
index 0138bd4d95a592bfa5ccbb33fa6c1201f289fd2a..00233a7066d751821566b43993e8c45e7dad95d0 100644
|
|
|
|
index 90814ad07a2686c5a274860395f5aca29cc3bf13..d10b64f8a3ca1fda83612a8765a59538bbd69313 100644
|
|
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
--- a/net/minecraft/world/entity/EntityEquipment.java
|
|
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/net/minecraft/world/entity/EntityEquipment.java
|
|
|
|
@@ -159,7 +159,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
|
|
|
@@ -7,7 +7,7 @@ import java.util.Objects;
|
|
|
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
// CraftBukkit end
|
|
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
|
|
|
|
|
|
|
|
-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<ItemStack>, 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-public class EntityEquipment {
|
|
|
|
|
|
|
|
+public class EntityEquipment implements net.caffeinemc.mods.lithium.common.entity.EquipmentInfo, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber<ItemStack> { // Leaf - Lithium - equipment tracking
|
|
|
|
|
|
|
|
public static final Codec<EntityEquipment> CODEC = Codec.unboundedMap(EquipmentSlot.CODEC, ItemStack.CODEC).xmap(map -> {
|
|
|
|
|
|
|
|
EnumMap<EquipmentSlot, ItemStack> map1 = new EnumMap<>(EquipmentSlot.class);
|
|
|
|
|
|
|
|
map1.putAll((Map<? extends EquipmentSlot, ? extends ItemStack>)map);
|
|
|
|
|
|
|
|
@@ -18,6 +18,11 @@ public class EntityEquipment {
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
private final EnumMap<EquipmentSlot, ItemStack> items;
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ private boolean maybeHasTickableEnchantments = this instanceof net.minecraft.world.entity.player.Player;
|
|
|
|
+ boolean shouldTickEnchantments = false;
|
|
|
|
+ private boolean equipmentChanged = true;
|
|
|
|
+ ItemStack recheckEnchantmentForStack = null;
|
|
|
|
|
|
|
|
+ boolean hasUnsentEquipmentChanges = true;
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
+ // 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) {
|
|
|
|
private EntityEquipment(EnumMap<EquipmentSlot, ItemStack> items) {
|
|
|
|
+ if (this.maybeHasTickableEnchantments && this.level() instanceof ServerLevel serverLevel) { // Leaf - Lithium - equipment tracking
|
|
|
|
this.items = items;
|
|
|
|
EnchantmentHelper.tickEffects(serverLevel, this);
|
|
|
|
@@ -29,7 +34,11 @@ public class EntityEquipment {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -738,6 +742,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
public ItemStack set(EquipmentSlot slot, ItemStack stack) {
|
|
|
|
if (!this.level().isClientSide() && !this.isSpectator()) {
|
|
|
|
stack.getItem().verifyComponentsAfterLoad(stack);
|
|
|
|
boolean flag = newItem.isEmpty() && oldItem.isEmpty();
|
|
|
|
- return Objects.requireNonNullElse(this.items.put(slot, stack), ItemStack.EMPTY);
|
|
|
|
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<EquipmentSlot, ItemStack> 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<EquipmentSlot, ItemStack> collectEquipmentChanges() {
|
|
|
|
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ final boolean isArmorStandUpdateNoTick = this instanceof net.minecraft.world.entity.decoration.ArmorStand stand && !stand.canTick && stand.noTickEquipmentDirty;
|
|
|
|
+ ItemStack newStack = Objects.requireNonNullElse(this.items.put(slot, stack), ItemStack.EMPTY);
|
|
|
|
+ if (!isArmorStandUpdateNoTick && !this.equipmentChanged) return null;
|
|
|
|
+ this.onEquipmentReplaced(this.get(slot), newStack);
|
|
|
|
|
|
|
|
+ return newStack;
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
Map<EquipmentSlot, ItemStack> 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
|
|
|
|
public ItemStack get(EquipmentSlot slot) {
|
|
|
|
+ @Override
|
|
|
|
@@ -56,8 +65,21 @@ public class EntityEquipment {
|
|
|
|
+ public void updateHasTickableEnchantments(ItemStack oldStack, ItemStack newStack) {
|
|
|
|
}
|
|
|
|
+ if (!this.maybeHasTickableEnchantments) {
|
|
|
|
|
|
|
|
+ this.maybeHasTickableEnchantments = stackHasTickableEnchantment(newStack);
|
|
|
|
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
|
|
|
|
+ @Override
|
|
|
|
+ public void notifyAfterEnchantmentChange(ItemStack publisher, int subscriberData) {
|
|
|
|
+ public boolean hasUnsentEquipmentChanges() {
|
|
|
|
+ if (!this.maybeHasTickableEnchantments) {
|
|
|
|
+ return this.hasUnsentEquipmentChanges;
|
|
|
|
+ this.maybeHasTickableEnchantments = stackHasTickableEnchantment(publisher);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Override
|
|
|
|
+ public void onEquipmentChanged() {
|
|
|
|
+ public void onEquipmentChangesSent() {
|
|
|
|
+ this.equipmentChanged = true;
|
|
|
|
+ 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) {
|
|
|
|
+ private static boolean stackHasTickableEnchantment(ItemStack stack) {
|
|
|
|
+ if (!stack.isEmpty()) {
|
|
|
|
+ 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()) {
|
|
|
|
+ if (enchantments != null && !enchantments.isEmpty()) {
|
|
|
|
+ for (Holder<Enchantment> enchantmentEntry : enchantments.keySet()) {
|
|
|
|
+ for (net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantmentEntry : enchantments.keySet()) {
|
|
|
|
+ if (!enchantmentEntry.value().getEffects(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.TICK).isEmpty()) {
|
|
|
|
+ if (!enchantmentEntry.value().getEffects(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.TICK).isEmpty()) {
|
|
|
|
+ return true;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Override
|
|
|
|
+ public void notify(@Nullable ItemStack publisher, int zero) {
|
|
|
|
+ public void notify(@org.jetbrains.annotations.Nullable ItemStack publisher, int zero) {
|
|
|
|
+ if (this instanceof EquipmentTrackingEntity equipmentTrackingEntity) {
|
|
|
|
+ this.hasUnsentEquipmentChanges = true;
|
|
|
|
+ equipmentTrackingEntity.onEquipmentChanged();
|
|
|
|
+
|
|
|
|
|
|
|
|
+ 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) {
|
|
|
|
+ public void forceUnsubscribe(ItemStack publisher, int zero) {
|
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
|
+ 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
|
|
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
index faf05f0c8f273bc723bbe54c70aebdd26c479a6b..54eeb0b112112bc5d3f4165c0ea43cf67931a739 100644
|
|
|
|
index 7e9ace691bb2662afd2c0fc504007a6d22a8aec0..4a6880c044c016e9e5b0ec88afbfe169eef8e1d3 100644
|
|
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
@@ -94,7 +94,7 @@ import org.bukkit.event.entity.EntityUnleashEvent;
|
|
|
|
@@ -144,7 +144,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
|
|
|
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
|
|
|
import org.bukkit.event.entity.EntityResurrectEvent;
|
|
|
|
// CraftBukkit end
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
|
|
|
-public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting {
|
|
|
|
-public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
+public abstract class Mob extends LivingEntity implements EquipmentUser, Leashable, Targeting, net.caffeinemc.mods.lithium.common.entity.EquipmentEntity { // Leaf - Lithium - equipment tracking
|
|
|
|
+public abstract class LivingEntity extends Entity implements Attackable, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber<ItemStack> { // Leaf - Lithium - equipment tracking
|
|
|
|
private static final EntityDataAccessor<Byte> DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE);
|
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
|
|
private static final int MOB_FLAG_NO_AI = 1;
|
|
|
|
private static final String TAG_ACTIVE_EFFECTS = "active_effects";
|
|
|
|
private static final int MOB_FLAG_LEFTHANDED = 2;
|
|
|
|
private static final ResourceLocation SPEED_MODIFIER_POWDER_SNOW_ID = ResourceLocation.withDefaultNamespace("powder_snow");
|
|
|
|
@@ -516,6 +516,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
|
|
@@ -417,7 +417,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
|
|
|
|
this.getSleepingPos().ifPresent(this::setPosToBed);
|
|
|
|
@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");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 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<EquipmentSlot, ItemStack> 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<EquipmentSlot, ItemStack> collectEquipmentChanges() {
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ if (prevBodyArmor != this.bodyArmorItem) {
|
|
|
|
+ final boolean isArmorStandUpdateNoTick = this instanceof net.minecraft.world.entity.decoration.ArmorStand stand && !stand.canTick && stand.noTickEquipmentDirty;
|
|
|
|
+ this.trackEquipChange(prevBodyArmor, this.bodyArmorItem);
|
|
|
|
+ if (!isArmorStandUpdateNoTick && !this.equipment.hasUnsentEquipmentChanges()) return null;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
}
|
|
|
|
Map<EquipmentSlot, ItemStack> map = null;
|
|
|
|
|
|
|
|
// Paper start - EntityEquipmentChangedEvent
|
|
|
|
@Override
|
|
|
|
record EquipmentChangeImpl(org.bukkit.inventory.ItemStack oldItem, org.bukkit.inventory.ItemStack newItem) implements io.papermc.paper.event.entity.EntityEquipmentChangedEvent.EquipmentChange {
|
|
|
|
@@ -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
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
|
|
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
|
|
|
|
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
|
|
+++ b/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;
|
|
|
|
@@ -551,8 +551,8 @@ public class ArmorStand extends LivingEntity {
|
|
|
|
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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
|
|
|
|
if (this.noTickEquipmentDirty) {
|
|
|
|
if (this.noTickEquipmentDirty) {
|
|
|
|
- this.noTickEquipmentDirty = false;
|
|
|
|
- this.noTickEquipmentDirty = false;
|
|
|
|
this.detectEquipmentUpdatesPublic();
|
|
|
|
this.detectEquipmentUpdates();
|
|
|
|
+ this.noTickEquipmentDirty = false; // Remove dirty mark after handling equipment update for armor stand
|
|
|
|
+ this.noTickEquipmentDirty = false; // Leaf - Lithium - equipment tracking - Remove dirty mark after handling equipment update for armor stand
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
@@ -886,4 +886,10 @@ public class ArmorStand extends LivingEntity {
|
|
|
|
@@ -968,4 +986,10 @@ public class ArmorStand extends LivingEntity {
|
|
|
|
|
|
|
|
if (this.canMovementTick && this.canMove) super.aiStep();
|
|
|
|
if (this.canMovementTick && this.canMove) super.aiStep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Purpur end - Movement options for armor stands
|
|
|
|
// Purpur end - Movement options for armor stands
|
|
|
|
@@ -378,10 +307,10 @@ index a31bbd8f3fff4fb4b1b33877d5835b93fc248f65..21153f37c169e987d7876d1b91410522
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
|
|
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
|
|
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
|
|
+++ b/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.apache.commons.lang3.mutable.MutableBoolean;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -390,7 +319,7 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776
|
|
|
|
private static final List<Component> OP_NBT_WARNING = List.of(
|
|
|
|
private static final List<Component> OP_NBT_WARNING = List.of(
|
|
|
|
Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD),
|
|
|
|
Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD),
|
|
|
|
Component.translatable("item.op_warning.line2").withStyle(ChatFormatting.RED),
|
|
|
|
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;
|
|
|
|
PatchedDataComponentMap components;
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
private Entity entityRepresentation;
|
|
|
|
private Entity entityRepresentation;
|
|
|
|
@@ -400,9 +329,9 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776
|
|
|
|
+ private int subscriberData;
|
|
|
|
+ private int subscriberData;
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
+ // Leaf end - Lithium - equipment tracking
|
|
|
|
|
|
|
|
|
|
|
|
private static DataResult<ItemStack> validateStrict(ItemStack stack) {
|
|
|
|
public static DataResult<ItemStack> validateStrict(ItemStack stack) {
|
|
|
|
DataResult<Unit> dataResult = validateComponents(stack.getComponents());
|
|
|
|
DataResult<Unit> 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) {
|
|
|
|
public void setCount(int count) {
|
|
|
|
@@ -424,9 +353,9 @@ index aa2c00be86f42a6674694a20545399e441b75199..fd7c1e800cbd4919a1a47f6c468c8776
|
|
|
|
this.count = count;
|
|
|
|
this.count = count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1430,4 +1450,87 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
@@ -1458,4 +1478,87 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
Repairable repairable = this.get(DataComponents.REPAIRABLE);
|
|
|
|
public boolean canDestroyBlock(BlockState state, Level level, BlockPos pos, Player player) {
|
|
|
|
return repairable != null && repairable.isValidRepairItem(item);
|
|
|
|
return this.getItem().canDestroyBlock(this, state, level, pos, player);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|
|
|
|
+ // Leaf start - Lithium - equipment tracking
|