Started by
Nuparu00
on
Topic category: User side tutorials
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
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!!
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)?
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);
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.
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?
By" slab to rotate" you mean some sort of a "wall slab"?
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!
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?
Hey, Nuparu. Is there a way I may contact you privately?
-Moderator xXMCXx
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?
@#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
@#10 E-mail: finalcraftsrv@gmail.com
or Skype: nuparumcs
@#11.1 Wow after the xXMCXx's email you are a moderator.
@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?