Guest User

Leaves

a guest
Dec 7th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. package net.wuerfel21.derpyshiz.blocks;
  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.BlockLeaves;
  8. import net.minecraft.client.Minecraft;
  9. import net.minecraft.client.renderer.texture.IIconRegister;
  10. import net.minecraft.client.settings.GameSettings;
  11. import net.minecraft.creativetab.CreativeTabs;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.util.IIcon;
  15. import net.minecraft.world.IBlockAccess;
  16. import net.minecraft.world.World;
  17.  
  18. public class DerpyLeaves extends BlockLeaves {
  19.  
  20. public static final String[][] textures = new String[][] {{"derpyshiz:leaves_ebony", "derpyshiz:leaves_magic"}, {"derpyshiz:leaves_ebony_opaque", "derpyshiz:leaves_magic_opaque"}};
  21. public static final String[] types = new String[] {"ebony", "magic"};
  22.  
  23. @Override
  24. @SideOnly(Side.CLIENT)
  25. public boolean isOpaqueCube() {return !Minecraft.getMinecraft().gameSettings.fancyGraphics;}
  26.  
  27. public int damageDropped(int p_149692_1_)
  28. {
  29. return super.damageDropped(p_149692_1_) + 4;
  30. }
  31.  
  32. /**
  33. * Get the block's damage value (for use with pick block).
  34. */
  35. public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_)
  36. {
  37. return p_149643_1_.getBlockMetadata(p_149643_2_, p_149643_3_, p_149643_4_) & 3;
  38. }
  39.  
  40. /**
  41. * Gets the block's texture. Args: side, meta
  42. */
  43. @SideOnly(Side.CLIENT)
  44. public IIcon getIcon(int side, int meta)
  45. {
  46. int graphics = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 0:1;
  47. return (meta & 3) == 1 ? this.field_150129_M[graphics][1] : this.field_150129_M[graphics][0];
  48. }
  49.  
  50. @SideOnly(Side.CLIENT)
  51. public void registerBlockIcons(IIconRegister reg)
  52. {
  53. for (int i = 0; i < textures.length; ++i)
  54. {
  55. this.field_150129_M[i] = new IIcon[textures[i].length];
  56.  
  57. for (int j = 0; j < textures[i].length; ++j)
  58. {
  59. this.field_150129_M[i][j] = reg.registerIcon(textures[i][j]);
  60. }
  61. }
  62. }
  63.  
  64. public String[] func_150125_e()
  65. {
  66. return types;
  67. }
  68.  
  69. @SuppressWarnings({ "unchecked", "rawtypes" })
  70. @SideOnly(Side.CLIENT)
  71. @Override
  72. public void getSubBlocks(Item item, CreativeTabs tab, List list) {
  73. for (int i = 0; i < 2; i ++) {
  74. list.add(new ItemStack(item, 1, i));
  75. }
  76. }
  77.  
  78. @SideOnly(Side.CLIENT)
  79. @Override
  80. public int colorMultiplier(IBlockAccess a, int x, int y, int z) {
  81. if (a.getBlockMetadata(x, y, z)%2==1) {
  82. return 0xff69b4;
  83. } else {
  84. return super.colorMultiplier(a,x,y,z);
  85. }
  86. }
  87.  
  88. @SideOnly(Side.CLIENT)
  89. @Override
  90. public int getRenderColor(int meta) {
  91. if (meta%2==1) {
  92. return 0xff69b4;
  93. } else {
  94. return super.getRenderColor(meta);
  95. }
  96. }
  97.  
  98. @SideOnly(Side.CLIENT)
  99. @Override
  100. public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
  101. return true;
  102. }
  103.  
  104. }
Advertisement
Add Comment
Please, Sign In to add comment