Steam Drill rarely saves invalid nbt
Swedz opened this issue ยท 1 comments
I had someone report a really odd bug with EI's chainsaw, and I believe its an issue with MI's drill as well. It's possible for the value of the water component in the steam tool to get set to 0 (see here), and the data component only allows 1 or higher (see here, POSITIVE_INT
only allows 1 or higher). When this happens, the world becomes "corrupted" where it can't load anymore. This could be fixed by making the water component use NON_NEGATIVE_INT
for its codec instead.
That, or you could do something like:
int water = stack.get(MIComponents.WATER);
if(water > 0)
{
stack.set(MIComponents.WATER, water);
}
else
{
stack.remove(MIComponents.WATER);
}
instead of using the stack.update(...)
call. This is the solution I'm going with for EI's chainsaw just so I can push a fix out for it right now.
This is actually not a problem for MI because the steam drill has a default value of 0
for its WATER
component. So that value will never get serialized. ๐
See