-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockSand.java
More file actions
81 lines (70 loc) · 2.23 KB
/
BlockSand.java
File metadata and controls
81 lines (70 loc) · 2.23 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
71
72
73
74
75
76
77
78
79
80
81
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 BlockSand extends Block
{
public BlockSand(int i, int j)
{
super(i, j, Material.sand);
}
public void onBlockAdded(World world, int i, int j, int k)
{
world.func_22136_c(i, j, k, blockID, tickRate());
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
world.func_22136_c(i, j, k, blockID, tickRate());
}
public void updateTick(World world, int i, int j, int k, Random random)
{
tryToFall(world, i, j, k);
}
private void tryToFall(World world, int i, int j, int k)
{
int l = i;
int i1 = j;
int j1 = k;
if(canFallBelow(world, l, i1 - 1, j1) && i1 >= 0)
{
byte byte0 = 32;
if(fallInstantly || !world.checkChunksExist(i - byte0, j - byte0, k - byte0, i + byte0, j + byte0, k + byte0))
{
world.setBlockWithNotify(i, j, k, 0);
for(; canFallBelow(world, i, j - 1, k) && j > 0; j--) { }
if(j > 0)
{
world.setBlockWithNotify(i, j, k, blockID);
}
} else
{
EntityFallingSand entityfallingsand = new EntityFallingSand(world, (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, blockID);
world.entityJoinedWorld(entityfallingsand);
}
}
}
public int tickRate()
{
return 3;
}
public static boolean canFallBelow(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
if(l == 0)
{
return true;
}
if(l == Block.fire.blockID)
{
return true;
}
Material material = Block.blocksList[l].blockMaterial;
if(material == Material.water)
{
return true;
}
return material == Material.lava;
}
public static boolean fallInstantly = false;
}