Topic category: Help with Minecraft modding (Java Edition)
Hi to all the MCreator modders, I write this post asking help with the question of the subject:
- How I should add UP and DOWN to the block directions?
I would like an answer the clearest you could do thinking in that the most of this forums didn't know how java works and that's the reason because we are using MCreator so please the instructions about code clear (I'm not saying don't talk us about the code, because this is impossible without it, but only make us easy this type of things). Thanks to all the guys that wnt help me.
Here I post you the code of my working rotatable NSEW and 3D block:
1. The block code, I think it works.
2. The code of the model made with MrCrayfish.
3. The code of the .json variants.
Well, I said it before, but thanks to all guys that want help me with this little trouble.
Pretty simply - in PropertyDirection.create() , you will not use 2nd paramater.
And instead of EntityPlayer#getHorizontalFacing() you will use BlockPistonBase.getFacingFromEntity(World, BlockPos, EntityPlayer)
Do not forget to use your names for variables of these types.
@#1 I'm having problems because I don't know well what I should change. I should change this line like:
public static final PropertyDirection FACING = PropertyDirection.create("facing")
But, I don't know where I should set this:
BlockPistonBase.getFacingFromEntity(World, BlockPos, EntityPlayer)
If you could post the code of an example block with NSEWUD directions in 1.11.2. Thanks.
@#1 I changed this:
[spoiler]
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
return getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(pos, placer).getOpposite());
}
[/spoiler]
But always the same error, I'm getting crazy.
ERROR:
[spoiler]
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\****\Documents\*****\MCreator\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_lightBarOn.java:171: error: cannot find symbol
return getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(pos, placer).getOpposite());
^
symbol: method getFacingFromEntity(BlockPos,EntityLivingBase)
location: class BlockPistonBase
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
1 warning
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[/spoiler]
Please, help me, looks like it's a simple error, but I can't find why it's happening.
Since 1.11.x the method is EnumFacing.getDirectionFromEntityLiving
@#2 Thanks, it worked, but not as I was expecting, because when the block it's up I could get like the stairs, that have NSEW down and NSEW up. Probably that was my fault, that I didn't explain it well, but if you know how to do that, can you help me?
@#2.1 PD: Well, more like trapdoor than stairs, because I don't want the corners.