Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The point of this code is to render the block differently based on it's surrounding (namely rotate it).
- hasNextBlock checks if the block adiacent to the main one on the given direction (I do it for every direction in the horizontal plane)
- is an instance of itself. if it's any other kind of block, the boolean is true.
- I can't try it yet cause I need to tweak the jsons and I'll probably have to ask about those as well, but is this a proper use of BlockPos?
- 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()));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement