Jump to content

[Solved][1.15.2] FlowingFluidBlock: Exception while updating neighbours


Recommended Posts

Posted (edited)

Can't understand why I get a NullPointerException. The line 59 mentioned in the crash report is the first if statement. I've used .getOrCreate() just to avoid the null value .get() could return. This isn't the only check of this type around the mod and the others work fine.

 

Code

Spoiler

 @Override
    public boolean reactWithNeighbors(World worldIn, BlockPos pos, BlockState state) {
        ResourceLocation mudTag = new ResourceLocation(EarthtojavamobsMod.MOD_ID, "mud");
        if (this.fluid.isIn(FluidTags.getCollection().getOrCreate(mudTag))) { // <-- line 59
            boolean flag = false;
            for (Direction direction : Direction.values()) {
                if (worldIn.getFluidState(pos.offset(direction)).isTagged(FluidTags.LAVA)) {
                    flag = true;
                    break;
                }
            }
            if (flag) {
                worldIn.setBlockState(pos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(worldIn, pos, pos, Blocks.DIRT.getDefaultState()));
                this.triggerMixEffects(worldIn, pos);
                return false;
            }
        }
        return true;
    }

 

 

CrashReport

Spoiler

---- Minecraft Crash Report ---- // Don't do that. Time: 13/06/20 13.10 Description: Exception while updating neighbours java.lang.NullPointerException: Exception while updating neighbours at net.slexom.earthtojavamobs.fluid.MudFlowingFluidBlock.reactWithNeighbors(MudFlowingFluidBlock.java:59) ~[?:?] {re:classloading} at net.minecraft.block.FlowingFluidBlock.neighborChanged(FlowingFluidBlock.java:138) ~[?:?] {re:classloading,xf:fml:forge:flowingfluidblock} at net.minecraft.block.BlockState.neighborChanged(BlockState.java:244) ~[?:?] {re:classloading} at net.minecraft.world.World.neighborChanged(World.java:359) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.notifyNeighborsOfStateChange(World.java:319) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.notifyNeighbors(World.java:303) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.markAndNotifyBlock(World.java:246) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.setBlockState(World.java:222) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.setBlockState(World.java:293) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.block.FlowingFluidBlock.reactWithNeighbors(FlowingFluidBlock.java:164) ~[?:?] {re:classloading,xf:fml:forge:flowingfluidblock} at net.minecraft.block.FlowingFluidBlock.onBlockAdded(FlowingFluidBlock.java:117) ~[?:?] {re:classloading,xf:fml:forge:flowingfluidblock} at net.minecraft.block.BlockState.onBlockAdded(BlockState.java:266) ~[?:?] {re:classloading} at net.minecraft.world.chunk.Chunk.setBlockState(Chunk.java:287) ~[?:?] {re:classloading} at net.minecraft.world.World.setBlockState(World.java:209) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.fluid.FlowingFluid.flowInto(FlowingFluid.java:248) ~[?:?] {re:classloading} at net.minecraft.fluid.LavaFluid.flowInto(LavaFluid.java:174) ~[?:?] {re:classloading} at net.minecraft.fluid.FlowingFluid.func_207937_a(FlowingFluid.java:150) ~[?:?] {re:classloading} at net.minecraft.fluid.FlowingFluid.flowAround(FlowingFluid.java:129) ~[?:?] {re:classloading} at net.minecraft.fluid.FlowingFluid.tick(FlowingFluid.java:417) ~[?:?] {re:classloading} at net.minecraft.fluid.IFluidState.tick(IFluidState.java:68) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerWorld.tickFluid(ServerWorld.java:589) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerTickList.tick(ServerTickList.java:86) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:320) ~[?:?] {re:classloading} at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at net.slexom.earthtojavamobs.fluid.MudFlowingFluidBlock.reactWithNeighbors(MudFlowingFluidBlock.java:59) at net.minecraft.block.FlowingFluidBlock.neighborChanged(FlowingFluidBlock.java:138) at net.minecraft.block.BlockState.neighborChanged(BlockState.java:244) -- Block being updated -- Details: Source block type: ID #minecraft:lava (block.minecraft.lava // net.minecraft.block.FlowingFluidBlock) Block: Block{earthtojavamobs:mud_fluid}[level=1] Block location: World: (-173,63,-61), Chunk: (at 3,3,3 in -11,-4; contains blocks -176,0,-64 to -161,255,-49), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Stacktrace: at net.minecraft.world.World.neighborChanged(World.java:359) at net.minecraft.world.World.notifyNeighborsOfStateChange(World.java:319) at net.minecraft.world.World.notifyNeighbors(World.java:303) at net.minecraft.world.World.markAndNotifyBlock(World.java:246) at net.minecraft.world.World.setBlockState(World.java:222) at net.minecraft.world.World.setBlockState(World.java:293) at net.minecraft.block.FlowingFluidBlock.reactWithNeighbors(FlowingFluidBlock.java:164) at net.minecraft.block.FlowingFluidBlock.onBlockAdded(FlowingFluidBlock.java:117) at net.minecraft.block.BlockState.onBlockAdded(BlockState.java:266) at net.minecraft.world.chunk.Chunk.setBlockState(Chunk.java:287) at net.minecraft.world.World.setBlockState(World.java:209) at net.minecraft.fluid.FlowingFluid.flowInto(FlowingFluid.java:248) at net.minecraft.fluid.LavaFluid.flowInto(LavaFluid.java:174) at net.minecraft.fluid.FlowingFluid.func_207937_a(FlowingFluid.java:150) at net.minecraft.fluid.FlowingFluid.flowAround(FlowingFluid.java:129) at net.minecraft.fluid.FlowingFluid.tick(FlowingFluid.java:417) at net.minecraft.fluid.IFluidState.tick(IFluidState.java:68) at net.minecraft.world.server.ServerWorld.tickFluid(ServerWorld.java:589) -- Block being ticked -- Details: Block location: World: (-173,63,-63), Chunk: (at 3,3,1 in -11,-4; contains blocks -176,0,-64 to -161,255,-49), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Stacktrace: at net.minecraft.world.server.ServerTickList.tick(ServerTickList.java:86) at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:320) -- Affected level -- Details: All players: 1 total; [ServerPlayerEntity['Dev'/383, l='Nuovo mondo', x=-173.37, y=64.00, z=-61.17]] Chunk stats: ServerChunkCache: 2025 Level dimension: DimensionType{minecraft:overworld} Level name: Nuovo mondo Level seed: -2516639339047440122 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: {} Level spawn location: World: (-169,63,-48), Chunk: (at 7,3,0 in -11,-3; contains blocks -176,0,-48 to -161,255,-33), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Level time: 603195 game time, 4131 day time Known server brands: forge Level was modded: true Level storage version: 0x04ABD - Anvil Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.15.2 Minecraft Version ID: 1.15.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_231, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 208142920 bytes (198 MB) / 858259456 bytes (818 MB) up to 1763704832 bytes (1682 MB) CPUs: 4 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 5.1.0+69+master.79f13f7 ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /eventbus-2.2.0-service.jar eventbus PLUGINSERVICE /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE FML: 31.2 Forge: net.minecraftforge:31.2.0 FML Language Providers: [email protected] minecraft@1 Mod List: client-extra.jar Minecraft {[email protected] DONE} forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar Forge {[email protected] DONE} main Earth2Java Mobs {[email protected] DONE} Player Count: 1 / 8; [ServerPlayerEntity['Dev'/383, l='Nuovo mondo', x=-173.37, y=64.00, z=-61.17]] Data Packs: vanilla, mod:forge (incompatible), mod:earthtojavamobs Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'forge'

 

Edited by Slexom
Solved

My mod:

Earth2Java - Mobs [1.15.2]

 

Posted

Before making changes on how register things on the mod I was using the constructor without the supplier. Now I'm using the supplier and inside the constructor code there is this.fluid = null; . That's what generate the error.

Close or delete this if you want.

My mod:

Earth2Java - Mobs [1.15.2]

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.