All "Written books" say, "*Invalid book tag*" in them.

Started by EnsurdFrndship on

Topic category: Help with MCreator software

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
All "Written books" say, "*Invalid book tag*" in them.

Hello,

    I am working with the visual structure behind a procedure in my mod on, "How to add text to written books" in Minecraft. The code behind the visual structure is in Java. In my visual structure, I am using the code block puzzle piece (in green), 

    "Set NBT text tag 'NBT tag' of 'written book' to 'string'"

   ... where I don't know the NBT tag(s) to set in order for my strings to show up in my books, and not see "*Invalid book tag*" show up in my books anymore.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is the Java code for…
Fri, 05/29/2020 - 22:22

Here is the Java code for the procedure of my mod, and my books STILL say, "*Invalid book tag*"...

(new Object() {
					public ItemStack getItemStack(BlockPos pos, int sltid) {
						AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
						TileEntity _ent = world.getTileEntity(pos);
						if (_ent != null) {
							_ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
								_retval.set(capability.getStackInSlot(sltid).copy());
							});
						}
						return _retval.get();
					}
				}.getItemStack(new BlockPos((int) (x + (xval)), (int) (y + (yval)), (int) (z + (zval))), (int) (0))).getOrCreateTag().putString(
						"pages",
						"['{\"text\":\"Minecraft Tools book\"}'],title:Scriptures,author:\"Michael S. Lowe\",display:{Lore:[\"Scriptures\"]}");
				if (((world.getBlockState(new BlockPos((int) (x + (xval)), (int) (y + (yval)), (int) (z + (zval))))).getBlock() == Blocks.STONE
						.getDefaultState().getBlock())) {
					world.setBlockState(new BlockPos((int) (x + (xval)), (int) (y + (yval)), (int) (z + (zval))), Blocks.CHEST.getDefaultState(), 3);
				}