mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-18 23:23:19 +01:00
Fix vanilla parity on enchantable items with no targets (#11896)
This commit is contained in:
parent
3ad3fbc19a
commit
79ffcd1536
1 changed files with 5 additions and 3 deletions
|
@ -97,7 +97,7 @@
|
|||
+ .bukkitToMinecraftHolder(offer.getEnchantment()));
|
||||
+ this.levelClue[j] = offer.getEnchantmentLevel();
|
||||
+ } else {
|
||||
+ this.costs[j] = 0;
|
||||
+ if (enchantClue[j] != -1) this.costs[j] = 0;
|
||||
+ this.enchantClue[j] = -1;
|
||||
+ this.levelClue[j] = -1;
|
||||
+ }
|
||||
|
@ -107,7 +107,7 @@
|
|||
this.broadcastChanges();
|
||||
});
|
||||
} else {
|
||||
@@ -145,19 +_,51 @@
|
||||
@@ -145,19 +_,53 @@
|
||||
return false;
|
||||
} else {
|
||||
this.access.execute((level, blockPos) -> {
|
||||
|
@ -124,7 +124,9 @@
|
|||
+ enchants.put(org.bukkit.craftbukkit.enchantments.CraftEnchantment.minecraftHolderToBukkit(instance.enchantment), instance.level);
|
||||
+ }
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack craftItemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack);
|
||||
+ org.bukkit.enchantments.Enchantment hintedEnchantment = org.bukkit.craftbukkit.enchantments.CraftEnchantment.minecraftHolderToBukkit(registry.byId(this.enchantClue[id]));
|
||||
+ Holder<Enchantment> holder = registry.byId(this.enchantClue[id]);
|
||||
+ if (holder == null) return;
|
||||
+ org.bukkit.enchantments.Enchantment hintedEnchantment = org.bukkit.craftbukkit.enchantments.CraftEnchantment.minecraftHolderToBukkit(holder);
|
||||
+ int hintedEnchantmentLevel = this.levelClue[id];
|
||||
+ org.bukkit.event.enchantment.EnchantItemEvent event = new org.bukkit.event.enchantment.EnchantItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), this.getBukkitView(), this.access.getLocation().getBlock(), craftItemStack, this.costs[id], enchants, hintedEnchantment, hintedEnchantmentLevel, id);
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
|
|
Loading…
Reference in a new issue