A procedure to place a block on top of another block

Started by Shigure.no on

Topic category: Help with MCreator software

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A procedure to place a block on top of another block

Hello! 

I am attempting to make a block that is bigger then 3x3, and have decided to split this block into two. 

Is there a procedure or anything that I could use that would automatically place the top part of the block when the bottom part is placed by a player? 

Thank you in advance!

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I mean, you've sort of just…
Sat, 01/27/2024 - 13:11

I mean, you've sort of just described it yourself. You'd need a couple though.

  • For the bottom block's place condition, check if the block above it is air. If it is, return true, otherwise, return false.
  • Make a procedure with the 'block placed' global trigger. Check if the block is your custom bottom block. If it is, place the top block directly above it. 
  • For your bottom block's 'block broken' trigger, also remove the top block. (And for the top block's trigger, also remove the bottom block.)

That being said, (depending on what you're using this for), could be easier to just make an entity with no AI and a solid bounding box that;s 3*3*3 blocks big.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey! Thanks so much for…
Mon, 02/05/2024 - 02:01

Hey! Thanks so much for replying!

I've decided to go with making it an entity like you suggested, and that's working fine - I am now wondering if there is a way to make the entity always spawn in the same placement every time?

By that I mean, when I spawn it in, it changes directions it is facing just like if you were to spawn a mob, which isn't great since it is meant to be a furniture piece! 

Thanks so much again for the help!

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've seen that happen with…
Mon, 02/05/2024 - 11:47

I've seen that happen with entities before, it's sort of like it takes a moment for the game to realize they have no AI. I just recommend running a procedure on entity update tick that sets the entity's position to its current x/y/z rounded down, and it's current yaw/pitch to zero. (And of course make sure the bounding box is set to solid, and collisions are disabled.)

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks so much for the…
Mon, 02/05/2024 - 19:09

Thanks so much for the answer and the help!

This will work just fine :)