Immersive Weathering [FABRIC]

Immersive Weathering [FABRIC]

6M Downloads

Server crash when mining a block next to a water source in ad_astra dimensions

UdoMorgenstern opened this issue ยท 1 comments

commented

Description:
Server crash when mining a block next to a water source in ad_astra dimensions

  • or any other fluid
  1. scenario: pickup of a fluid with a bucket next to a source

Versions:
Minecraft version: 1.19.2
Immersive Weathering version: immersive_weathering-1.19.2-1.2.5-forge
Moonlight Lib version: moonlight-1.19.2-2.1.15-forge
Fabric API / QSL / Forge version: Forge 43.0.2 (also 42.1.68)

Other mods:
ad_astra-forge-1.19.2-1.11.9.jar as crash seems only happening in these dimensions
still crashlog's callstack itself only shows Immersive Weathering
FluidInteractionRegistry.handler$zof000$immersiveWeatheringDataFluidInteraction

  • all other mods please refer to crashlog

Logs:
Even if the game does not crash they may be useful!
crash-2022-12-11_17.03.54-server.txt

To Reproduce:
Scenario A:

  1. goto e.g. mars overworld
  2. ensure you're in a place where water can be liquid
  3. place water source
  4. break block next to it

Scenario B

  1. goto moon
  2. find a underground village
  3. there you find liquid fuel and lava source blocks (each 2 source block next to each other)
  4. take a bucket and pickup one of the fuel sources

Expected behavior:
server should not crash

Screenshots:
n/a

Additional info:
issue can be resolved by using NBT explorer and editing the chunk in the mca file
removing the entries for the fluid_ticks

commented

Solution
in your FluidInteractionRegistryMixin class add a check if the blockstate is not air
if(!state.isAir()) ...

as its only one line i will not make a fork & merge request

@Mixin(FluidInteractionRegistry.class)
public class FluidInteractionRegistryMixin {

    @Inject(method = "canInteract", at = @At("HEAD"), cancellable = true, remap = false)
    private static void immersiveWeatheringDataFluidInteraction(Level level, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
        BlockState state = level.getBlockState(pos);

        if(!state.isAir()) {
            var f = ((LiquidBlock) state.getBlock()).getFluid();
            boolean lava = state.getFluidState().is(FluidTags.LAVA);
            var successPos = FluidGeneratorsHandler.applyGenerators(f,
                    FluidGeneratorsHandler.POSSIBLE_FLOW_DIRECTIONS, pos, level);
            if (successPos.isPresent()) {
                if (lava) {
                    level.levelEvent(1501, pos, 0);
                    // FluidBlo.fizz(level, successPos.get().getFirst());
                }
                cir.setReturnValue(false);
            }
        }
    }

}