public static BlockProperty of(IProperty property) { if (property instanceof PropertyBool) { return new NeptuneBlockBooleanProperty((PropertyBool) property); } else if (property instanceof PropertyDirection) { return new NeptuneBlockDirectionProperty((PropertyDirection) property); } else if (property instanceof PropertyEnum) { return new NeptuneBlockEnumProperty((PropertyEnum) property); } else if (property instanceof PropertyInteger) { return new NeptuneBlockIntegerProperty((PropertyInteger) property); } return new NeptuneBlockProperty(property); }
public static IBlockState rotate(@Nonnull IBlockState paintSource) { // TODO: Need to handle cases like stairs that have 'upper' and 'lower' so they are included in the rotation // cycle for (IProperty<?> prop : paintSource.getPropertyKeys()) { if (prop instanceof PropertyDirection) { return paintSource.cycleProperty(prop); } else if (prop == BlockSlab.HALF) { return paintSource.cycleProperty(prop); } } if (paintSource.getBlock() instanceof BlockLog) { return paintSource.cycleProperty(BlockLog.LOG_AXIS); } return paintSource; }
@Override protected PropertyDirection getFacingProperty() { return FACING; }
private void parsePaleteBlockParameter(String blockname, String propertyString, PaletteEntry entry) { String[] aProp = propertyString.split(":"); if (aProp.length != 2) { return; } IProperty prop = null; EnumFacing value = null; if ("facing".equals(aProp[0])) { // // prop = PropertyDirection.create("facing", new Predicate() { // };<EnumFacing><EnumFacing>(); if(blockname.equals("minecraft:torch")){ prop = PropertyDirection.create("facing", new Predicate<EnumFacing>() { public boolean apply(EnumFacing p_apply_1_) { return p_apply_1_ != EnumFacing.DOWN; } }); //FIXME //return; }else{ prop = BlockHorizontal.FACING; } } // PropertyDirection if ("north".equals(aProp[1])) { value = EnumFacing.NORTH; } else if ("south".equals(aProp[1])) { value = EnumFacing.SOUTH; } if (value == null || prop == null) { return; } System.out.println("adding property [" + aProp[0] + "] [" + aProp[1] + "]"); entry.block = entry.block.withProperty(prop, value); }
public static IBlockState getBlockStateFromMeta(int meta, PropertyInteger propState, PropertyDirection propDir, IBlockState defState, int max) { EnumFacing facing = EnumFacing.NORTH; int state = 0; switch (meta) { case 0: break; case 1: facing = EnumFacing.SOUTH; break; case 2: facing = EnumFacing.EAST; break; case 3: facing = EnumFacing.WEST; break; case 4: state = 1; break; case 5: state = 1; facing = EnumFacing.SOUTH; break; case 6: state = 1; facing = EnumFacing.EAST; break; case 7: state = 1; facing = EnumFacing.WEST; break; case 8: state = 2; break; case 9: state = 2; facing = EnumFacing.SOUTH; break; case 10: state = 2; facing = EnumFacing.EAST; break; case 11: state = 2; facing = EnumFacing.WEST; break; case 12: state = 3; break; case 13: state = 3; facing = EnumFacing.SOUTH; break; case 14: state = 3; facing = EnumFacing.EAST; break; case 15: state = 3; facing = EnumFacing.WEST; break; default: break; } return defState.withProperty(propState, Math.min(state, max)).withProperty(propDir, facing); }
protected BlockStateContainer createBlockState() { FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); ACTIVE = PropertyBool.create("active"); return new BlockStateContainer(this, FACING, ACTIVE); }
public static void init() { ArrayList<EnumFacing> directions = new ArrayList<EnumFacing>(); Collections.addAll(directions, EnumFacing.HORIZONTALS); FACING_HORIZONTAL = PropertyDirection.create("horizontal_facing", directions); }
public NeptuneBlockDirectionProperty(PropertyDirection handle) { super(handle); }
@Override public PropertyDirection getHandle() { return (PropertyDirection) super.getHandle(); }
public static EnumFacing getBlockProperty(World par1World, BlockPos pos, PropertyDirection property) { return (EnumFacing) par1World.getBlockState(pos).getValue(property); }
public static EnumFacing getBlockProperty(World par1World, int par2, int par3, int par4, PropertyDirection property) { return (EnumFacing) par1World.getBlockState(new BlockPos(par2, par3, par4)).getValue(property); }
protected NeptuneBlockDirectionProperty(PropertyDirection handle) { super(handle); }
public static EnumFacing getBlockProperty(World par1World, BlockPos pos, PropertyDirection property) { return par1World.getBlockState(pos).getValue(property); }
public static EnumFacing getBlockProperty(World par1World, int par2, int par3, int par4, PropertyDirection property) { return par1World.getBlockState(new BlockPos(par2, par3, par4)).getValue(property); }
protected abstract PropertyDirection getFacingProperty();