#Modifying the attack speed and range of a weapon

28 messages · Page 1 of 1 (latest)

jaunty stag
#

Hi, I read on the Wiki how to modify items. This is the script I have for testing:

ItemEvents.modification(event => {
  event.modify('minecraft:diamond_sword', item => {
    item.attackDamage = 4;
    item.speed = 0.5;
  })
  }
)

The attack damage works okay (makes the Diamond sword deal 5 damage) but the attack speed is stuck at 4 plus whatever number I put. For example, the above script leads to the sword having 0.5 attack speed. How do I make it so it actually has a 0.5 attack speed? Also, is it possible to make it so that the weapon has a 3.0 block range?

It would also help if somebody could point me to a tutorial or a way I can learn for myself on how to modify weapons attributes, since the Wiki seems to be incomplete.

safe mesaBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

jaunty stag
#

Btw I am using build 2001.6.5-build.14

rugged forge
#

@jaunty stag MC calculates base attack speed + weapon

your character have a base attack speed of 4
sword I think it have -2.4, so 1.6 total

if you want 0.5 you need to make the sword -3.5

jaunty stag
#

That leads to having a negative attack speed tooltip

rugged forge
jaunty stag
#

1.3, sorry I know I used a different example. Just wanted to show that the tooltip is negative

rugged forge
#

yes this happens because of a Minecraft bug with UUIDs

jaunty stag
#

Okay, I see. Thanks. Is there a way to address the other issue of range?

rugged forge
#

@jaunty stag is it global? like all diamond sword will have that range boost?

rugged forge
# jaunty stag Yes, thats what I want
ItemEvents.modification(event => {
  event.modify("diamond_sword", item => {
    item.addAttribute("forge:entity_reach", "a19dd459-ee1c-4dc7-bb82-e44212f3fdc6", "Reach bonus", 1, "addition")
  })
})

here I added 1, play with it to see how much you need

jaunty stag
#

And weirdly the reach when nothign is held in the main hand is like 6 blocks

#

Not only that but once you hold the item that has been modified once, all other items get the same reach bonus

rugged forge
jaunty stag
#

still doesn't work :(

#

You're right about testing in survival, that fixed all items getting the reach bonus

jaunty stag
#

The first time I tested it, it worked but it worked on every weapon

#

I restarted the game after that and now it completely does not work at all

jaunty stag
rugged forge
#

what is weird af and don't make sense

jaunty stag
#

maybe its important detail that i am using better combat