Advertisement
Aladalar

Untitled

Oct 14th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public class PTSGLeaves extends BlockLeaves implements IShearable{
  2.  
  3. public static final String[][] leaftypes = new String[][] {{"leafPine", "leafSpruce"}, {"leafPineOpaque", "leafSpruceOpaque"}};
  4. public static final String[] leaves = new String[] {"Pine", "Spruce"};
  5.  
  6. protected void func_150124_c(World world, int x, int y, int z, int side, int meta)
  7. {
  8. if ((side & 3) == 1 && world.rand.nextInt(meta) == 0)
  9. {
  10. this.dropBlockAsItem(world, x, y, z, new ItemStack(Items.apple, 1, 0));
  11. }
  12. }
  13.  
  14. public int damageDropped(int var01)
  15. {
  16. return super.damageDropped(var01) + 4;
  17. }
  18.  
  19. public int getDamageValue(World world, int x, int y, int z)
  20. {
  21. return world.getBlockMetadata(x, y, z) & 3;
  22. }
  23.  
  24. @SideOnly(Side.CLIENT)
  25. public void getSubBlocks(Item item, CreativeTabs tab, List list)
  26. {
  27. for (int i = 0; i <leaves.length; i++){
  28. list.add(new ItemStack(item, 1, i));
  29. }
  30. }
  31.  
  32. @SideOnly(Side.CLIENT)
  33. public void registerBlockIcons(IIconRegister icon)
  34. {
  35. for (int i = 0; i < leaftypes.length; ++i)
  36. {
  37. this.field_150129_M[i] = new IIcon[leaftypes[i].length];
  38.  
  39. for (int j = 0; j < leaftypes[i].length; ++j)
  40. {
  41. this.field_150129_M[i][j] = icon.registerIcon(leaftypes[i][j]);
  42. }
  43. }
  44. }
  45.  
  46. @Override
  47. public IIcon getIcon(int side, int meta) {
  48. return (meta & 3) == 1 ? this.field_150129_M[this.field_150127_b][1] : this.field_150129_M[this.field_150127_b][0];
  49. }
  50.  
  51. @Override
  52. public String[] func_150125_e() {
  53. return leaves;
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement