Posted September 9, 20232 yr I have a TNT arrow, and it should have a "Fuse" NBT-tag. I already tried that: @Override public CompoundTag serializeNBT() CompoundTag tag = super.serializeNBT(); tag.putInt("Fuse", getFuse()); return tag; } @Override public void deserializeNBT(CompoundTag tag) { super.deserializeNBT(tag); setFuse(tag.getInt("Fuse")); } but it didn't help
September 10, 20232 yr Author Topic closed. I solved it like this: @Override public void addAdditionalSaveData(@NotNull CompoundTag tag) { super.addAdditionalSaveData(tag); tag.putInt("Fuse", getFuse()); } @Override public void readAdditionalSaveData(@NotNull CompoundTag tag) { super.readAdditionalSaveData(tag); if (tag.contains("Fuse")) { setFuse(tag.getInt("Fuse")); } else { setFuse(80); } }
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.