summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockSand.java
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2011-09-26 03:07:06 -0400
committerTahg <tahgtahv@gmail.com>2011-09-26 03:07:46 -0400
commitd226e551ae7b77bc002e6686a36a6374ed515fbc (patch)
tree1b7e23dc7338b928e29cbd453bf0ef68fd7f125b /src/main/java/net/minecraft/server/BlockSand.java
parentb7c43fbff1dffef1b4c9c4e57633d8c16606db58 (diff)
downloadcraftbukkit-d226e551ae7b77bc002e6686a36a6374ed515fbc.tar
craftbukkit-d226e551ae7b77bc002e6686a36a6374ed515fbc.tar.gz
craftbukkit-d226e551ae7b77bc002e6686a36a6374ed515fbc.tar.lz
craftbukkit-d226e551ae7b77bc002e6686a36a6374ed515fbc.tar.xz
craftbukkit-d226e551ae7b77bc002e6686a36a6374ed515fbc.zip
data improvements
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockSand.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockSand.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockSand.java b/src/main/java/net/minecraft/server/BlockSand.java
new file mode 100644
index 00000000..abee35b0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockSand.java
@@ -0,0 +1,64 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockSand extends Block {
+
+ public static boolean instaFall = false;
+
+ public BlockSand(int i, int j) {
+ super(i, j, Material.SAND);
+ }
+
+ public void a(World world, int i, int j, int k) {
+ world.c(i, j, k, this.id, this.c());
+ }
+
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ world.c(i, j, k, this.id, this.c());
+ }
+
+ public void a(World world, int i, int j, int k, Random random) {
+ this.g(world, i, j, k);
+ }
+
+ private void g(World world, int i, int j, int k) {
+ if (d_(world, i, j - 1, k) && j >= 0) {
+ byte b0 = 32;
+
+ if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ EntityFallingSand entityfallingsand = new EntityFallingSand(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
+
+ world.addEntity(entityfallingsand);
+ } else {
+ world.setTypeId(i, j, k, 0);
+
+ while (d_(world, i, j - 1, k) && j > 0) {
+ --j;
+ }
+
+ if (j > 0) {
+ world.setTypeId(i, j, k, this.id);
+ }
+ }
+ }
+ }
+
+ public int c() {
+ return 3;
+ }
+
+ public static boolean d_(World world, int i, int j, int k) {
+ int l = world.getTypeId(i, j, k);
+
+ if (l == 0) {
+ return true;
+ } else if (l == Block.FIRE.id) {
+ return true;
+ } else {
+ Material material = Block.byId[l].material;
+
+ return material == Material.WATER ? true : material == Material.LAVA;
+ }
+ }
+}