mactso / Regrowth

Creatures eat/destroy or grow grass as they move around.
MIT License
1 stars 5 forks source link

Exception caught during firing event: null #12

Closed Muintoll closed 3 years ago

Muintoll commented 3 years ago

Forge Version : 3.1.16 Minecraft Version: 1.16.5

After a couple of hours of playing on Centos 7 server with a couple of friends server crashed and and showed me this in logs:

[22:40:18] [Server thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: null
        Index: 1
        Listeners:
                0: NORMAL
                1: ASM: com.mactso.regrowth.events.MoveEntityEvent@7fd1a809 doEntityMove(Lnet/minecraftforge/event/entity/living                                                                   /LivingEvent$LivingUpdateEvent;)V
java.lang.NullPointerException
        at net.minecraft.world.chunk.Chunk.func_201576_a(Chunk.java:356)
        at net.minecraft.world.World.func_201676_a(World.java:360)
        at net.minecraft.world.IWorldReader.func_205770_a(IWorldReader.java:67)
        at net.minecraft.world.IBiomeReader.func_205770_a(SourceFile:32)
        at net.minecraft.world.gen.feature.RandomPatchFeature.func_241855_a(SourceFile:24)
        at net.minecraft.world.gen.feature.RandomPatchFeature.func_241855_a(SourceFile:14)
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_242772_a(SourceFile:23)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:272)
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:22)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:14)
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_242772_a(SourceFile:23)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
        at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
        at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:22)
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:14)
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55)
        at corgiaoc.byg.common.properties.blocks.BYGGrassBlock.func_225535_a_(BYGGrassBlock.java:55)
        at com.mactso.regrowth.events.MoveEntityEvent.doMobRegrowthEvents(MoveEntityEvent.java:337)
        at com.mactso.regrowth.events.MoveEntityEvent.doEntityMove(MoveEntityEvent.java:175)
        at net.minecraftforge.eventbus.ASMEventHandler_116_MoveEntityEvent_doEntityMove_LivingUpdateEvent.invoke(.dynamic)
        at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
        at net.minecraftforge.common.ForgeHooks.onLivingUpdate(ForgeHooks.java:339)
        at net.minecraft.entity.LivingEntity.func_70071_h_(LivingEntity.java:2112)
        at net.minecraft.entity.MobEntity.func_70071_h_(MobEntity.java:300)
        at net.minecraft.world.server.ServerWorld.func_217479_a(ServerWorld.java:611)
        at net.minecraft.world.World.func_217390_a(World.java:554)
        at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:404)
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:851)
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:291)
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:787)
        at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642)
        at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232)
        at java.lang.Thread.run(Thread.java:748)

[22:40:18] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 2f0a9e16-d6ed-44e1-80a3-351aba343a04
[22:40:18] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Ticking entity
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:855) ~[?:?] {re:mixin,pl:accesstransformer:B,p                                                                   l:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:                                                                   A,pl:runtimedistcleaner:A}
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:291) ~[?:?] {re:classloading,pl:acce                                                                   sstransformer:B}
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:787) ~[?:?] {re:mixin,pl:accesstransformer:B,p                                                                   l:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:                                                                   A,pl:runtimedistcleaner:A}
        at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) ~[?:?] {re:mixin,pl:accesstransformer:B                                                                   ,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixi                                                                   n:A,pl:runtimedistcleaner:A}
        at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:mixin,pl:accesstransformer:B                                                                   ,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixi                                                                   n:A,pl:runtimedistcleaner:A}
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262] {}
Caused by: java.lang.NullPointerException
        at net.minecraft.world.chunk.Chunk.func_201576_a(Chunk.java:356) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
        at net.minecraft.world.World.func_201676_a(World.java:360) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner                                                                   :A,re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
        at net.minecraft.world.IWorldReader.func_205770_a(IWorldReader.java:67) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:clas                                                                   sloading,pl:runtimedistcleaner:A}
        at net.minecraft.world.IBiomeReader.func_205770_a(SourceFile:32) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.RandomPatchFeature.func_241855_a(SourceFile:24) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.RandomPatchFeature.func_241855_a(SourceFile:14) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_242772_a(SourceFile:23) ~[?:?] {re:classloading}
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:1.8.0_262] {}
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419) ~[?:1.8.0_262] {}
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647) ~[?:1.8.0_262] {}
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:272) ~[?:1.8.0_262] {}
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_262] {}
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:1.8.0_262] {}
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_262] {}
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) ~[?:1.8.0_262] {}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:22) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:14) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_242772_a(SourceFile:23) ~[?:?] {re:classloading}
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:1.8.0_262] {}
        at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_262] {}
        at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_262] {}
        at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_262] {}
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:1.8.0_262] {}
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:1.8.0_262] {}
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_262] {}
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) ~[?:1.8.0_262] {}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:22) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.DecoratedFeature.func_241855_a(SourceFile:14) ~[?:?] {re:classloading}
        at net.minecraft.world.gen.feature.ConfiguredFeature.func_242765_a(SourceFile:55) ~[?:?] {re:classloading}
        at corgiaoc.byg.common.properties.blocks.BYGGrassBlock.func_225535_a_(BYGGrassBlock.java:55) ~[byg:1.2.7] {re:classloadi                                                                   ng}
        at com.mactso.regrowth.events.MoveEntityEvent.doMobRegrowthEvents(MoveEntityEvent.java:337) ~[regrowth:1.16.4-1.35.0.18]                                                                    {re:classloading}
        at com.mactso.regrowth.events.MoveEntityEvent.doEntityMove(MoveEntityEvent.java:175) ~[regrowth:1.16.4-1.35.0.18] {re:cl                                                                   assloading}
        at net.minecraftforge.eventbus.ASMEventHandler_116_MoveEntityEvent_doEntityMove_LivingUpdateEvent.invoke(.dynamic) ~[?:?                                                                   ] {}
        at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
        at net.minecraftforge.common.ForgeHooks.onLivingUpdate(ForgeHooks.java:339) ~[forge:?] {re:classloading}
        at net.minecraft.entity.LivingEntity.func_70071_h_(LivingEntity.java:2112) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:c                                                                   lassloading,pl:mixin:APP:pmmo.mixins.json:LivingEntityChangeRespirationMixin,pl:mixin:A,pl:runtimedistcleaner:A}
        at net.minecraft.entity.MobEntity.func_70071_h_(MobEntity.java:300) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:ru                                                                   ntimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}
        at net.minecraft.world.server.ServerWorld.func_217479_a(ServerWorld.java:611) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,r                                                                   e:classloading,pl:runtimedistcleaner:A}
        at net.minecraft.world.World.func_217390_a(World.java:554) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner                                                                   :A,re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
        at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:404) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re                                                                   :classloading,pl:runtimedistcleaner:A}
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:851) ~[?:?] {re:mixin,pl:accesstransformer:B,p                                                                   l:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:                                                                   A,pl:runtimedistcleaner:A}
        ... 5 more

I suppose the crash was caused by Regrowth, maybe one of the villagers did an action that didn't work well, but after restarting the server world goes a couple of ticks back and works okay till the villager's bugged action happens again.

I can provide the actual logs and mods that we used if that's needed, maybe it's just a conflict between the mods.

mactso commented 3 years ago

Thanks for the feedback. I'll give it a look and give you some feedback within 24 hours.

As a quick response: It looks like it occurs when a skeleton tries to grow a giant mushroom. So you can turn off that feature and the crash should stop.

It's probably interaction with another mod because we've never seen this error before. maybe an alternate grass block.

Please let me know if removing "mushroom" fixes it.

Jackiecrazy commented 3 years ago

I have the exact same crash, removing mushrooms does not fix it for me. I can no longer play my save because it crashes every few seconds. It appears to be Biomes You'll Go's grass blocks?

Darkmega18 commented 3 years ago

I have this also. :< here's a similar crash to do with grass and cows on them that I put in the linked byg issue also. https://pastebin.com/rjCkmJwx

mactso commented 3 years ago

I see the reference to BYGGrassBlock. I'll keep working on this. Hopefully soon. I've tested with BYG for hours without a problem so not sure what's up.

Darkmega18 commented 3 years ago

try every variant of grass they add and turn up the frequency of your stuff doing things so they do the thing eventually? I was hanging out in the plains for mine for a time and it didn't crash for a while. so it's probably not constant. but potentially once Jackie had it it kept happening cause of other animals or the animal trying to keep doing it's thing and crashing?

I know there was one of those big mountains with the stone based grass near me. and several types of glowy forest too.

do you try to eat from the stone grass and it can't figure out what to transform it to? since the herd of cows was close to the base of that mountain with the stone grass. But I'm not super sure on the mechanics you do with them.

mactso commented 3 years ago

That's some good feedback.

You should be able to safely disable regrowth and play your saved games until i get this fixed. I'm working on this and could have a fix any day. I might also be able to bulletproof the code so it handles the potential instead of propagating it upwards. That would help bulletproof it against future unknown blocks.

Darkmega18 commented 3 years ago

Just letting you know what I noticed. anything I can do to get a bug fixed.

I did like jackie and offed the animal based config and just kept the villager stuff going for now.

mactso commented 3 years ago

I've isolated the error

If you set debuglevel to 2, then you should see a message in the log like:

System.out.println(key + " trying to grow plants sat " + eX + ", " + eY + ", " + eZ + ".");

On the next line it refers to: (ServerWorld) eventEntity.world, eventEntity.world.rand, getBlockPos(eventEntity), eventEntity.world.getBlockState(getBlockPos(eventEntity)) One of these is null.
I've confirmed it can't be the world, or the blockpos so it is (unlikely) the random number generator or (likely) the block state of the block.

I'm going to bulletproof the code and expect to upload a fix tonight.

mactso commented 3 years ago

Okay, it turns out that only daffidils and poppies will grow on the overgrown (spreadable) stone and they grow a lot- like place that would be grass is a daffidil or a poppy.

I'm thinking I need to detect the spreadable stone and not grow on it. It's an odd little block that is sort of like a grass block and sort of not. And it's partially growable and partially not.

Permanent Fix is not likely tonight but I'll post a hotpatch that will hopefully block the crashes. Please let me know.. The side effect is they will eventually grow flowers (about every 4 minutes) and then eventually eat the flowers (about every 4 minutes after flowers are grown) and then sometimes convert the byg stone to normal minecraft dirt about 1/4th of the time when they eat the flowers (about once every 4 minutes).

Darkmega18 commented 3 years ago

well ok. when I get it I'll reset my config and get the animals doing their thing and I'll take a look. and I appreciate the keeping us up to date with your musings as you worked it out.

mactso commented 3 years ago

Lupicus dug into why this is happening and it looks like the BYG code is referencing a height map that only exists at WorldGen time when you call the grow() method.

I basically put on a belt, boots and suspenders. I put additional code at the top to avoid entering it. I added extra instrumentation (debug message) if debugging is turned on. I put a "try catch" block around to catch an exception if it occurs on the grow() attempt. I added extra debugging messages to identify if an exception occured.

Crossing my fingers.

Let me ask you... do you prefer that if animals grow flowers and eat them, they can slowly transform the grassy "overgrown rock" to dirt or that regrowth skip/ignore the grassy "overgrown rock"

mactso commented 3 years ago

Lupicus has updated the ticket at BYG.

Darkmega18 commented 3 years ago

Let me ask you... do you prefer that if animals grow flowers and eat them, they can slowly transform the grassy "overgrown rock" to dirt or that regrowth skip/ignore the grassy "overgrown rock"

the overgrown rock is kinda just a terrain feature of some of those special mountainous regions, it'd probably be fine that they don't try to grow stuff there if there is issues? just to keep the area uniform and stuff.

does it grow anything if you bonemeal it and stuff? I never actually tried. too busy wandering aimlessly and being slapped in the face with bugs in worlds that I did have some. :V if they eat flowers and stuff I think vibrant journeys in my pack can spawn rocks etc on it and I swear there was tall grass on it too. so if they can eat the tall grass or flowers and then bonemeal the area or something, thats fine, just don't eat the... hard mossy dirt grass stone... lol

mactso commented 3 years ago

Actually, if you bone meal it, it also crashes. It's the bug causing the crash. Apparently as of the may 6th release it refers to an object that only exists when a chunk is generated. So it's "null" at run time.

It can grow flowers when bonemealed even tho it has a null exception.

Darkmega18 commented 3 years ago

WELP, that sounds like an issue of itself also that they'll need to patch up...

mactso commented 3 years ago

It is but when a player does it, it catches the exception and prints it to the log instead of crashing. So probably low priority for them.

Is it working again for you? It's working in my test environment so if it is working for you guys, I'll close the issue.

Darkmega18 commented 3 years ago

it seems fine. hopefully. :) although haven't given it a real good go yet cause of issues with server side lag when trying to play with friends cause other reasons.

mactso commented 3 years ago

Thanks for the feedback ! Going to close this one.