Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- There are 5 properties:
- type is an enum, the block has a different model for every type value.
- Then there are 4 booleans, one per direction on the horizontal plane. north returns true if the block adiacent to the main one on the north side is not an instance of the former (the main block). The purpose is to rotate some blocks: http://i.imgur.com/MmMj9zg.png
- As shown in this thread http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2319736-how-to-render-pipes-using-blockstates-with-example the vanilla way to achieve this would be to have a nightmarish amount of combinations and write down every down, but here comes the forge format to the rescue, right? Since I only need to rotate the model with certain combinations of the direction booleans, do I have to "nest" them inside the type ones? If not, how do I do that?
- public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumProperty.class);
- public static final PropertyBool NORTH = PropertyBool.create("north");
- public static final PropertyBool SOUTH = PropertyBool.create("south");
- public static final PropertyBool EAST = PropertyBool.create("east");
- public static final PropertyBool WEST = PropertyBool.create("west");
- public Boolean hasNextBlock(IBlockAccess worldIn, BlockPos pos) {
- Block b = worldIn.getBlockState(pos).getBlock();
- if(!(b.instanceof(BlockFountain))) { return true } else { return false }
- }
- @Override
- public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
- return state.withProperty(NORTH, hasNextBlock(worldIn, pos.north())).withProperty(SOUTH, hasNextBlock(worldIn, pos.south())).withProperty(EAST, hasNextBlock(worldIn, pos.east())).withProperty(WEST, hasNextBlock(worldIn, pos.west()));
- }
- {
- "forge_marker": 1,
- "defaults": {
- "textures": {"wall": "blocks/cobblestone"},
- "model": "tknowledge:Center_Bottom",
- "uvlock": true,
- "transform": "forge:default-block"
- },
- "variants": {
- "type=center_bottom": { "model":"tknowledge:Center_Bottom" },
- "type=center_middle": { "model":"tknowledge:Center_Middle"},
- "type=side": { "model":"tknowledge:Side" },
- "type=side_alt": { "model":"tknowledge:Side_Alt" },
- "type=side_dioptra": { "model":"tknowledge:Side_Dioptra" },
- "type=side_fluids": { "model":"tknowledge:Side_Fluids" },
- "type=connection_lr": { "model":"tknowledge:Connection_LR" },
- "type=connection_lr_alt": { "model":"tknowledge:Connection_LR_ALT" },
- "type=connection_lrfb": { "model":"tknowledge:Connection_LRFB" },
- "east=false,north=false,south=false,west=false": {},
- "east=false,north=true,south=false,west=false": {},
- "east=true,north=false,south=false,west=false": {},
- "east=false,north=false,south=true,west=false": {},
- "east=false,north=false,south=false,west=true": {},
- "east=true,north=true,south=false,west=false": {},
- "east=true,north=false,south=true,west=false": {},
- "east=false,north=false,south=true,west=true": {},
- "east=false,north=true,south=false,west=true": {},
- "east=false,north=true,south=true,west=false": {},
- "east=true,north=false,south=false,west=true": {},
- "east=true,north=true,south=true,west=false": {},
- "east=true,north=false,south=true,west=true": {},
- "east=false,north=true,south=true,west=true": {},
- "east=true,north=true,south=false,west=true": {},
- "east=true,north=true,south=true,west=true": {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement