Advanced Peripherals

Advanced Peripherals

30M Downloads

NullPointerException when using useOnBlock

Closed this issue ยท 1 comments

commented

Describe

Using useOnBlock results in a NullPointerException.
Likely also affects other fuel consuming actions

Steps to reproduce

  1. place a turtle with any automata core
  2. enter the lua console
  3. 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

commented

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;