MalisisDoors

MalisisDoors

48M Downloads

Nullpointer exception when rendering Structures in minecraft with malisis doors.

Raycoms opened this issue · 11 comments

commented

Hello, I'm from the minecolonies mod team and we're using the renderStructure method to prerender our buildings.
Unfortunately, it seems like malisis doors isn't support these operations with the vanilla methods:

java.lang.NullPointerException: Unexpected error
	at net.minecraft.tileentity.TileEntity.func_145839_a(TileEntity.java:65)
	at net.malisis.doors.tileentity.DoorTileEntity.func_145839_a(DoorTileEntity.java:364)
	at com.structures.helpers.Structure.renderStructure(Structure.java:253)
	at com.structures.event.RenderEventHandler.onRenderWorldLast(RenderEventHandler.java:54)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_902_RenderEventHandler_onRenderWorldLast_RenderWorldLastEvent.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185)
	at net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(ForgeHooksClient.java:166)
	at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1400)
	at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1229)
	at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1038)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1076)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371)
	at net.minecraft.client.main.Main.main(SourceFile:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:236)
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:297)
	at org.multimc.EntryPoint.listen(EntryPoint.java:162)
	at org.multimc.EntryPoint.main(EntryPoint.java:53)
commented

I don't know the mod, but it seems it's a Structures bug. Apparently it gives a null NBT compound to TileEntity.readFromNBT()

commented

Yeah but without the Malisis door mod this never happens.

commented

I'm pretty sure this crash would happen if chest is present in the structure.

commented

Without the malisisDoors mod it doesn't happen, even with chests in the
structure.

2016-11-11 19:08 GMT-02:00 Ordinastie [email protected]:

I'm pretty sure this crash would happen if chest is present in the
structure.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#114 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGI9y2k7ilGLbzpQEBbx70qIzsxsELoSks5q9NlngaJpZM4KwG6u
.

commented

Like I said, it's that structure mod's fault. And because you didn't give a full log, I can't even check what mod it is and if it's open source.

commented

It's not a mod it's minecraft code =D.

These new structure blocks minecraft added.

2016-11-11 19:27 GMT-02:00 Ordinastie [email protected]:

Like I said, it's that structure mod's fault. And because you didn't give
a full log, I can't even check what mod it is and if it's open source.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#114 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGI9y90YMhAF1LuRbfV0NLfRROAWIeguks5q9N20gaJpZM4KwG6u
.

commented

No, that's not Vanilla Minecraft...

    at com.structures.helpers.Structure.renderStructure(Structure.java:253)
    at com.structures.event.RenderEventHandler.onRenderWorldLast(RenderEventHandler.java:54)

As you don't seem to be willing to give full log, I'll just close the issue with "Not responsible for the crash".

commented

It's basically a copy of the minecraft structure code that's why I said it
is minecraft code.

/**

  • Renders the structure.

  • @param startingPos the start pos to render.

  • @param clientWorld the world of the client.

  • @param player the player object.

  • @param partialTicks the partial ticks.
    */
    public void renderStructure(@NotNull BlockPos startingPos, @NotNull
    final World clientWorld, @NotNull final EntityPlayer player, final
    float partialTicks)
    {
    Template.BlockInfo[] blockList =
    this.getBlockInfoWithSettings(this.settings);
    Entity[] entityList = this.getEntityInfoWithSettings(clientWorld,
    startingPos, this.settings);

    for (final Template.BlockInfo aBlockList : blockList)
    {
    Block block = aBlockList.blockState.getBlock();
    IBlockState iblockstate = aBlockList.blockState;
    BlockPos blockpos = aBlockList.pos.add(startingPos);
    IBlockState iBlockExtendedState =
    block.getExtendedState(iblockstate, clientWorld, blockpos);
    IBakedModel ibakedmodel =
    Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(iblockstate);
    TileEntity tileentity = null;
    if (block.hasTileEntity(iblockstate))
    {
    tileentity = block.createTileEntity(clientWorld, iblockstate);
    tileentity.readFromNBT(aBlockList.tileentityData);
    }
    ModelHolder models = new ModelHolder(blockpos, iblockstate,
    iBlockExtendedState, tileentity, ibakedmodel);
    this.getQuads(models, models.quads);
    this.renderGhost(clientWorld, models, player, partialTicks);
    }

    for (final Entity anEntityList : entityList)
    {
    Minecraft.getMinecraft().getRenderManager().renderEntityStatic(anEntityList,
    0.0F, true);
    }
    }

the line 253 is: tileentity.readFromNBT(aBlockList.tileentityData);

the full log is here:ldtteam/minecolonies#274

2016-11-12 6:36 GMT-02:00 Ordinastie [email protected]:

No, that's not Vanilla Minecraft...

at com.structures.helpers.Structure.renderStructure(Structure.java:253)
at com.structures.event.RenderEventHandler.onRenderWorldLast(RenderEventHandler.java:54)

As you don't seem to be willing to give full log, I'll just close the
issue with "Not responsible for the crash".


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#114 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGI9y2WLPBgX4e81PvGmbO1X-RR8pOHdks5q9Xp_gaJpZM4KwG6u
.

commented

And you're passing a null compound when you shouldn't. I guarantee you that if you pass null for chests too, it will also crash.
Don't pass null NBT compound.

[Edit : I just found out your code on Github, please use proper package naming conventions. Also, please refactor out all the arrays non-sense and use lists instead (especially when you're already given one).]

commented

Like I said, it always worked without a problem. Works with chests and
doors and everything, but with your mod.
And I don't get where I'm passing a null?

2016-11-12 10:16 GMT-02:00 Ordinastie [email protected]:

And you're passing a null compound when you shouldn't. I guarantee you
that if you pass null for chests too, it will also crash.
Don't pass null NBT compound.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#114 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGI9yxmVkLQ15CMZkbG2-aUnvGP6oomsks5q9a4agaJpZM4KwG6u
.

commented

tileentity.readFromNBT(aBlockList.tileentityData);

Vanilla doors don't have TileEntities, so, since you get the data from vanilla Template, I assume the original block for the doors don't have it either. Check for null before calling the method.