Posted July 7, 20205 yr I'm trying to use IEntityAdditionalSpawnData for my projectile but I'm not really sure how to use the packet methods. I have a capped arrow entity with an IItemTier field that get's written to in writeSpawnData and that gets read from in readSpawnData, I can see from the console (debugging I did) that writeSpawnData is getting called, but readSpawnData isn't. Here's what my overrides look like @Override public void writeSpawnData(PacketBuffer buffer) { Two.LOGGER.info("writing..."); buffer.setCharSequence(0, (CharSequence) this.tier.toString(), Charset.defaultCharset()); Two.LOGGER.info("wrote spawn data {}", this.tier.toString()); } @Override public void readSpawnData(PacketBuffer additionalData) { Two.LOGGER.info("reading..."); String t = additionalData.readCharSequence(0, Charset.defaultCharset()).toString(); Two.LOGGER.info("read spawn data {}", t); try { this.tier = ItemTier.valueOf(t); } catch(Exception exception) { try { this.tier = ItemTierTwo.valueOf(t); } catch(Exception exception2) { Two.LOGGER.warn(exception2); } } } I don't know how to use the PacketBuffer, what would I do if I wanted to write a String to one? I'm also getting these error messages [m[1;31m[11:11:04] [Render thread/ERROR] [ne.mi.fm.ne.si.IndexedMessageCodec/SIMPLENET]: Received invalid discriminator byte 71 on channel fml:play [m[33m[11:11:04] [Render thread/WARN] [minecraft/ClientPlayNetHandler]: Unknown custom packet identifier: fml:play I used to have this done with the datamanager, but I read in the documentation that some things can be done without it. (like the color property of a tipped arrow) (it also reset the itemtier value whenever the world was reopened) at first i tried it with data, then i tried it without data and with nbts (with writeAdditional and readAdditional) then I tried it without data or nbts and with packet buffers (writeSpawnData and readSpawnData) here are some of the files I'm using CappedArrowEntity.java CappedArrowRenderer.java CappedArrowItem.java latest.log
July 7, 20205 yr Author I also get ticking memory exceptions from writeSpawnData when I load the world
July 8, 20205 yr Author 8 hours ago, diesieben07 said: Only use the write*** and read*** methods. For strings use writeString(String) and readString(int). thanks... I'm not sure how i missed those, for some reason I thought there were only char versions
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.