Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.Random;
- public class BlockGrassStep extends Block
- {
- protected BlockGrassStep(int i, boolean flag)
- {
- super(i, Material.ground);
- blockIndexInTexture = 3;
- setTickOnLoad(true);
- if(!flag)
- {
- setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
- }
- setLightOpacity(255);
- }
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- if(this != mod_HG.GrassStep)
- {
- super.shouldSideBeRendered(iblockaccess, i, j, k, l);
- }
- if(l == 1)
- {
- return true;
- }
- if(!super.shouldSideBeRendered(iblockaccess, i, j, k, l))
- {
- return false;
- }
- if(l == 0)
- {
- return true;
- } else
- {
- return iblockaccess.getBlockId(i, j, k) != blockID;
- }
- }
- public boolean renderAsNormalBlock()
- {
- return blockType;
- }
- public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- if(l == 1)
- {
- return 0;
- }
- if(l == 0)
- {
- return 2;
- }
- Material material = iblockaccess.getBlockMaterial(i, j + 1, k);
- return material != Material.snow && material != Material.builtSnow ? 3 : 68;
- }
- public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
- {
- iblockaccess.getWorldChunkManager().func_4069_a(i, k, 1, 1);
- double d = iblockaccess.getWorldChunkManager().temperature[0];
- double d1 = iblockaccess.getWorldChunkManager().humidity[0];
- return ColorizerGrass.getGrassColor(d, d1);
- }
- public void updateTick(World world, int i, int j, int k, Random random)
- {
- if(world.multiplayerWorld)
- {
- return;
- }
- if(world.getBlockLightValue(i, j + 1, k) < 4 && world.getBlockMaterial(i, j + 1, k).getCanBlockGrass())
- {
- if(random.nextInt(4) != 0)
- {
- return;
- }
- world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
- } else
- if(world.getBlockLightValue(i, j + 1, k) >= 9)
- {
- int l = (i + random.nextInt(3)) - 1;
- int i1 = (j + random.nextInt(5)) - 3;
- int j1 = (k + random.nextInt(3)) - 1;
- if(world.getBlockId(l, i1, j1) == Block.dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
- {
- world.setBlockWithNotify(l, i1, j1, Block.grass.blockID);
- }
- if(world.getBlockId(l, i1, j1) == mod_HG.DirtStep.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && !world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
- {
- world.setBlockWithNotify(l, i1, j1, mod_HG.GrassStep.blockID);
- }
- }
- }
- public int idDropped(int i, Random random)
- {
- return Block.dirt.idDropped(0, random);
- }
- private boolean blockType;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement