Statues

Statues

17M Downloads

[Bug]: Statues drops issue

Mowmaster opened this issue ยท 1 comments

commented

General Info

  • I am running a modpack
  • I can reproduce this issue consistently in single-player
  • I can reproduce this issue consistently in multi-player
  • I have searched for this issue previously and it was either (1) not previously reported, or (2) previously fixed and I am having the same problem.
  • I am crashing and can provide my crash report(s)
  • I am using the latest version of the mod

Forge version

i'd assume latest or within 2 versions

Minecraft version

1.19.2

Mod version

i'd assume latest

Java version

probably 17

Issue Description

StealthyDev from the FTB Discord ran across an issue,

Observed Behavior:
Single player world of FTB Skies 1.0.4

Leveled a Blaze Statue with 256 kills earning 16 upgrades. Gave it Automation I, Looting V, and Speed X. When placing the statue next to an inventory, I was only receiving a single drop and waiting produced no more.

Hooked up Integrated Dynamics to look at the NBT while it was running - the cooldown timer had gone negative and slowly plummeted into the thousands. Broke it and replaced it, got one more drop and then the same result. Took a screenshot which is attached.

Expected Behavior:
The cooldown would reset after giving the loot drop.

Possible root cause:
line 127 in AbstractStatueBlockEntity.getCooldown
this.cooldown - (getSpeed() * 20)
At Speed 10, this equals zero. The next time through serverTick, it decrements the cooldown before checking it, dropping it to -1 and then subtracting forever.

Recommendation:
Any subtraction in the abstract base based on settings or levels should be capped with a mathematic max() to be sure a specific minimum is maintained. In this case, 1.

All cooldown checks should be done with an inequality - this helps mitigate the chances of this kind of error and can help with certain types of race conditions (which are not relevant in this particular case)

Notes from a preliminary investigation:
In StatueBlockEntity.serverTick, it appears that it only checks if the cooldown is equal to zero rather than less than or equal to zero opening up the possibility for race conditions post
decrement.

Also possible that the resetting of the cooldown after it has been hit isn't triggering correctly as one item is being given each time.

image

Additional Information

They didnt want to have to make a git account to post this, so im doing it for them, havent actually had a chance to test this myself, and testing phase for the pack is over so there is noone else who could test this for me.

commented

This will be fixed in the next update which should come out later tonight