SHARE
TWEET

BlockWoodenFence.java

a guest Feb 16th, 2019 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main.Test;
  2.  
  3. import java.util.List;
  4.  
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7. import net.minecraft.block.BlockFence;
  8. import net.minecraft.block.material.Material;
  9. import net.minecraft.client.renderer.texture.IIconRegister;
  10. import net.minecraft.creativetab.CreativeTabs;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.util.IIcon;
  14.  
  15. public class BlockWoodenFence extends BlockFence {
  16.     public static final String[] fenceType = { "spruce", "birch", "jungle", "acacia", "big_oak" };
  17.     private IIcon[] iicon;
  18.  
  19.     public BlockWoodenFence(String string, Material material) {
  20.         super(string, material);
  21.     }
  22.  
  23.     @Override
  24.     @SideOnly(Side.CLIENT)
  25.     public void registerBlockIcons(IIconRegister register) {
  26.         iicon = new IIcon[fenceType.length];
  27.         for (int i = 0; i < fenceType.length; i++) {
  28.             iicon[i] = register.registerIcon(this.getTextureName() + "_" + fenceType[i]);
  29.         }
  30.     }
  31.  
  32.     @Override
  33.     @SideOnly(Side.CLIENT)
  34.     public IIcon getIcon(int int1, int int2) {
  35.         int i = Math.min(int2, fenceType.length - 1);
  36.         return this.iicon[i];
  37.     }
  38.  
  39.     @Override
  40.     @SideOnly(Side.CLIENT)
  41.     public void getSubBlocks(Item item, CreativeTabs creativeTab, List list) {
  42.         for (int i = 0; i < fenceType.length; i++) {
  43.             list.add(new ItemStack(item, 1, i));
  44.         }
  45.     }
  46.  
  47.     @Override
  48.     public int damageDropped(int meta) {
  49.         return meta;
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top