Fix soul speed particles with hide-itemmeta enabled (#7239)

This commit is contained in:
Noah van der Aa 2022-01-02 00:26:53 +01:00
parent 0418e96f5d
commit ac54c26f5e
2 changed files with 9 additions and 3 deletions

View file

@ -81,7 +81,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (tag.get("Enchantments") instanceof ListTag enchantmentsTag && !enchantmentsTag.isEmpty()) {
+ // The client still renders items with the enchantment glow if the enchantments tag contains at least one (empty) child.
+ ListTag enchantments = new ListTag();
+ enchantments.add(new CompoundTag());
+ CompoundTag fakeEnchantment = new CompoundTag();
+ // Soul speed boots generate client side particles.
+ if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SOUL_SPEED, itemStack) > 0) {
+ fakeEnchantment.putString("id", org.bukkit.enchantments.Enchantment.SOUL_SPEED.getKey().asString());
+ fakeEnchantment.putInt("lvl", 1);
+ }
+ enchantments.add(fakeEnchantment);
+ tag.put("Enchantments", enchantments);
+ }
+ tag.remove("AttributeModifiers");
@ -91,6 +97,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
// Paper end - prevent oversized data
// Paper start - prevent oversized data
public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) {
if (itemStack.isEmpty() || !itemStack.hasTag()) {

View file

@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}
+ // Paper end - prevent oversized data
+ // Paper start - prevent oversized data
+ public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) {
+ if (itemStack.isEmpty() || !itemStack.hasTag()) {
+ return itemStack;