public static Property<?> adaptProperty(IProperty<?> property) { if (property instanceof PropertyBool) { return new BooleanProperty(property.getName(), ImmutableList.copyOf(((PropertyBool) property).getAllowedValues())); } if (property instanceof PropertyInteger) { return new IntegerProperty(property.getName(), ImmutableList.copyOf(((PropertyInteger) property).getAllowedValues())); } if (property instanceof PropertyDirection) { return new DirectionalProperty(property.getName(), ((PropertyDirection) property).getAllowedValues().stream() .map(ForgeAdapter::adaptEnumFacing) .collect(Collectors.toList())); } if (property instanceof PropertyEnum) { return new EnumProperty(property.getName(), ((PropertyEnum<?>) property).getAllowedValues().stream() .map(e -> e.getName()) .collect(Collectors.toList())); } return new IPropertyAdapter<>(property); }
@SideOnly(Side.CLIENT) @Override public void registerModels() { ModelHandler.registerBlockToState(this, BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues().size()); }
@Nonnull @Override public IBlockState getStateFromMeta(int meta) { if (meta < 0 || meta >= BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues().size()) { meta = 0; } return getDefaultState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.values()[meta + 8]); }
&& BotaniaAPI.paintableBlocks.get(block).getAllowedValues().contains(placeColor)) { entity.world.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2); PacketHandler.sendToNearby(entity.world, coords,
@Override public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { for (EnumResourceType resourceType : ORE_RESOURCES.getAllowedValues()) { list.add(get(resourceType, 1)); } }
public BlockHoneyComb(int minMeta) { super(Material.CLOTH); setHardness(1F); setCreativeTab(Tabs.tabApiculture); setDefaultState(this.blockState.getBaseState().withProperty(getVariant(), getVariant().getAllowedValues().iterator().next())); this.minMeta = minMeta; }
@Override public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { for (EnumHoneyComb honeyComb : getVariant().getAllowedValues()) { if (!honeyComb.isSecret() || Config.isDebug) { list.add(get(honeyComb)); } } }
@SideOnly(Side.CLIENT) @Override public void registerModel(Item item, IModelManager manager) { for (EnumHoneyComb comb : getVariant().getAllowedValues()) { manager.registerItemModel(item, comb.ordinal() - minMeta, "block_bee_combs"); } }
private static void addVanillaLeafMappings(Block logBlock, PropertyEnum<BlockPlanks.EnumType> logVariantProperty, Block leavesBlock, PropertyEnum<BlockPlanks.EnumType> leafVariantProperty) { for (BlockPlanks.EnumType variant : logVariantProperty.getAllowedValues()) { IBlockState logState = logBlock.getDefaultState().withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y).withProperty(logVariantProperty, variant); for (Boolean check_decay : BlockLeaves.CHECK_DECAY.getAllowedValues()) { IBlockState leafState = leavesBlock.getDefaultState().withProperty(leafVariantProperty, variant).withProperty(BlockLeaves.DECAYABLE, Boolean.TRUE).withProperty(BlockLeaves.CHECK_DECAY, check_decay); leafMap.put(new BlockWrapper(logState), new BlockWrapper(leafState)); } } }
Collection<BlockFlagPole.Variants> collec = BlockFlagPole.VARIANT.getAllowedValues(); final ResourceLocation[] variants = new ResourceLocation[collec.size()]; int i = 0;