3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Use Obfuscation Helpers

Dieser Commit ist enthalten in:
Vivian Horvath 2024-11-13 22:25:41 -05:00
Ursprung cbb122d816
Commit 97ad6ea902

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 009539fa39c81c610ac34747cc09082a0756c79d..04704d729c1e8b170866f4101442da839a52f235 100644
index 009539fa39c81c610ac34747cc09082a0756c79d..47a435501ab09dff1d66e91f926eaa712bb24136 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3280,10 +3280,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -13,15 +13,17 @@ index 009539fa39c81c610ac34747cc09082a0756c79d..04704d729c1e8b170866f4101442da83
}
- ItemStack itemstack2 = itemstack1;
+ ItemStack itemstack2 = itemstack1; final ItemStack oldEquipment = itemstack2; // Paper - PlayerArmorChangeEvent - obfhelper
-
- itemstack = this.getItemBySlot(enumitemslot);
- if (this.equipmentHasChanged(itemstack2, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ ItemStack itemstack2 = itemstack1; final ItemStack oldEquipment = itemstack2; // Paper - PlayerArmorChangeEvent - obfhelper
+
+ itemstack = this.getItemBySlot(enumitemslot); final ItemStack newEquipment = itemstack;// Paper - PlayerArmorChangeEvent - obfhelper
if (this.equipmentHasChanged(itemstack2, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ if (this.equipmentHasChanged(oldEquipment, newEquipment)) {
+ if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack2);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(oldEquipment);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(newEquipment);
+ new com.destroystokyo.paper.event.player.PlayerArmorChangeEvent((Player) this.getBukkitEntity(), com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
+ }
+ // Paper end - PlayerArmorChangeEvent