NullPointerException when using useOnBlock
Closed this issue ยท 1 comments
Describe
Using useOnBlock results in a NullPointerException.
Likely also affects other fuel consuming actions
Steps to reproduce
- place a turtle with any automata core
- enter the lua console
- run useOnBlock with the automata core
Multiplayer?
No
Version
Own compiled build.
Minecraft, Forge and maybe other related mods versions
NeoForge 21.1.93 Minecraft 1.21.1
Screenshots or Videos
No response
Crashlog/log
https://gist.github.com/CrazyDev05/23b1041dd2351c0d1386ae65cc0601ee
did some quick digging, this caused the npe https://github.com/IntelligenceModding/AdvancedPeripherals/blob/dev/1.21.1/src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/owner/FuelAbility.java#L33
it probably should look like this:
Optional<? extends Integer> opt = settings.get(FUEL_CONSUMPTION_RATE.get());
int rate = opt != null && opt.isPresent() ? opt.get() : 0;