Weird Creative Inventory Behavior
Expected behavior
Tbh i didn't expected anything it just happened since my update from the 1.20.4 -> 1.21
Observed/Actual behavior
I am creating custom item/weapon system and i update my old one to the 1.21 standards, methods etc and now when i open the creative inventory all the attribute modifiers. It just happened out of nowhere i didn't code anything within the creative inventory.
Steps/models to reproduce
My code to set the attribute modifiers:
@Override
default HashMap<Class<?>,InitUpdateMethod> getInitUpdateMethods() {
HashMap<Class<?>,InitUpdateMethod> initUpdateMethods = ClickHitDamageItem.super.getInitUpdateMethods();
initUpdateMethods.put(HitWeaponItem.class, itemStack -> {
itemStack.editMeta(meta -> {
meta.addAttributeModifier(
Attribute.GENERIC_ATTACK_DAMAGE,
new AttributeModifier(
new NamespacedKey(CatalyaRPG.getInstance(), "catalya_attribute_attack_damage"),
damage(),
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND
)
);
meta.addAttributeModifier(
Attribute.GENERIC_ATTACK_SPEED,
new AttributeModifier(
new NamespacedKey(CatalyaRPG.getInstance(), "catalya_attribute_attack_speed"),
-attackDelay(),
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND
)
);
meta.addAttributeModifier(
Attribute.GENERIC_MAX_HEALTH,
new AttributeModifier(
new NamespacedKey(CatalyaRPG.getInstance(), "catalya_attribute_max_health"),
extraHearts(),
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND
)
);
meta.addAttributeModifier(
Attribute.GENERIC_KNOCKBACK_RESISTANCE,
new AttributeModifier(
new NamespacedKey(CatalyaRPG.getInstance(), "catalya_attribute_knockback_resistance"),
knockbackResistance(), AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND
)
);
meta.addAttributeModifier(
Attribute.GENERIC_MOVEMENT_SPEED,
new AttributeModifier(
new NamespacedKey(CatalyaRPG.getInstance(), "catalya_attribute_movement_speed"),
movementSpeed(),
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND
)
);
});
return itemStack;
});
return initUpdateMethods;
}
Plugin and Datapack List
CatalyaCore (Core Plugin of a project) CatalyaSurvival/RPG (Plugin of a project) Luckperms ViaVersion ViaBackwards
Paper version
This server is running Paper version 1.21-20-master@8b1d26d (2024-06-21T00:30:00Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are running the latest version Previous version: 1.21-15-2df432f (MC: 1.21)
Other
No response
nevermind i found out it also removes the whole Item Meta but not lore and display name
Can you provide some clarification on what is happening? Your original post doesn't seem to say. Also, try doing this without viaversion.
Can you provide some clarification on what is happening? Your original post doesn't seem to say. Also, try doing this without viaversion.
Alright when i give myself one of the custom items i create with the code above and i open the inventory inside the creative mode the whole meta data gets cleared and that is happenig to all the items within my inventory that i created with my system. Vanilla items like a sword for example doesn't seem to be affected by that.
But what stays is the DisplayName and the ItemLore
I was not able to replicate this. Attribute modifiers remain on the item, so does general item meta data. I have also not heard of any other such reports, hence I'll be closing this issue as "cannot reproduce".
If you still have this issue, please try to create a simple example plugin that achieves such a bug and that runs on latest paper without any other plugins installed. We can reopen the issue in that case to further investigate.