Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.19 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3.  
  4. import java.util.Random;
  5.  
  6. public class BlockGrassStep extends Block
  7. {
  8.  
  9.     protected BlockGrassStep(int i, boolean flag)
  10.     {
  11.         super(i, Material.ground);
  12.         blockIndexInTexture = 3;
  13.         setTickOnLoad(true);
  14.        
  15.                 if(!flag)
  16.         {
  17.             setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
  18.         }
  19.         setLightOpacity(255);
  20.     }
  21.    
  22.         public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
  23.     {
  24.         if(this != mod_HG.GrassStep)
  25.         {
  26.             super.shouldSideBeRendered(iblockaccess, i, j, k, l);
  27.         }
  28.         if(l == 1)
  29.         {
  30.             return true;
  31.         }
  32.         if(!super.shouldSideBeRendered(iblockaccess, i, j, k, l))
  33.         {
  34.             return false;
  35.         }
  36.         if(l == 0)
  37.         {
  38.             return true;
  39.         } else
  40.         {
  41.             return iblockaccess.getBlockId(i, j, k) != blockID;
  42.         }
  43.     }
  44.     public boolean renderAsNormalBlock()
  45.     {
  46.         return blockType;
  47.     }
  48.  
  49.     public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
  50.     {
  51.         if(l == 1)
  52.         {
  53.             return 0;
  54.         }
  55.         if(l == 0)
  56.         {
  57.             return 2;
  58.         }
  59.         Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
  60.         return material != Material.snow && material != Material.builtSnow ? 3 : 68;
  61.     }
  62.  
  63.     public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
  64.     {
  65.         iblockaccess.getWorldChunkManager().func_4069_a(i, k, 1, 1);
  66.         double d = iblockaccess.getWorldChunkManager().temperature[0];
  67.         double d1 = iblockaccess.getWorldChunkManager().humidity[0];
  68.         return ColorizerGrass.getGrassColor(d, d1);
  69.     }
  70.  
  71.     public void updateTick(World world, int i, int j, int k, Random random)
  72.     {
  73.         if(world.multiplayerWorld)
  74.         {
  75.             return;
  76.         }
  77.         if(world.getBlockLightValue(i, j + 1, k) < 4 && world.getBlockMaterial(i, j + 1, k).getCanBlockGrass())
  78.         {
  79.             if(random.nextInt(4) != 0)
  80.             {
  81.                 return;
  82.             }
  83.             world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
  84.         } else
  85.         if(world.getBlockLightValue(i, j + 1, k) >= 9)
  86.         {
  87.             int l = (i + random.nextInt(3)) - 1;
  88.             int i1 = (j + random.nextInt(5)) - 3;
  89.             int j1 = (k + random.nextInt(3)) - 1;
  90.             if(world.getBlockId(l, i1, j1) == Block.dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
  91.             {
  92.                 world.setBlockWithNotify(l, i1, j1, Block.grass.blockID);
  93.             }
  94.                         if(world.getBlockId(l, i1, j1) == mod_HG.DirtStep.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
  95.             {
  96.                 world.setBlockWithNotify(l, i1, j1, mod_HG.GrassStep.blockID);
  97.             }
  98.         }
  99.     }
  100.  
  101.     public int idDropped(int i, Random random)
  102.     {
  103.         return Block.dirt.idDropped(0, random);
  104.     }
  105.    
  106.         private boolean blockType;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement