Alex's Mobs

Alex's Mobs

72M Downloads

Error on Server when Mungus explodes

JoshHawley opened this issue ยท 0 comments

commented

I'm having trouble with the mungus in the modpack that I created/maintain (CrewTowns). Whenever they explode, there is a server side error, and the biome does not change. This happens with the default type (red mushroom -> mushroom fields), and the types I added (cobweb -> ominous woods)

Here is the config:

#0 = no mungus biome transformation. 1 = mungus changes blocks, but not chunk's biome. 2 = mungus transforms blocks and biome of chunk.
    #Range: 0 ~ 2
    mungusBiomeTransformationType = 2
    #List of all mungus mushrooms, biome transformations and surface blocks. Each is seperated by a |. Add an entry with a block registry name, biome registry name, and block registry name(for the ground).
    mungusBiomeMatches = ["minecraft:poppy|minecraft:plains|minecraft:grass_block", "minecraft:dead_bush|minecraft:desert|minecraft:sand", "minecraft:cobweb|biomesoplenty:ominous_woods|minecraft:grass_block", "minecraft:red_mushroom|minecraft:mushroom_fields|minecraft:mycelium", "minecraft:brown_mushroom|minecraft:mushroom_fields|minecraft:mycelium", "minecraft:crimson_fungus|minecraft:crimson_forest|minecraft:crimson_nylium", "minecraft:warped_fungus|minecraft:warped_forest|minecraft:warped_nylium"]

The error seems to be a forge registry look up issue

java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because the return value of "net.minecraftforge.registries.IForgeRegistry.getKey(Object)" is null
        at TRANSFORMER/[email protected]/com.github.alexthe666.alexsmobs.entity.EntityMungus.transformBiome(EntityMungus.java:352)
at TRANSFORMER/[email protected]/com.github.alexthe666.alexsmobs.entity.EntityMungus.explode(EntityMungus.java:257)
        at TRANSFORMER/[email protected]/com.github.alexthe666.alexsmobs.entity.EntityMungus.m_6153_(EntityMungus.java:205)
        at TRANSFORMER/[email protected]/net.minecraft.world.entity.LivingEntity.m_6075_(LivingEntity.java:397)
        at TRANSFORMER/[email protected]/net.minecraft.world.entity.Mob.m_6075_(Mob.java:252)
        at TRANSFORMER/[email protected]/com.github.alexthe666.alexsmobs.entity.EntityMungus.m_6075_(EntityMungus.java:171)
        at TRANSFORMER/[email protected]/net.minecraft.world.entity.Entity.m_8119_(Entity.java:417)
        at TRANSFORMER/[email protected]/net.minecraft.world.entity.LivingEntity.m_8119_(LivingEntity.java:2252)
        at TRANSFORMER/[email protected]/net.minecraft.world.entity.Mob.m_8119_(Mob.java:318)
        at TRANSFORMER/[email protected]/com.github.alexthe666.alexsmobs.entity.EntityMungus.m_8119_(EntityMungus.java:161)
        at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.track(ServerLevel.java:8740)
        at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.redirect$bkc000$onTickNonPassenger(ServerLevel.java:8756)
        at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.m_8647_(ServerLevel.java:658)
        at TRANSFORMER/[email protected]/net.minecraft.world.level.Level.m_46653_(Level.java:457)
        at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.m_184063_(ServerLevel.java:323)
        at TRANSFORMER/[email protected]/net.minecraft.world.level.entity.EntityTickList.m_156910_(EntityTickList.java:54)
        at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:303)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:866)
        at TRANSFORMER/[email protected]/net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244)
        at java.base/java.lang.Thread.run(Thread.java:833)

Looking into the code at this section in EntityMungus.java:

int id = this.getId();
setChunkBiomes(chunk, container);
AlexsMobs.sendMSGToAll(new MessageMungusBiomeChange(this.getId(), pos.getX(), pos.getZ(), ForgeRegistries.BIOMES.getKey(biome.value()).toString()));

The call to ForgeRegistries.BIOMES.getKey is returning a null, so I'm assuming there is something wrong with biome.value().
From what i can tell, the biome object is looked up by the mushroom type, and when it is not found, it returns null.

I searched the logs for possible errors and verified the biome IDs, but I cannot find anything else wrong.

Please help.