Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am attempting to make a weapon with a custom attribute, in this case armor penetration. Everything has made sense so far, except that the attribute map on the item requires a UUID, which from what i can tell, is just preset at random. 

My current constructor looks like this:

public WeaponMace(IItemTier tier, Properties properties, float baseDamage, double speed, int armorPen)
    {
        super(tier, properties);

        Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder();
        float attackDamage = baseDamage + tier.getAttackDamageBonus();
        builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", attackDamage, AttributeModifier.Operation.ADDITION));
        builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", speed, AttributeModifier.Operation.ADDITION));
        builder.put(ModAttributes.ARMOR_PENETRATION.get(), new AttributeModifier(UUID.fromString("c7675e5c-2e25-4589-ace1-f0ad816b40b8"), "Weapon modifier", armorPen, AttributeModifier.Operation.ADDITION));
        this.defaultModifiers = builder.build();
    }

Is this an ok way of doing this? 

1 hour ago, theishiopian said:

Everything has made sense so far, except that the attribute map on the item requires a UUID, which from what i can tell, is just preset at random.

The UUID is used to identify the attribute. This means that if two items have the same UUID for an attribute, the most recently equipped one will override the other if both are equipped at the same time. The Minecraft wiki has some info about it on the attribute page here. What I usually do is generate a random UUID once with UUID.randomUUID(), and then use that in UUID.fromString().

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.