Advertisement
WitherDoggie

WoodWall.class

May 20th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.15 KB | None | 0 0
  1. package com.wither.withermod.blocks;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.block.BlockPane;
  6. import net.minecraft.block.BlockPlanks;
  7. import net.minecraft.block.material.Material;
  8. import net.minecraft.block.properties.IProperty;
  9. import net.minecraft.block.properties.PropertyEnum;
  10. import net.minecraft.block.state.BlockState;
  11. import net.minecraft.block.state.IBlockState;
  12. import net.minecraft.creativetab.CreativeTabs;
  13. import net.minecraft.item.Item;
  14. import net.minecraft.item.ItemStack;
  15. import net.minecraft.util.IStringSerializable;
  16. import net.minecraftforge.fml.relauncher.Side;
  17. import net.minecraftforge.fml.relauncher.SideOnly;
  18.  
  19. public class WoodWall extends BlockPane{
  20.    
  21.     public static final PropertyEnum<WoodWall.WoodType> VARIANT = PropertyEnum.<WoodWall.WoodType>create("variant", WoodWall.WoodType.class);
  22.    
  23.     public WoodWall(){
  24.        
  25.         super(Material.wood, false);
  26.         this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, WoodWall.WoodType.OAK));
  27.         this.setCreativeTab(CreativeTabs.tabBlock);
  28.     }
  29.    
  30.     public int damageDropped(IBlockState state){
  31.        
  32.          return ((WoodWall.WoodType)state.getValue(VARIANT)).getMetadata();
  33.     }
  34.    
  35.     @SideOnly(Side.CLIENT)
  36.     public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list){
  37.        
  38.         for (WoodWall.WoodType woodwall$enumtype : WoodWall.WoodType.values()){
  39.            
  40.             list.add(new ItemStack(itemIn, 1, woodwall$enumtype.getMetadata()));
  41.         }
  42.     }
  43.    
  44.      public IBlockState getStateFromMeta(int meta){
  45.          
  46.             return this.getDefaultState().withProperty(VARIANT, WoodWall.WoodType.byMetadata(meta));
  47.         }
  48.    
  49.      public int getMetaFromState(IBlockState state){
  50.          
  51.             return ((WoodWall.WoodType)state.getValue(VARIANT)).getMetadata();
  52.         }
  53.      protected BlockState createBlockState(){
  54.          
  55.             return new BlockState(this, new IProperty[] {VARIANT});
  56.         }
  57.    
  58.     public static enum WoodType implements IStringSerializable{
  59.        
  60.         OAK(0, "oak"),
  61.         SPRUCE(1, "spruce"),
  62.         BIRCH(2, "birch"),
  63.         JUNGLE(3, "jungle"),
  64.         ACACIA(4, "acacia"),
  65.         DARK_OAK(5, "dark_oak", "big_oak");
  66.        
  67.         private static final WoodWall.WoodType[] META_LOOKUP = new WoodWall.WoodType[values().length];
  68.         private static int meta;
  69.         private static String name;
  70.         private static String unlocalizedname;
  71.        
  72.         private WoodType(int meta, String name) {
  73.    
  74.         }
  75.        
  76.         private WoodType(int meta, String name, String unlocaizedname){
  77.            
  78.         }
  79.        
  80.         public int getMetadata(){
  81.            
  82.             return this.meta;
  83.         }
  84.        
  85.         public static WoodWall.WoodType byMetadata(int meta){
  86.            
  87.             if (meta < 0 || meta >= META_LOOKUP.length)
  88.             {
  89.                 meta = 0;
  90.             }
  91.             return META_LOOKUP[meta];
  92.         }
  93.        
  94.           public String getName(){
  95.              
  96.                 return this.name;
  97.             }
  98.  
  99.             public String getUnlocalizedName(){
  100.                
  101.                 return this.unlocalizedname;
  102.             }
  103.        
  104.         static
  105.         {
  106.             for (WoodWall.WoodType woodwall$woodtype : values())
  107.             {
  108.                 META_LOOKUP[woodwall$woodtype.getMetadata()] = woodwall$woodtype;
  109.             }
  110.         }
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement