@Override protected void readComponents(ComponentsAccess components) { super.readComponents(components); this.number = components.getOrDefault(ExampleMod.NUMBER, 0); } @Override protected void addComponents(ComponentMap.Builder componentMapBuilder) { super.addComponents(componentMapBuilder); componentMapBuilder.add(ExampleMod.NUMBER, number); } @Override public void removeFromCopiedStackNbt(NbtCompound nbt) { nbt.remove("number"); }