Jump to content

Raycoms

Members
  • Posts

    383
  • Joined

  • Last visited

Everything posted by Raycoms

  1. It's on github already: https://github.com/Minecolonies/minecolonies/blob/version/1.11/src/main/java/com/minecolonies/coremod/network/messages/SaveScanMessage.java
  2. Because when I remove the line where I store it in the buf and where I read it, it runs smoothly.
  3. nbtbase is null because it's trying to read the "storeLocation", a string I stored in the bytebuf. I still didn't figure out how I can stop the reading process as soon as the nbt is over. To read the string afterwards.
  4. As previously: Jan 01, 2017 9:09:17 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@1995b069(success) Jan 01, 2017 9:09:17 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@1995b069(success) Jan 01, 2017 9:09:17 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@1995b069(success) [21:09:17] [Netty Local Client IO #2/INFO] [minecolonies]: Structure too big to be processed java.lang.NullPointerException at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:578) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:52) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagList.read(NBTTagList.java:66) ~[NBTTagList.class:?] at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:578) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:52) ~[NBTTagCompound.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:147) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:102) ~[CompressedStreamTools.class:?] at com.minecolonies.coremod.network.messages.SaveScanMessage.fromBytes(SaveScanMessage.java:59) [saveScanMessage.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:36) [simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:26) [simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:103) [FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:40) [FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) [MessageToMessageCodec$2.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) [MessageToMessageDecoder.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.23.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:109) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:156) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:51) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:413) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:278) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:73) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:326) [LocalChannel.class:4.0.23.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:45) [LocalChannel.class:4.0.23.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:312) [LocalChannel$5.class:4.0.23.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.23.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
  5. Doesn't work with 50097152L either.
  6. You said I should do it like in the PacketBuffer, therefore, I moved everything whats happening there also into my method. (I'd eventually rename these variables). aand don't I have to create a big limit to make sure my structures are stored correctly? =D 2mb is the standard size but that wasn't enough obviously.
  7. @Override public void fromBytes(@NotNull final ByteBuf buf) { PacketBuffer buffer = new PacketBuffer(buf); int i = buffer.readerIndex(); byte b0 = buffer.readByte(); if(b0 != 0) { buffer.readerIndex(i); try (ByteBufInputStream stream = new ByteBufInputStream(buffer) { nbttagcompound = CompressedStreamTools.read(stream, new NBTSizeTracker(200097152L)); } catch (RuntimeException e) { Log.getLogger().info("Structure too big to be processed", e); } catch (IOException e) { Log.getLogger().info("Problem at retrieving structure on server.", e); } } storeLocation = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(@NotNull final ByteBuf buf) { ByteBufUtils.writeTag(buf, nbttagcompound); ByteBufUtils.writeUTF8String(buf, storeLocation); } Did I forget anything? Still not working...
  8. Ouch still forgetting that try with exists =D. @Override public void fromBytes(@NotNull final ByteBuf buf) { try(ByteBufInputStream stream = new ByteBufInputStream(buf) { nbttagcompound = CompressedStreamTools.read(stream, new NBTSizeTracker(200097152L)); } catch (RuntimeException e) { Log.getLogger().info("Structure too big to be processed", e); } catch (IOException e) { Log.getLogger().info("Problem at retrieving structure on server.", e); } //storeLocation = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(@NotNull final ByteBuf buf) { ByteBufUtils.writeTag(buf, nbttagcompound); //ByteBufUtils.writeUTF8String(buf, storeLocation); } I noticed that the problem is that I'm writing a string afterward. Therefore he is trying to create a tag out of the string during the execution and that's what nulls nbttag. But how can I prevent that from happening? Before isn't an option either. The only option is sending two separate messages?
  9. Exactly that line produces the nullpointer. I guessed because the nbtbase was empty. The IDE was upset about not closing =D
  10. There is: nbtbase.read(input, depth, sizeTracker); and nbtbase is empty. He creates nbtbase previously with: NBTBase nbtbase = NBTBase.createNewByType(id); with the id: 9 I also removed the PacketBuffer, didn't change anything. And we're closing the stream because we like to clean it up.
  11. @jeffryfisher I didn't really understand what you're trying to ask. The scan happens when the player right clicks with a tool a block. It will then be stored on his local pc. But to be stored we require server side elements like the serverWorld etc. @diesieben07: I did it like this now: @Override public void fromBytes(@NotNull final ByteBuf buf) { PacketBuffer pb = new PacketBuffer(buf); ByteBufInputStream stream = new ByteBufInputStream(pb); try { nbttagcompound = CompressedStreamTools.read(stream, new NBTSizeTracker(200097152L)); } catch (RuntimeException e) { Log.getLogger().info("Structure too big to be processed", e); } catch (IOException e) { Log.getLogger().info("Problem at retrieving structure on server.", e); } finally { try { stream.close(); } catch (IOException e) { Log.getLogger().info("Problem at retrieving structure on server.", e); } } storeLocation = ByteBufUtils.readUTF8String(buf); } and when it get's quite big this now happens: Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) Jan 01, 2017 4:24:44 PM io.netty.channel.ChannelOutboundBuffer safeSuccess WARNING: Failed to mark a promise as success because it is done already: DefaultChannelPromise@437402(success) [16:24:44] [Netty Local Client IO #0/INFO] [Minecolonies:blockout]: Structure too big to be processed java.lang.NullPointerException at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:578) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:52) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagList.read(NBTTagList.java:66) ~[NBTTagList.class:?] at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:578) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:52) ~[NBTTagCompound.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:147) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:102) ~[CompressedStreamTools.class:?] at com.minecolonies.coremod.network.messages.SaveScanMessage.fromBytes(SaveScanMessage.java:57) [saveScanMessage.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:36) [simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:26) [simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:103) [FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:40) [FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) [MessageToMessageCodec$2.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) [MessageToMessageDecoder.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.23.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:109) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:156) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:51) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:413) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:278) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:73) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:326) [LocalChannel.class:4.0.23.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:45) [LocalChannel.class:4.0.23.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:312) [LocalChannel$5.class:4.0.23.Final] at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.23.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112] Using forge version: forge_version=13.19.1.2189
  12. Great to hear =) Could you fill out the form on our website: http://www.minecolonies.com/welcome -> Become a Team Member so that we can invite you to our communication channel and github?
  13. We could also need some modelers for entities, items and blocks.
  14. We have updated to 1.11 already but a lot of players including our server is 1.10 still. Most mods aren't 1.11 yet, therefore most people play in 1.10 still.
  15. It always worked flawlessly only now in 1.11 it started to make problems (1.7-1.10 without any problems).
  16. We overwrote the custom minecraft fishing rod a while ago. Now in 1.11 it crashes on the following line: fishingSpeedEnchantment = EnchantmentHelper.getLureModifier(citizen); java.lang.NoSuchMethodError: net.minecraft.enchantment.EnchantmentHelper.func_151387_h(Lnet/minecraft/entity/EntityLivingBase;)I at com.minecolonies.coremod.entity.EntityFishHook.<init>(EntityFishHook.java:167) at com.minecolonies.coremod.entity.ai.citizen.fisherman.EntityAIWorkFisherman.throwRod(EntityAIWorkFisherman.java:527) at com.minecolonies.coremod.entity.ai.citizen.fisherman.EntityAIWorkFisherman.throwOrRetrieveHook(EntityAIWorkFisherman.java:499) at com.minecolonies.coremod.entity.ai.citizen.fisherman.EntityAIWorkFisherman.doFishing(EntityAIWorkFisherman.java:469) at com.minecolonies.coremod.entity.ai.citizen.fisherman.EntityAIWorkFisherman$$Lambda$268/904848120.get(Unknown Source) at com.minecolonies.coremod.entity.ai.util.AITarget.apply(AITarget.java:125) at com.minecolonies.coremod.entity.ai.basic.AbstractAISkeleton.applyTarget(AbstractAISkeleton.java:203) at com.minecolonies.coremod.entity.ai.basic.AbstractAISkeleton.checkOnTarget(AbstractAISkeleton.java:176) at com.minecolonies.coremod.entity.ai.basic.AbstractAISkeleton$$Lambda$222/807538661.test(Unknown Source) at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90) at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:529) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:516) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449) at com.minecolonies.coremod.entity.ai.basic.AbstractAISkeleton.func_75246_d(AbstractAISkeleton.java:129) at net.minecraft.entity.ai.EntityAITasks.func_75774_a(SourceFile:129) at net.minecraft.entity.EntityLiving.func_70626_be(EntityLiving.java:769) at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2255) at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:573) at net.minecraft.entity.EntityAgeable.func_70636_d(EntityAgeable.java:171) at com.minecolonies.coremod.entity.EntityCitizen.func_70636_d(EntityCitizen.java:808) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2085) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:296) at net.minecraft.world.World.func_72866_a(World.java:1961) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:840) at net.minecraft.world.World.func_72870_g(World.java:1931) at net.minecraft.world.World.func_72939_s(World.java:1747) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:621) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:720) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:624) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:149) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at java.lang.Thread.run(Thread.java:745) Can't explain what the problem is.
  17. Hey, We have some language strings like: entity.miner.messageNeedBlockAndItem=I need %s! entity.miner.messageMoreBlocks=I need more %s! which we call like this: LanguageHandler.sendPlayersMessage( colony.getMessageEntityPlayers(), LanguageHandler.format(this.getColonyJob().getName()) + " " + this.getCustomNameTag() + ": " + msg); where msg is one of the above keys. This seems to work well in the development environment but after produced in ssp and smp it won't work. What might that be?
  18. Sad =D I'd like to see that bugfix ported to 1.10. Thanks for your help anyway.
  19. Will it eventually be fixed for 1.10 as well?
  20. The newest I could find for 1.10 is 12.18.3.2185. Do I need 1.11 for it to work?
  21. I thought I have fixed it but now: [21:28:25] [Netty Server IO #1/ERROR] [FML]: NetworkDispatcher exception java.lang.IllegalArgumentException: Payload may not be larger than 1048576 bytes at net.minecraft.network.play.server.SPacketCustomPayload.<init>(SPacketCustomPayload.java:27) ~[sPacketCustomPayload.class:?] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.toS3FPackets(FMLProxyPacket.java:165) ~[FMLProxyPacket.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.write(NetworkDispatcher.java:534) ~[NetworkDispatcher.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[AbstractChannel.class:4.0.23.Final] at net.minecraft.network.NetworkManager$4.run(NetworkManager.java:262) [NetworkManager$4.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [singleThreadEventExecutor.class:4.0.23.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [NioEventLoop.class:4.0.23.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
  22. The Problem is that I have the Minecraft "Template" object which is, as far as I know, not serializable in a normal way, only through the nbttagcompound. and I didn't understand. I will have to copy the "NBTTAGCompound to byte code" and make it usable for sizes > 2mb?
  23. Now it worked. Problem seems to be the "readTag" Caused by: java.lang.RuntimeException: Tried to read NBT tag that was too big; tried to allocate: 2097156bytes where max allowed: 2097152 at net.minecraft.nbt.NBTSizeTracker.read(NBTSizeTracker.java:31) ~[NBTSizeTracker.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:51) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagList.read(NBTTagList.java:66) ~[NBTTagList.class:?] at net.minecraft.nbt.NBTTagCompound.readNBT(NBTTagCompound.java:578) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.read(NBTTagCompound.java:52) ~[NBTTagCompound.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:147) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:102) ~[CompressedStreamTools.class:?] at net.minecraft.network.PacketBuffer.readCompoundTag(PacketBuffer.java:341) ~[PacketBuffer.class:?] at net.minecraftforge.fml.common.network.ByteBufUtils.readTag(ByteBufUtils.java:211) ~[byteBufUtils.class:?] at com.minecolonies.coremod.network.messages.SaveScanMessage.fromBytes(SaveScanMessage.java:44) ~[saveScanMessage.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:36) ~[simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:26) ~[simpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:103) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:40) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.23.Final]
  24. Hmm the message shouldn't be even close to this size. But it always crashes during execution when the size reaches a certain limit: private static void saveStructure(@Nullable final World world, @Nullable final BlockPos from, @Nullable final BlockPos to, @NotNull final EntityPlayer player) { if (world == null || from == null || to == null) { throw new IllegalArgumentException("Invalid method call, arguments can't be null. Contact a developer."); } final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); final BlockPos size = blockpos1.subtract(blockpos).add(1, 1, 1); final WorldServer worldserver = (WorldServer) world; final MinecraftServer minecraftserver = world.getMinecraftServer(); final TemplateManager templatemanager = worldserver.getStructureTemplateManager(); final String currentMillis = Long.toString(System.currentTimeMillis()); final String fileName = "/minecolonies/scans/" + LanguageHandler.format("item.scepterSteel.scanFormat", "", currentMillis + ".nbt"); final Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(fileName)); template.takeBlocksFromWorld(world, blockpos, size, true, Blocks.STRUCTURE_VOID); template.setAuthor(Constants.MOD_ID); MineColonies.getNetwork().sendTo(new SaveScanMessage(template.writeToNBT(new NBTTagCompound()), fileName), (EntityPlayerMP) player); } /** * Handles sendScanMessages. */ public class SaveScanMessage implements IMessage, IMessageHandler<SaveScanMessage, IMessage> { private NBTTagCompound nbttagcompound; private String storeLocation; /** * Public standard constructor. */ public SaveScanMessage() { super(); } /** * Send a scan compound to the client. * * @param nbttagcompound the stream. * @param storeAt string describing where to store the scan. */ public SaveScanMessage(final NBTTagCompound nbttagcompound, final String storeAt) { this.nbttagcompound = nbttagcompound; this.storeLocation = storeAt; } @Override public void fromBytes(@NotNull final ByteBuf buf) { nbttagcompound = ByteBufUtils.readTag(buf); storeLocation = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(@NotNull final ByteBuf buf) { ByteBufUtils.writeTag(buf, nbttagcompound); ByteBufUtils.writeUTF8String(buf, storeLocation); } @Nullable @Override public IMessage onMessage(@NotNull final SaveScanMessage message, final MessageContext ctx) { ClientStructureWrapper.handleSaveScanMessage(message.nbttagcompound, message.storeLocation); return null; } /** * Handles the save message of scans. * * @param nbttagcompound compound to store. * @param storeLocation where to store it at. */ public static void handleSaveScanMessage(final NBTTagCompound nbttagcompound, final String storeLocation) { final File file = new File(Minecraft.getMinecraft().mcDataDir, storeLocation); createScanDirectory(Minecraft.getMinecraft().world); try (OutputStream outputstream = new FileOutputStream(file)) { CompressedStreamTools.writeCompressed(nbttagcompound, outputstream); } catch (final IOException e) { LanguageHandler.sendPlayerLocalizedMessage(Minecraft.getMinecraft().player, LanguageHandler.format("item.scepterSteel.scanFailure")); Log.getLogger().warn("Exception while trying to scan.", e); return; } LanguageHandler.sendPlayerLocalizedMessage(Minecraft.getMinecraft().player, LanguageHandler.format("item.scepterSteel.scanSuccess", storeLocation)); } It usually seems to crash during the message sending because it can't be backtracked to any of our code. (In the exception our code doesn't appear). I will try to reproduce the exception in a moment.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.