Chicken-Bones / ForgeMultipart

An API for dynamically handling different functional parts in the one block space.
Other
119 stars 55 forks source link

NullPointerException in MicroRecipe$.matches from MicroMaterialRegistry$.getMaterial #382

Open alexbobp opened 8 years ago

alexbobp commented 8 years ago

I am getting this crash on startup, from a test world where I was testing changes to Easy Crafting: java.lang.NullPointerException: Ticking block entity at codechicken.microblock.MicroMaterialRegistry$.getMaterial(MicroMaterialRegistry.scala:228) at codechicken.microblock.MicroRecipe$.canCut(MicroRecipe.scala:152) at codechicken.microblock.MicroRecipe$.getThinningResult(MicroRecipe.scala:169) at codechicken.microblock.MicroRecipe$.getCraftingResult(MicroRecipe.scala:26) at codechicken.microblock.MicroRecipe$.matches(MicroRecipe.scala:18) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.isReplaceableInCraftingGridSlot(TileEntityAutoCrafting.java:139) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.verifyCraftability(TileEntityAutoCrafting.java:169) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.canInsertItem(TileEntityAutoCrafting.java:417) at net.minecraft.tileentity.TileEntityHopper.func_145885_a(TileEntityHopper.java:503) at net.minecraft.tileentity.TileEntityHopper.func_145899_c(TileEntityHopper.java:515) at net.minecraft.tileentity.TileEntityHopper.func_145889_a(TileEntityHopper.java:480) at net.minecraft.tileentity.TileEntityHopper.func_145883_k(TileEntityHopper.java:288) at net.minecraft.tileentity.TileEntityHopper.func_145887_i(TileEntityHopper.java:205) at net.minecraft.tileentity.TileEntityHopper.updateEntity(TileEntityHopper.java:190) at net.minecraft.world.World.updateEntities(World.java:1939) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:489) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:636) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

I am not sure if this is a forge multipart bug or if it is something I'm doing wrong in my Easy Crafting changes, I'm newish to minecraft modding, but my gut tells me you wouldn't want a recipe's .matches to ever throw an exception.

alexbobp commented 8 years ago

I seem to be able to reproduce it by laying out a recipe involving forge microblocks on the easy crafting table, and leaving it jammed trying to find blocks to cut. The easy crafting table (with my changes) will check, when a hopper tries to insert an item, if that item is a valid substitute for the missing crafting ingredient in the given recipe. Ultimately, it seems like MicroMaterialRegistry$.getMaterial crashes when triggered immediately upon server startup, in this case, due to hoppers trying to insert items into an auto crafting table. java.lang.NullPointerException: Ticking block entity at codechicken.microblock.MicroMaterialRegistry$.getMaterial(MicroMaterialRegistry.scala:228) at codechicken.microblock.MicroRecipe$.canCut(MicroRecipe.scala:152) at codechicken.microblock.MicroRecipe$.getThinningResult(MicroRecipe.scala:169) at codechicken.microblock.MicroRecipe$.getCraftingResult(MicroRecipe.scala:26) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.isReplaceableInCraftingGridSlot(TileEntityAutoCrafting.java:139) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.verifyCraftability(TileEntityAutoCrafting.java:169) at net.lepko.easycrafting.core.block.TileEntityAutoCrafting.canInsertItem(TileEntityAutoCrafting.java:417) at net.minecraft.tileentity.TileEntityHopper.func_145885_a(TileEntityHopper.java:503) at net.minecraft.tileentity.TileEntityHopper.func_145899_c(TileEntityHopper.java:515) at net.minecraft.tileentity.TileEntityHopper.func_145889_a(TileEntityHopper.java:480) at net.minecraft.tileentity.TileEntityHopper.func_145883_k(TileEntityHopper.java:288) at net.minecraft.tileentity.TileEntityHopper.func_145887_i(TileEntityHopper.java:205) at net.minecraft.tileentity.TileEntityHopper.updateEntity(TileEntityHopper.java:190) at net.minecraft.world.World.updateEntities(World.java:1939) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:489) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:636) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

alexbobp commented 8 years ago

This is probably reproducible without using easy crafting but the easiest way to repro would be to use my easy crafting fork: https://github.com/alexbobp/EasyCrafting

1) place an easy crafting table and lay out a forge microblocks block cutting recipe 2) give the easy crafting table at least one saw 3) connect hoppers to the easy crafting table and provide the WRONG blocks 4) wait for the easy crafting table to fill up (except for the slot it reserves waiting for the correct block) 5) restart the game and reload the map