Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/30/18 in all areas

  1. This is indeed correct. With the way you are assigning values to the fields you don't need the ObjectHolder annotation though. I would say that using ObjectHolders to obtain references to your blocks is preferred though in case you need to compare the blocks at some point. So instead of assigning values to static fields in the registry event just register your blocks and let the object holders do the job for you like I do here and here.
    1 point
  2. if you are looking for simple rotation, then stairs may not be the best example. Stairs rotate, but also can be placed upside down and their bounding boxes change. 1) add property facing to your block public static final PropertyDirection FACING = BlockHorizontal.FACING; 2) set default blockstate in the block constructor this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); 3) create the proper blockstatecontainer @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { FACING}); } 4) meta-> blockstate and blockstate->meta. a meta value is store with each blockstate. you have to convert this to and from the blockstate property value (below is taken from one of my blocks with other properties removed manually without testing, but think it is ok) @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } @Override public int getMetaFromState(IBlockState state) { EnumFacing facing=state.getValue(FACING); int meta=((EnumFacing)state.getValue(FACING)).getIndex(); return meta; } 5)set the property values in the blockstate json. (the "mod" is your modid, the "model" is your model json which should be located in assets/[mod]/models/block. If you wanted different models for different directions, just change here. { "variants": { "facing=north": { "model": "mod:model" }, "facing=east": { "model": "mod:model", "y": 90 }, "facing=south": { "model": "mod:model", "y": 180 }, "facing=west": { "model": "mod:model", "y": 270 }, } } I think that is all you need. Good luck. Don't get discouraged modding, once you get used to looking into the minecraft code, it gets easier.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.