#ElgarL teaches Cj stuff

1 messages · Page 1 of 1 (latest)

naive hound
#

a

fringe shadow
#

so if you were using the top one, String, double, AttributeModifier.Operation

#

its asking for three arguments

naive hound
#

yeah

#

k

#

whats AttributeModifier.Operation

fringe shadow
#

string being any name you want to give it.

#

ok, thats an enum

naive hound
#

whats an enum

fringe shadow
#

if you click it it shows you

naive hound
fringe shadow
#

so if you use AttributeModifier.Operation.ADD_NUMBER in the previous constructor

#

it tells teh attribute to add yoru value to any damage

naive hound
#

ok

#

makes more sense

fringe shadow
#

an Enum is, um, a set of constants (ish)

naive hound
#

so a list of constants

fringe shadow
#

its quite complex to excplain enums

naive hound
#

k

fringe shadow
#

basically for this instance this enum has three values

naive hound
#

k

fringe shadow
#

ADD_NUMBER, ADD_SCALAR and MULTIPLY_SCALAR_1

naive hound
#

these ADD_NUMBER ADD_SCALAR MULTIPLY_SCALAR_1?

fringe shadow
#

you cna play with them to see what each does

#

yes

naive hound
#

k

fringe shadow
#

so going back to the AttributeModifier constructor AttributeModifier​(String name, double amount, AttributeModifier.Operation operation)

naive hound
#

k

#

so AttributeModifier(GENERIC_ATTACK_DAMAGE, 1, ADD_NUMBER)?

fringe shadow
#

you would be doing something like java new AttributeModifier("extra_damage", 10, AttributeModifier.Operation.ADD_NUMBER)

naive hound
#

oh

#

ok

fringe shadow
#

you plug that into your earlier addAttributeModifier method

naive hound
#

so so what do I put in the first thing tell me what its called

fringe shadow
#
addAttributeModifier(GENERIC_ATTACK_DAMAGE, new AttributeModifier("extra_damage", 10, AttributeModifier.Operation.ADD_NUMBER))```
naive hound
#

ok thanks so much for your patience with a dummy

#

wait

#

@fringe shadow

#

in meta.addAttributeModifier(GENERIC_ATTACK_DAMAGE, new AttributeModifier("extra_damage", 10, AttributeModifier.Operation.ADD_NUMBER));

#

GENERIC_ATTACK_DAMAGE is throwing an error

fringe shadow
#

you may have to get the attribute first. One sec I'll check

#
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier("extra_damage", 10, AttributeModifier.Operation.ADD_NUMBER));```
naive hound
#

thanks

fringe shadow
#

You can create any number of modifiers and add them to an item. You can even make them only work when in a specific slot or inventory

#

oh, don;t forget to put the meta back on the item