Get Falling Block Type

Started by GremJax on

Topic category: Help with modding (Java Edition)

Last seen on 06:49, 7. Aug 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Get Falling Block Type

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

Last seen on 10:02, 12. Aug 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
cool
Sun, 04/14/2024 - 17:27

cool

Last seen on 11:27, 30. Aug 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you need to do something…
Tue, 07/30/2024 - 19:07

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.