Project MMO

Project MMO

11M Downloads

Crashes due to passing null and invalid block information

cookta2012 opened this issue ยท 9 comments

commented

Describe the bug

float breakSpeed = block.defaultBlockState().getDestroySpeed(EmptyBlockGetter.INSTANCE, null);

float breakSpeed = Math.max(1, block.defaultBlockState().getDestroySpeed(null, null));

Causes crashes in mods that don't expect you to pass null because the position is supposed to be immutable in essence it is thought to be given
that and passing a empty BlockGetter causes a crash too because you end up in invalid code. your asking about a class/blockstate but you tell it that its block is minecraft:air
HUH?

Screenshots
If applicable, add screenshots to help explain your problem.

Versions:

  • Minecraft: 1.20.1
  • PMMO: 1.7.38
commented

What could I do to SGJourney such that if I return a value to you it will only affect your calculation and what value would you suggest?

commented

Because i'm working on Stargate Journey (a future release)

commented

Pmmo is configured using datapacks. If you added pmmo data to your mod data that would solve the issue without any code changes. If you would like, I can submit a PR for that so you don't have to figure out pmmo data for this.

commented

sure, submit against https://github.com/cookta2012/StargateJourney 1.19.3 (its the dev branch)

commented

its sgjourney btw

commented

private static final List<String> WORLD_SENSITIVE_MOD_IDS = List.of("dynamictrees", "dtbop");

add sgjourney please

commented

This is a known problem with Stargate journey. The auto values system has to operate on a null world state because mods like JEI populate tooltips before the world loads.

To avoid this crash, generate a datapack using the in-game /pmmo gendata create command and set the block XP and requirements for sgjourney blocks explicitly. This prevents the auto values system from being used and resolved the issue.

commented

Per Wold main dev he said we will nullcheck and return a default value thanks for your time!