Compiler issue v5

This commit is contained in:
Bjarne Koll
2024-10-25 18:08:28 +02:00
parent f3f59e196d
commit d333b32d4f
9 changed files with 34 additions and 24 deletions

View File

@@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
- public void giveExp(int exp) {
+ // Paper start
+ // Paper start - ability to apply mending
+ public int applyMending(int amount) {
+ ServerPlayer handle = this.getHandle();
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .getRandomItemWith(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.REPAIR_WITH_XP, handle, net.minecraft.world.item.ItemStack::isDamaged);
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry.map(net.minecraft.world.item.enchantment.EnchantedItemInUse::itemStack).orElse(net.minecraft.world.item.ItemStack.EMPTY);
+ if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_DAMAGE)) {
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level(), net.minecraft.world.entity.EntitySpawnReason.COMMAND);
+ orb.value = amount;
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;
+ orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ());
@@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (applyMending) {
+ exp = this.applyMending(exp);
+ }
+ // Paper end
+ // Paper end - ability to apply mending
this.getHandle().giveExperiencePoints(exp);
}