How do you can know "Facing" variable of a block?

Started by Maquinablablabla on Wed, 02/20/2019 - 16:44

Topic category: Help with MCreator software

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do you can know "Facing" variable of a block?
Wed, 02/20/2019 - 16:44

how to know the facing of a block in a procedure?

If, for example Im making a block placer I need to know the facing of the block for place the block in the correct side. How?

 

This is not possible yet but…
Wed, 02/20/2019 - 18:35

This is not possible yet but we plan to add this feature.

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
and with code?
Fri, 02/22/2019 - 15:49

and with code?

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ok, thanks
Sun, 02/24/2019 - 11:42

Ok, thanks

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
IBlockState#getValue…
Sun, 02/24/2019 - 18:25

IBlockState#getValue(IProperty) is what you are looking for. IBlockState is sometimes already sometimes provided to you by Minecraft (things like interacting with blocks), or you get it using World#getBlockState(BlockPos). As an IProperty, you parse the property that contains the EnumFacing. Unless MCreator uses a for whatever reason a custom implementation, you just need to parse BlockHorizontal.FACING. The returned value is going to be of type EnumFacing, which you can compare to any value you want and then execute the rest of the code.

The code should look basically like this:
 

EnumFacing facing = (EnumFacing)iblockstate.getValue(BlockHorizontal.FACING);
if(facing == EnumFacing.NORTH){
//do stuff....
}

 

Yes, we use EnumFacing for…
Sun, 02/24/2019 - 18:52

Yes, we use EnumFacing for this and BlockHorizontal. Nuparu00, thanks for the code :)

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I thank you very very muck.
Sun, 02/24/2019 - 19:07

I thank you very very muck.

Last seen on 05:45, 26. Mar 2019
Joined Jul 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i have a different but…
Sun, 03/17/2019 - 05:51

i have a different but related issue. 

im trying to make a bucket  like item that when you right click on a block water is spawned. but how do i figure out which side of the block is being clicked? also, how do i replace the bucket-of-water in the players main hand with a different item?

Tavonis, if you want to do…
Sun, 03/17/2019 - 11:25

Tavonis, if you want to do this with MCreator, you will have to wait a bit as we have this feature in plan but was not added yet.