Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wither.withermod.blocks;
- import java.util.List;
- import net.minecraft.block.BlockPane;
- import net.minecraft.block.BlockPlanks;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.properties.IProperty;
- import net.minecraft.block.properties.PropertyEnum;
- import net.minecraft.block.state.BlockState;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.IStringSerializable;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class WoodWall extends BlockPane{
- public static final PropertyEnum<WoodWall.WoodType> VARIANT = PropertyEnum.<WoodWall.WoodType>create("variant", WoodWall.WoodType.class);
- public WoodWall(){
- super(Material.wood, false);
- this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, WoodWall.WoodType.OAK));
- this.setCreativeTab(CreativeTabs.tabBlock);
- }
- public int damageDropped(IBlockState state){
- return ((WoodWall.WoodType)state.getValue(VARIANT)).getMetadata();
- }
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list){
- for (WoodWall.WoodType woodwall$enumtype : WoodWall.WoodType.values()){
- list.add(new ItemStack(itemIn, 1, woodwall$enumtype.getMetadata()));
- }
- }
- public IBlockState getStateFromMeta(int meta){
- return this.getDefaultState().withProperty(VARIANT, WoodWall.WoodType.byMetadata(meta));
- }
- public int getMetaFromState(IBlockState state){
- return ((WoodWall.WoodType)state.getValue(VARIANT)).getMetadata();
- }
- protected BlockState createBlockState(){
- return new BlockState(this, new IProperty[] {VARIANT});
- }
- public static enum WoodType implements IStringSerializable{
- OAK(0, "oak"),
- SPRUCE(1, "spruce"),
- BIRCH(2, "birch"),
- JUNGLE(3, "jungle"),
- ACACIA(4, "acacia"),
- DARK_OAK(5, "dark_oak", "big_oak");
- private static final WoodWall.WoodType[] META_LOOKUP = new WoodWall.WoodType[values().length];
- private static int meta;
- private static String name;
- private static String unlocalizedname;
- private WoodType(int meta, String name) {
- }
- private WoodType(int meta, String name, String unlocaizedname){
- }
- public int getMetadata(){
- return this.meta;
- }
- public static WoodWall.WoodType byMetadata(int meta){
- if (meta < 0 || meta >= META_LOOKUP.length)
- {
- meta = 0;
- }
- return META_LOOKUP[meta];
- }
- public String getName(){
- return this.name;
- }
- public String getUnlocalizedName(){
- return this.unlocalizedname;
- }
- static
- {
- for (WoodWall.WoodType woodwall$woodtype : values())
- {
- META_LOOKUP[woodwall$woodtype.getMetadata()] = woodwall$woodtype;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement