Project Red - Fabrication

Project Red - Fabrication

19M Downloads

IC chip cheated from NEI has invalid NBT

SonoSooS opened this issue · 7 comments

commented

I have Waila installed, and when I place down an IC chip cheated from NEI, it kicks me out with the following printed in the server console:

[14:25:06] [Server thread/ERROR] [FML/]: FMLIndexedMessageCodec exception caught
io.netty.handler.codec.EncoderException: java.lang.NullPointerException
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler.sendTo(WailaPacketHandler.java:82) [WailaPacketHandler.class:?]
    at mcp.mobius.waila.network.Message0x01TERequest.channelRead0(Message0x01TERequest.java:150) [Message0x01TERequest.class:?]
    at mcp.mobius.waila.network.Message0x01TERequest.channelRead0(Message0x01TERequest.java:27) [Message0x01TERequest.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:git-Cauldron-Reloaded-1.7.10-1.1388.1.0]
    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) [ej.class:?]
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:980) [MinecraftServer.class:?]
    at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:430) [lt.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0-ea]
Caused by: java.lang.NullPointerException
    at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:371) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagList.func_74734_a(NBTTagList.java:32) ~[dq.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:376) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31) ~[dh.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_150663_a(CompressedStreamTools.java:149) ~[du.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_74800_a(CompressedStreamTools.java:139) ~[du.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_74798_a(CompressedStreamTools.java:82) ~[du.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler.writeNBT(WailaPacketHandler.java:94) ~[WailaPacketHandler.class:?]
    at mcp.mobius.waila.network.Message0x02TENBTData.encodeInto(Message0x02TENBTData.java:23) ~[Message0x02TENBTData.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler$WailaCodec.encodeInto(WailaPacketHandler.java:69) ~[WailaPacketHandler$WailaCodec.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler$WailaCodec.encodeInto(WailaPacketHandler.java:55) ~[WailaPacketHandler$WailaCodec.class:?]
    at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:git-Cauldron-Reloaded-1.7.10-1.1388.1.0]
    at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]
    ... 27 more
[14:25:06] [Server thread/ERROR] [FML/]: There was a critical exception handling a packet on channel Waila
io.netty.handler.codec.EncoderException: java.lang.NullPointerException
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler.sendTo(WailaPacketHandler.java:82) ~[WailaPacketHandler.class:?]
    at mcp.mobius.waila.network.Message0x01TERequest.channelRead0(Message0x01TERequest.java:150) ~[Message0x01TERequest.class:?]
    at mcp.mobius.waila.network.Message0x01TERequest.channelRead0(Message0x01TERequest.java:27) ~[Message0x01TERequest.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:git-Cauldron-Reloaded-1.7.10-1.1388.1.0]
    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) [ej.class:?]
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:980) [MinecraftServer.class:?]
    at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:430) [lt.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0-ea]
Caused by: java.lang.NullPointerException
    at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:371) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagList.func_74734_a(NBTTagList.java:32) ~[dq.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:376) ~[dh.class:?]
    at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31) ~[dh.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_150663_a(CompressedStreamTools.java:149) ~[du.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_74800_a(CompressedStreamTools.java:139) ~[du.class:?]
    at net.minecraft.nbt.CompressedStreamTools.func_74798_a(CompressedStreamTools.java:82) ~[du.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler.writeNBT(WailaPacketHandler.java:94) ~[WailaPacketHandler.class:?]
    at mcp.mobius.waila.network.Message0x02TENBTData.encodeInto(Message0x02TENBTData.java:23) ~[Message0x02TENBTData.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler$WailaCodec.encodeInto(WailaPacketHandler.java:69) ~[WailaPacketHandler$WailaCodec.class:?]
    at mcp.mobius.waila.network.WailaPacketHandler$WailaCodec.encodeInto(WailaPacketHandler.java:55) ~[WailaPacketHandler$WailaCodec.class:?]
    at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:git-Cauldron-Reloaded-1.7.10-1.1388.1.0]
    at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]
    ... 27 more

And when the other player loads the chunk this block is in, the server prints this out:

[14:23:06] [File IO Thread/WARN] [/]: java.lang.NullPointerException
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:371)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagList.func_74734_a(NBTTagList.java:32)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:376)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagList.func_74734_a(NBTTagList.java:32)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:376)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:376)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.NBTTagCompound.func_74734_a(NBTTagCompound.java:31)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.CompressedStreamTools.func_150663_a(CompressedStreamTools.java:149)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.nbt.CompressedStreamTools.func_74800_a(CompressedStreamTools.java:139)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.world.chunk.storage.AnvilChunkLoader.func_75821_a(AnvilChunkLoader.java:286)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.world.chunk.storage.AnvilChunkLoader.func_75814_c(AnvilChunkLoader.java:272)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.world.storage.ThreadedFileIOBase.func_75736_b(SourceFile:30)
[14:23:06] [File IO Thread/WARN] [/]:   at net.minecraft.world.storage.ThreadedFileIOBase.run(SourceFile:23)
[14:23:06] [File IO Thread/WARN] [/]:   at java.lang.Thread.run(Unknown Source)

I'm using Cauldron server with Forge#1388 with MrTJPCore-1.1.0.31 with all ProjectRed-1.7.10-4.7.0pre8.92 addons, including ProjectRed-1.7.10-4.7.0pre8.92-Fabrication that has this error in it.

The problem is in ProjectRed/src/mrtjp/projectred/fabrication/items.scala#298, where you don't give the ItemStack a valid stackTagCompound.

I don't know Scala, so I'll write an example fix in Java

@Override
public void getSubItems(Item item, CreativeTabs tab, List list)
{
    NBTTagCompound comp = new NBTTagCompound();
    ItemStack is = new ItemStack(this, 1, 0);
    this.writeSomeDummyData(comp);
    is.stackTagCompound = comp;
    list.add(is);

    is = new ItemStack(this, 1, 1);
    comp = new NBTTagCompound();
    this.writeSomeDummyData(comp);
    is.stackTagCompound = comp;
    list.add(is);
}
commented

this seems to happen you pull one out of creative mode and try to place it.

commented

Placing an empty IC should not be possible, right clicking a blank one should simply not do anything... Is this not the case?

commented

think you can, and it does crash the world, but when you re-enter the gate
is gone.

(: Jonathan :)

On Sat, Oct 24, 2015 at 12:12 PM, MrTJP [email protected] wrote:

Placing an empty IC should not be possible, right clicking a blank one
should simply not do anything... Is this not the case?


Reply to this email directly or view it on GitHub
#916 (comment).

commented

Or you could just override getSubBlocks to add nothing to the list, so the invalid IC block won't show up (also, I can't find where the IC block is defined). Or you could make it so the default IC block behaves as a bundled null-cell.

commented

I just cheated in an IC from NEI and didn't find a problem. Simply take the chip, write to it, and craft it into a gate and it works perfectly. The creative mode chip can be placed directly without crafting it into an actual gate, but that too is only possible once you write to it.

commented

I might be wrong, but... Are empty ICs meant to be placeable at all?
They cannot be crafted and have no use.
The only reason I see for them to show up in NEI is for crafting recipe, but pressing R on them does not show any.

commented

you must craft it using your ic chip in the middle and circuit plate