#Add Mining speed while certain conditions are met

1 messages · Page 1 of 1 (latest)

dense thunder
#

I made a custom armor which gives the player bonuses related to building such as block interaction range. But I also want to give mining speed while riding a happy ghast and wearing the corresponding armor piece:
Specially crafted helmet + riding happy ghast = breaking blocks faster

What's a good way to do this? (advancements?, scoreboards?)
Would appreciate a little detail.

Ping me pls.

agile dew
# dense thunder I made a custom armor which gives the player bonuses related to building such as...

you can use a location trigger and then a list of conditions, this allows you to also use the inverted predicate (e.g. vehicle is not happy_ghast)

I would probably do 2 advancements with reward functions where one revokes the other. This is to avoid the problem of still having to modify attributes each tick. Since only one of either advancement can be true (either you ride a happy_ghast or not) you should be fine.

The logic for the attributes can be in the reward functions.

#

you can also use tick trigger but that would be checked 20 times more often.

#

for the mounting you can actually use a more efficient advancement trigger, started_riding this would mean that only when the player is mounted you have an advancement checking for the dismount every X ticks.

#

If you need help with the specifics just paste your advancement or function that isn't working in a nice code block by surrounding it with 3 ` at the begin and end of the code. You can add the file type for some nice formatting.
Like so:
```mcfunction
advancement revoke @s only example:happy_ghast/mount
say I dismounted
```

mental hazelBOT
#
advancement revoke @s only example:happy_ghast/mount
say I dismounted
dense thunder
#

Ok I got the advancements working.

{
  "criteria": {
    "stopped_riding_ghast": {
      "trigger": "minecraft:location",
      "conditions": {
        "player": [
          {
            "condition": "minecraft:inverted",
            "term": {
              "condition": "minecraft:entity_properties",
              "entity": "this",
              "predicate": {
                "vehicle": {
                  "type": "minecraft:happy_ghast"
                }
              }
            }
          }
        ]
      }
    }
  },
  "rewards": {
    "function": "fg"
  }
}```
Generated with misode - function name is only a placeholder.
This is granted instantly when joining the world. So the function is also run but that function reduces the block_break_speed of the player. Can I prevent that?
agile dew
#

instead of reducing it, remove the modifier?

#

like if the mounting applies a bonus

#

than you don't need to do anything except remove said modifier

#

you don't need to add another modifier to reduce it

dense thunder
#

attribute @s block_break_speed modifier add stolz:building_armor_helmet 2 add_value
attribute @s block_break_speed modifier remove stolz:building_armor_helmet

like this?

edit: yes, like that