mojira.dev
MC-313658

Pig/strider speed boost logic and NBT is still broken/flawed

This report describes several closely related issues which I’m including in a single report because of the nature of the fix that would be needed.

Description

Pigs and striders store too much data relating to their speed boost, and the data is still not interpreted correctly. It would be expected that item_based_steering would contain only boost_time (consider renaming to boost_time_elapsed for clarity) and boost_time_total, and both of these values would be set to 0 (or -1) when a boost wears off, and the former would continue counting when the player dismounts or switches to another item (because the pig is still digesting the carrot). But presently there is an unnecessary boosting boolean, and it seems that reloading a pig with boosting:1b will start a new boost based on its boost_time_total. Meanwhile, boost_time, formerly useless due to MC-313300, now continues to increment, but the pig’s speed ramps up again from its normal movement speed before reverting to normal abruptly when the boost wears off. Furthermore, although boost_time_total now resets when a boost finishes, boost_time increases by 2 and does not reset.and boost_time_total do not reset when a boost finishes.

To reproduce

I’m not taking any chances this time. The steps below show how to reproduce the issues described above with a dedicated setup. The attached video shows steps 11-18.

  1. Find a flat surface with no other pigs nearby

  2. /scoreboard objectives add values dummy

  3. /scoreboard objectives setdisplay sidebar values

  4. /gamerule command_block_output false

  5. Place and power a repeating command block, facing up, with execute store result score boosting values run data get entity @n[type=pig] item_based_steering.boosting

  6. Above it, place an always-active chain command block, also facing up, with execute store result score boost_time values run data get entity @n[type=pig] item_based_steering.boost_time

  7. Above that, place another always-active chain command block, also facing up, with execute store result score boost_time_total values run data get entity @n[type=pig] item_based_steering.boost_time_total

  8. Give yourself a carrot on a stick

  9. Ensure your player speed is visible in the debug overlay

  10. /summon minecraft:pig ~ ~ ~ {equipment:{saddle:{count:1,id:"minecraft:saddle"}}}

  11. Mount the pig, without activating the carrot on a stick, and take stock of things
    ❌ Three fields are stored on the pig, even though only two are ever needed to determine the pig’s speed; boosting is unnecessary

  12. Right-click with the carrot on a stick
    ✔ Things seem to be working just fine

  13. Allow the boost to complete, holding the carrot on a stick the whole time
    ✔ boost_time_total resets to 0
    ❌ boost_time ends up at the old boost_time_total + 2

  14. Boost the pig again

  15. About halfway through the boost, reload the world
    ❌ The pig is slowly ramping up speed again, as if from a new boost

  16. Wait for the boost to end
    ❌ The pig’s speed boost expires abruptly

  17. Start a third boost

  18. Halfway through, switch to a different item or dismount
    ❌ boost_time stops incrementing even though the pig should still be digesting the carrot

Linked issues

Attachments

Comments 1

[Mod] clamlol

(Unassigned)

Unconfirmed

26.4 Pre-Release 2

Retrieved