Advertisement
Corosus

Untitled

Apr 17th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.93 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode
  4.  
  5. package net.minecraft.src;
  6.  
  7. import java.util.Random;
  8.  
  9. // Referenced classes of package net.minecraft.src:
  10. //            Block, Material, mod_palmLeaves, World,
  11. //            EntityPlayer
  12.  
  13. public class BlockTropicraftPalmWood extends Block implements net.minecraft.src.forge.ITextureProvider
  14. {
  15.  
  16.     protected BlockTropicraftPalmWood(int i, int j)
  17.     {
  18.         super(i, j, Material.wood);
  19.         setTickRandomly(true);
  20.         Block.setBurnProperties(i, 5, 5);
  21.     }
  22.  
  23.     public int quantityDropped(Random random)
  24.     {
  25.         return 1;
  26.     }
  27.    
  28.     @Override
  29.     public String getTextureFile() {
  30.             return "/tropicalmod/tropiterrain.png";
  31.     }
  32.  
  33.     @Override
  34.     public int idDropped(int i, Random random, int j)
  35.     {
  36.         return mod_tropicraft.palmWood.blockID;
  37.     }
  38.  
  39.     public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
  40.     {
  41.         super.harvestBlock(world, entityplayer, i, j, k, l);
  42.     }
  43.  
  44.     public void updateTick(World world, int i, int j, int k, Random random)
  45.     {
  46.         spawnCoconuts(world, i, j, k, random, 20);
  47.     }
  48.    
  49.     public static void spawnCoconuts(World world, int i, int j, int k, Random random, int chance) {
  50.        
  51.         if ((world.getBlockId(i, j + 1, k) == mod_tropicraft.tropicLeaves.blockID && world.getBlockMetadata(i, j + 1, k) == 0) || (world.getBlockId(i, j + 2, k) == mod_tropicraft.tropicLeaves.blockID
  52.                 && world.getBlockMetadata(i, j + 2, k) == 0)) {
  53.             if (world.isAirBlock(i + 1, j, k) && random.nextInt(chance) == 0 ) {
  54.                 world.setBlockWithNotify(i + 1, j, k, mod_tropicraft.coconut.blockID);
  55.                 world.setBlockMetadataWithNotify(i, j, k, 0);
  56.  
  57.             }
  58.             if (world.isAirBlock(i - 1, j, k) && random.nextInt(chance) == 0) {
  59.                 world.setBlockWithNotify(i - 1, j, k, mod_tropicraft.coconut.blockID);
  60.                 world.setBlockMetadataWithNotify(i, j, k, 0);
  61.  
  62.  
  63.             }
  64.             if (world.isAirBlock(i, j, k - 1) && random.nextInt(chance) == 0) {
  65.                 world.setBlockWithNotify(i, j, k - 1, mod_tropicraft.coconut.blockID);
  66.                 world.setBlockMetadataWithNotify(i, j, k, 0);
  67.  
  68.  
  69.             }
  70.             if (world.isAirBlock(i, j, k + 1) && random.nextInt(chance) == 0) {
  71.                 world.setBlockWithNotify(i, j, k + 1, mod_tropicraft.coconut.blockID);
  72.                 world.setBlockMetadataWithNotify(i, j, k, 0);
  73.             }
  74.  
  75.             if (world.isAirBlock(i, j - 1, k) && random.nextInt(chance) == 0) {
  76.                 world.setBlockWithNotify(i, j - 1, k, mod_tropicraft.coconut.blockID);
  77.                 world.setBlockMetadataWithNotify(i, j, k, 0);
  78.             }
  79.         }
  80.        
  81.     }
  82.    
  83.     public int getBlockTextureFromSideAndMetadata(int i, int j)
  84.     {
  85.         if(i == 1)
  86.         {
  87.             return mod_tropicraft.palmWoodBottom;
  88.         }
  89.         if(i == 0)
  90.         {
  91.             return mod_tropicraft.palmWoodBottom;
  92.         } else
  93.         {
  94.             return mod_tropicraft.palmWood.blockIndexInTexture;
  95.         }
  96.     }
  97.  
  98.     protected int damageDropped(int i)
  99.     {
  100.         return i;
  101.     }
  102.    
  103.     public float blockStrength(EntityPlayer entityplayer, int metadata)
  104.     {
  105.         super.blockStrength(entityplayer, metadata);
  106.          if(blockHardness < 0.0F)
  107.          {
  108.              return 0.0F;
  109.          }
  110.          if(!entityplayer.canHarvestBlock(this))
  111.          {
  112.              return 1.0F / blockHardness / 100F;
  113.          } else
  114.          {
  115.              return entityplayer.getCurrentPlayerStrVsBlock(Block.wood, metadata) / blockHardness / 30F;
  116.          }
  117.     }
  118.    
  119.     public void onBlockRemoval(World world, int i, int j, int k)
  120.     {
  121.         byte byte0 = 4;
  122.         int l = byte0 + 1;
  123.         if(world.checkChunksExist(i - l, j - l, k - l, i + l, j + l, k + l))
  124.         {
  125.             for(int i1 = -byte0; i1 <= byte0; i1++)
  126.             {
  127.                 for(int j1 = -byte0; j1 <= byte0; j1++)
  128.                 {
  129.                     for(int k1 = -byte0; k1 <= byte0; k1++)
  130.                     {
  131.                         int l1 = world.getBlockId(i + i1, j + j1, k + k1);
  132.                         if(l1 != mod_tropicraft.tropicLeaves.blockID)
  133.                         {
  134.                             continue;
  135.                         }
  136.                         int i2 = world.getBlockMetadata(i + i1, j + j1, k + k1);
  137.                         if((i2 & 8) == 0)
  138.                         {
  139.                             world.setBlockMetadata(i + i1, j + j1, k + k1, i2 | 8);
  140.                         }
  141.                     }
  142.  
  143.                 }
  144.  
  145.             }
  146.  
  147.         }
  148.     }
  149.        
  150.     @Override
  151.     public int getRenderType()
  152.     {
  153.         return mod_tropicraft.cubeRenderMode;
  154.     }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement