Get Block NBT String

Started by BissNik on Sat, 05/29/2021 - 08:01

Topic category: Help with modding (Java Edition)

Last seen on 14:16, 23. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Get Block NBT String
Wed, 06/16/2021 - 14:51 (edited)

Hello Modders!

I may need some Help, I am trying to store a Command from a Commandblock underneath me. I am modding on Minecraft Version 1.16.5 with MCreator 2021.1. The <Get text NBT tag "Command" if it has tileentity>-Block does not work however, and I tried out many different ways for over 2 months now.

return (new Object() {
	public String getValue(IWorld world, BlockPos pos, String tag) {
		TileEntity tileEntity = world.getTileEntity(pos);
		if (tileEntity != null)
			return tileEntity.getTileData().getString(tag);
		return "";
	}
}.getValue(world, new BlockPos((int) (Math.floor(x)), (int) ((Math.floor(y)) - 1), (int) (Math.floor(z))), "Command"));

I would really appreciate if someone can help me out.

Best Wishes,

BissNik

Edited by BissNik on Wed, 06/16/2021 - 14:51