-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockGrass.java
More file actions
70 lines (63 loc) · 2.22 KB
/
BlockGrass.java
File metadata and controls
70 lines (63 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.Random;
public class BlockGrass extends Block
{
protected BlockGrass(int i)
{
super(i, Material.ground);
blockIndexInTexture = 3;
setTickOnLoad(true);
}
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.func_4147_a(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);
}
}
}
public int idDropped(int i, Random random)
{
return Block.dirt.idDropped(0, random);
}
}