Make the Block face like the block next to It

Started by gustavowizard123 on

Topic category: Help with modding (Java Edition)

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make the Block face like the block next to It

When i put the this block, i want it to face the same side the block on Bottom of it is facing, so what should i change here:

Or could also make so it face the side its already facing, since its a tick update block - the top will replace the old top, facing the same side.

 

 

world.setBlockState(new BlockPos(i, j , k), mcreator_refrigeratorBottom.block.getDefaultState().withProperty(mcreator_refrigeratorBottom.block.FACING,entity.getHorizontalFacing().getOpposite()), 3);

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the problem here is that the
Tue, 10/04/2016 - 18:35

the problem here is that the top turn into the other top, and face me, like when i put the block, i want, this time, it face the side it already was

Last seen on 22:00, 11. Nov 2019
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So let me get this straight,
Tue, 10/04/2016 - 18:35

So let me get this straight, you want a block to face the same side as the block on bottom?

https://mcreator.pylo.co/forum/31093/video-tutorial-how-make-rotatable-…

Nuparu made a video tutorial on how to place a block facing a certain direction when placed.

Now, since your block updates on tick, you want it to place the new block facing the same direction as the previous one? That is a bit tricky...

 

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:So let me get this straight,
Wed, 10/05/2016 - 05:10

@#2 why is tricky? i just want it to face the same side as the previous one (yes on a tick);

BLOCKS: Coffe Machine OFF - Coffe Machine Running - Coffe Machine Done

ITEM: Coffe Machine, so when i click the OFF machine and make it run, it will remove the OFF block and Add teh Running one, when it does that, i code so it will face the player, the problem is that on the tick, if you move around, it will face you on the tick end, but if you get the Coffe item it will reset to the OFF state and will face the correct side again. The way is now is totally playable but not stetic nice yet. I think about changing the code when it ticks and add the running block, so again this part

 

world.setBlockState(new BlockPos(i, j , k), mcreator_refrigeratorBottom.block.getDefaultState().withProperty(mcreator_refrigeratorBottom.block.FACING,entity.getHorizontalFacing().getOpposite()), 3);

 

this .getOpposite does what? im very noob yet but think if you change something here and maybe on the blockstate file you can make it work.

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
getOpposite inverts the
Wed, 10/05/2016 - 08:25

getOpposite inverts the facing so if it value face to you and you want face it away from you , then you use this method.

Last seen on 22:00, 11. Nov 2019
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
We know what it is you want,
Wed, 10/05/2016 - 13:27

We know what it is you want, it is tricky because that is easier said than done. The answer you seek is already in the thread I linked above, its just tedious and not too easy to follow for beginners. You just have to do some code and .json editing. 

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:getOpposite inverts the
Thu, 10/06/2016 - 04:34

@#3 hum not oposite, i wanted it face the same side the last block was, if its that hard i guess i will leave this way for now, it will face the correct side and you if you click on it lol, im gonna upload my mod tomorrow, so prb its gonna be easier sice people can see all the code.