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

How can I make the attributes be added only for the mainhand. Currently it adds the values for Head, Legs, Chest, Mainhand, offhand and boots. The second problem is that it overwrites the standard values of the sword. I solved this by writing the values at the very front of amountIn and adding the actual calculation to it.

 @Override
       public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot,
               ItemStack stack) {
           Multimap<Attribute, AttributeModifier> attss = LinkedHashMultimap.create();
            if (stack.hasTag()){

                attss.put(Attributes.ATTACK_SPEED,
                        new AttributeModifier(ATTACK_SPEED_MODIFIER, Soulharvest.MOD_ID + ":speed_bonus", 2+((Math.sqrt((stack.getTag().getInt("KillCounterPhobos") +stack.getTag().getInt("KillCounterPhobosMob"))*2) + (stack.getTag().getInt("KillCounterPhobos") +stack.getTag().getInt("KillCounterPhobosMob"))) / 12.5)* ATTACK_SPEED_MULTIPLY_twin.get(),
                               AttributeModifier.Operation.ADDITION));

              attss.put(Attributes.ATTACK_DAMAGE,

                        new AttributeModifier(ATTACK_DAMAGE_MODIFIER, Soulharvest.MOD_ID + ":damage_bonus", 4+((Math.sqrt((stack.getTag().getInt("KillCounterPhobos") + stack.getTag().getInt("KillCounterPhobosMob"))*2) + (stack.getTag().getInt("KillCounterPhobos") + stack.getTag().getInt("KillCounterPhobosMob"))) / 25)*Damage_MULTIPLY_twin.get(),
                               AttributeModifier.Operation.ADDITION));
                return attss;
           }
           return attss;
}

 

  • Author

I didn't give the EquipmentSlotType a type, thought would happen automatically with extends SwordItem

 

Could you not just wrap your attss.put method in a if statement ?

e.g.

 

if(slot == EquipmentSlotType.MAINHAND) {

// DO your attss.put code here.

}

 

 

or even add it to your current if statement

if (stack.hasTag() && slot == EquipmentSlotType.MAINHAND){

// Do Code

}

 

 

 

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.