@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.SPREADER_VARIANT); }
@SuppressWarnings({ "rawtypes", "unchecked" }) private IBlockState applyProperties(BlockStateContainer stateContainer, IBlockState newState, Map<Property<?>, Object> states) { for (Map.Entry<Property<?>, Object> state : states.entrySet()) { IProperty property = stateContainer.getProperty(state.getKey().getName()); Comparable value = (Comparable) state.getValue(); // we may need to adapt this value, depending on the source prop if (property instanceof PropertyDirection) { Direction dir = (Direction) value; value = ForgeAdapter.adapt(dir); } else if (property instanceof PropertyEnum) { String enumName = (String) value; value = ((PropertyEnum<?>) property).parseValue((String) value).or(() -> { throw new IllegalStateException("Enum property " + property.getName() + " does not contain " + enumName); }); } newState = newState.withProperty(property, value); } return newState; }
public BlockBiomeStoneA() { super(LibBlockNames.BIOME_STONE_A); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST)); }
private Map<IBlockState, ModelResourceLocation> mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel ) { Map<IBlockState, ModelResourceLocation> result = new HashMap<>(); for( IBlockState state : block.getBlockState().getValidStates() ) { if( state.getValue( BlockCraftingUnit.FORMED ) ) { // Always use the builtin model if the multiblock is formed result.put( state, formedModel ); } else { // Use the default model result.put( state, defaultModel ); } } return result; } }
public BlockTinyPotato() { super(Material.CLOTH, LibBlockNames.TINY_POTATO); setHardness(0.25F); setDefaultState(blockState.getBaseState() .withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH)); }
public MutationConditionRequiresResource(String oreDictName) { this.displayName = oreDictName; for (ItemStack ore : OreDictionary.getOres(oreDictName)) { if (!ore.isEmpty()) { Item oreItem = ore.getItem(); Block oreBlock = Block.getBlockFromItem(oreItem); if (oreBlock != Blocks.AIR) { this.acceptedBlockStates.addAll(oreBlock.getBlockState().getValidStates()); } } } }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.POWERED, BotaniaStateProps.HAS_LENS); }
protected BlockCacophonium() { super(Material.WOOD, LibBlockNames.CACOPHONIUM); setHardness(0.8F); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false)); }
@Override @SideOnly(Side.CLIENT) public void registerModel(Item item, IModelManager manager) { for (IBlockState state : blockState.getValidStates()) { int meta = getMetaFromState(state); ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation("forestry:leaves.default." + blockNumber, "inventory")); } }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.DRUM_VARIANT); }
public BlockForestDrum() { super(Material.WOOD, LibBlockNames.FOREST_DRUM); setHardness(2.0F); setSoundType(SoundType.WOOD); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD)); }
@Override @SideOnly(Side.CLIENT) public void registerModel(Item item, IModelManager manager) { for (IBlockState state : blockState.getValidStates()) { int meta = getMetaFromState(state); ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation("forestry:leaves.default." + blockNumber, "inventory")); } }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.POWERED); }
public BlockLightLauncher() { super(Material.WOOD, LibBlockNames.LIGHT_LAUNCHER); setHardness(2.0F); setSoundType(SoundType.WOOD); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false)); }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.CARDINALS); }
protected BlockIncensePlate() { super(Material.WOOD, LibBlockNames.INCENSE_PLATE); setHardness(2.0F); setSoundType(SoundType.WOOD); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH)); }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.BIOMESTONE_VARIANT); }
public BlockPetalBlock() { super(Material.PLANTS, LibBlockNames.PETAL_BLOCK); setHardness(0.4F); setSoundType(SoundType.PLANT); setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE)); }
@Nonnull @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, BotaniaStateProps.LIVINGWOOD_VARIANT); }
protected BlockAltar() { super(Material.ROCK, LibBlockNames.ALTAR); setHardness(3.5F); setSoundType(SoundType.STONE); setDefaultState(blockState.getBaseState() .withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT)); }