How to make Rotatable Block [VIDEO TUTORIAL]

Started by Nuparu00 on

Topic category: User side tutorials

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make Rotatable Block [VIDEO TUTORIAL]
Wed, 01/04/2017 - 20:31 (edited)

Hi. Because there is not his feature in MCreater itself and many of you need it for your mod , I decided to make a video tutorial how to make custom block rotatable , using PropertyDirection.
LINK

 

 

Edited by Klemen on Wed, 01/04/2017 - 20:31
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Gahhh, you're the best! Its a
Tue, 10/04/2016 - 16:48

Gahhh, you're the best! Its a shame this is so tedious, having to do this for almost every single 3D object can be a pain! :/ 

Block rotation has GOT to be in the next mCreator update if anything else!!

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nuparu, Is there a way to
Tue, 10/04/2016 - 18:45

Nuparu, Is there a way to extend PropertyDirection to blocks added on update tick? Lets say I've followed your tutorial, and made a block that faces south and adds a block on update tick. How do I make the new block also face south? Is it a simple event condition variable (i, j, k)? 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The default block placing is
Tue, 10/04/2016 - 21:28

The default block placing is something like:
world.setBlockState(new BlockPos(i, j+1, k), BLOCK.getDefaultState(), 3);

 

The bold part are the coords in wolrd and the italic part is the BlockState. BlockState have id - metadata so I would try getting the metadata from 1st block and then use the id on placing the 2nd block like:
 

world.setBlockState(new BlockPos(i, j+1, k), BLOCK.getStateFromMeta(BLOCK.FACING,((BLOCK2)world.getBlockState(new BlockPos(i,j,k).getBlock()).getMetaFromState(world.getBlockState(new BlockPos(i,j,k))))), 3);

 

Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried working through this
Tue, 10/11/2016 - 20:14

I tried working through this tutorial yesterday (even got it to compile on the first try) and came back this morning to find that the code in my Chair's java file had reverted to what it was before attempting the tutorial. Even the blockstate file went back to what it was and I had manually replaced it and hit the save button.

Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rotatable Slab
Mon, 11/07/2016 - 19:56

Hello,

I went through this tutorial and got it working. I was  needing if you knew how to get a slab to rotate. I tried this method. But it doesn't seem to work. Any clues?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
By" slab to rotate" you mean
Wed, 11/09/2016 - 06:14

By" slab to rotate" you mean some sort of a "wall slab"?

Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rotatable Slab
Wed, 11/09/2016 - 15:22

i mean a rotation on the y axis. I am trying to do a slab with a line on top. It needs to able to face north/south and east/west. Although a tutorial on wall slab would be nice too!

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So something like this?
Fri, 11/11/2016 - 14:50

So something like this?

Well then I do not see why it should not work. Can I see your code + also the your current code makes it not rotate , or it rotates in wrong direction?

Joined Dec 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:So something like this?
Fri, 11/11/2016 - 17:39

Hey, Nuparu. Is there a way I may contact you privately?
-Moderator xXMCXx

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if(true){world.setBlockState
Sat, 11/12/2016 - 06:38

if(true){
world.setBlockState(new BlockPos(i - 1, j, k),
 mcreator_titaniumOre1.block.getStateFromMeta(mcreator_titaniumOre1.FACING,
((1)world.getBlockState(new
BlockPos(i - 1, j, k).getBlock()).getMetaFromState(world.getBlockState(new
BlockPos(i - 1, j, k))))), 3);
}

did i made something wrong?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:if(true){world.setBlockState
Sat, 11/12/2016 - 16:38

@#11
I see that you are trying put on i-1,j,k block with metadata of block that is also on i-1,j,k.
Also there --> "((1)world.getBlockState(new" is supposed be instead of 1 reference to the 2nd block like mcreator_fridgeLower.block

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:if(true){world.setBlockState
Sat, 11/12/2016 - 17:03

@#11.1 Wow after the xXMCXx's email you are a moderator.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Nuparu00
Sat, 11/26/2016 - 20:45

@Nuparu00

I'm curious: could you simply copy/paste the code from the video, change all the "Chair" to whatever block I want, save and recompile? I have about 10 blocks I want to rotate, so if inputting the code could be done like that, it would be really helpful. 

However, I attempted this once, and the gradle log kept showing errors. Is there something else I need to do, or do you have to enter it line by line?