Topic category: Help with Minecraft modding (Java Edition)
I think I have a relatively unique problem regarding falling block entities. I am trying to determine what type of falling block an entity is, but minecraft handles this in a strange way. From what I have been able to gather, falling blocks have a nested NBT tag called BlockState that has a variety of data about the falling block, but the important one is Name, which actually contains the name of the block that is falling. Sand as an example:
falling_block <x> <y> <z> {BlockState:{Name:"minecraft:sand"}}
If I want to figure out which falling block it actually is I need to separate the string for Name out of the BlockState NBT tag, but I haven't been able to do this. I tried a variety of things including printing each section individually and BlockState.Name dot notation but nothing works. I can provide more specific information if needed, and any help would be greatly appreciated
cool
If you need to do something like for example a falling block is a anvil and touches player strike lightning you can do that with commands.Use Execute command in the name of entity or at xyz.
/execute at @a as @e[type=minecraft:falling_block,limit=1,sort=nearest,distance=..1,nbt={BlockState:{Name:"minecraft:anvil"}}] run summon minecraft:lightning_bolt
You can change distance to what distance it can detect falling entity and change minecraft:anvil to any block even your custom one.
sory if i make any grammar mistakes English is not my main language
and odchody saying cool doesnt ansver a question.