How to change the NBTs of a block (TileEntity)?

I have a block (image) and I want to mod its NBT physics_enabled in 1b. How do I do it?

Hopefully this helps

1 Like

I did this code

TileEntity block = world.getTileEntity(position).get();
DataContainer container = block.toContainer();
container = container.set(DataQuery.of("UnsafeData", "physics_enabled"), true);
block.setRawData(container);

But I have an error:

[14:14:40] [Server thread/WARN] [Sponge]: /* java.lang.UnsupportedOperationExcept
[14:14:40] [Server thread/WARN] [Sponge]: /* on: null
[14:14:40] [Server thread/WARN] [Sponge]: net.minecraft.tileentity.TileEntity.setRawData(TileEntity.java:1728)

How to correct it?

I’ll ask you again.