How do I check the block below and replace it with another block?

Started by Xlemonp on Sat, 10/27/2018 - 11:27

Topic category: Help with modding (Java Edition)

Last seen on 10:50, 25. Nov 2018
Joined Oct 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I check the block below and replace it with another block?
Sat, 10/27/2018 - 11:27

Hello. I want to check the block below and if it is dirt replace it with stone. How i can make this? Sorry for bad grammar my first language isn't English.

Last seen on 21:12, 23. Nov 2018
Joined May 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I don't know how you want to…
Sun, 11/18/2018 - 01:10

I don't know how you want to accomplish this in game so I will invent something.

 

Create a new item call it whatever texture it whatever it does not matter.

Next go back into the item and create a new right click on block procedure.

Now the block code is llike this:

    if( block comparer [get block at x { y - 1 } z ] == minecraft: dirt ) {

       remove block at x { y - 1 } z

       place minecraft: stone at x { y - 1 } z

}

If statement can be found under the logic and loops category.

Block comparer can be found under logic operations it is the first yellow block with the cube icon only.

Minecraft: dirt and minecraf: stone can be found under minecraft components use the second yellow one with the white cube only.

Remove and place block can be found under block actions.

{ y - 1 } is a compound of y and the operator block in math - and the number one also found under math 1