Rotatable blocks

Started by TheDwarvenDigger on

Topic category: Feature requests and ideas for MCreator

Last seen on 20:29, 29. Apr 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rotatable blocks

I think there should be an option so that your blocks can face a certain direction (Like how logs, quartz pillars etc. rotate depending on what's next to them)

Also, Bring back slabs and stairs! I want to add slabs and stairs of my block but it would involve a LOT of model and code.

I am also not able to use techne models, either tell me how to do this or add it as a feature because I prefer techne to blender and it's annoying how I can't use it. Plus, BDCraft only uses one texture, so I can't do as much with that.

Another problem I've had is that I can't get any of my blocks to act like grass, and when I try and create a new biome with one of these grass-based blocks no trees or plants spawn on it and I don't know why. It's so annoying as I'm trying to create an extended nature mod which has thing like wet grass, muddy grass, dry grass etc. and they don't work, even when I set the material to grass (Maybe add an option for grass-like spreading?)

Last seen on 17:49, 25. Mar 2021
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have your problem too: i
Tue, 09/13/2016 - 20:21

I have your problem too: i maked secret glass (with that you can see other player but other players can't see you)  but i can't rotate it. 

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try use PropertyDirection.
Tue, 09/13/2016 - 21:33

Try use PropertyDirection.

You need variable for it:
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

and in constructor define default state:
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));

Now you need these methods:
 

[spoiler]

 

@Override
public IBlockState getStateForEntityRender(IBlockState state) {

return getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
}

@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = EnumFacing.getFront(meta);

if(facing.getAxis()==EnumFacing.Axis.Y) {
facing=EnumFacing.NORTH;
}

return getDefaultState().withProperty(FACING, facing);
}

@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(FACING)).getIndex();
}

@Override
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[]{FACING});
}

[/spoiler]
This one theoretically you don't need. Make rotate the model to opposite side of player look:

[spoiler]

 

@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos,
EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
EntityLivingBase placer) {
return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());

}

[/spoiler]

And in the blockstate .json file asign the variable:

This is from my model file (your values can be maybe diffrent):

{
"variants": {
"facing=up": { "model": "MyMod:Armchair" },
"facing=south": { "model": "MyMod:Armchair" },
"facing=east": { "model": "MyMod:Armchair", "y": 270 },
"facing=west": { "model": "MyMod:Armchair", "y": 90 },
"facing=north": { "model": "MyMod:Armchair", "y": 180 }
}
}

Last seen on 06:03, 27. Feb 2024
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
To make slabs and stairs you
Tue, 09/13/2016 - 21:54

To make slabs and stairs you need to (unless you already know how to) use Mr. Crayfish's Model Creator. Then make a slab, stairs or something.
After making it, export to a. JSON file. When that's done, make a block and put the JSON file in (To render the slab like a slab, in aesthetics, go to maximum Y and put 0.5)
After that the block is made. Hope it sort of helped

Last seen on 20:33, 2. Mar 2018
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 Hey - I know this is almost…
Fri, 03/02/2018 - 12:21

 Hey - I know this is almost two years later - but uhm - where exactly do you PUT this code? I mean - is there a specific place in the code that you insert this?

Last seen on 20:33, 2. Mar 2018
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry - I meant to address…
Fri, 03/02/2018 - 12:23

Sorry - I meant to address Nuparu00 specifically - but if anyone else knows that would be helpful - would be good to know where to PUT these variables.