Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Weird Creative Inventory Behavior

Open Dxrknesx opened this issue 1 year ago • 3 comments

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

Dxrknesx avatar Jun 21 '24 04:06 Dxrknesx

nevermind i found out it also removes the whole Item Meta but not lore and display name

Dxrknesx avatar Jun 21 '24 04:06 Dxrknesx

Can you provide some clarification on what is happening? Your original post doesn't seem to say. Also, try doing this without viaversion.

Machine-Maker avatar Jun 23 '24 21:06 Machine-Maker

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

Dxrknesx avatar Jun 23 '24 23:06 Dxrknesx

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.

lynxplay avatar Jul 30 '24 20:07 lynxplay