diff options
author | feildmaster <admin@feildmaster.com> | 2012-08-08 05:19:19 -0500 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2012-08-08 19:49:08 -0500 |
commit | 8d946b88b3b96be1f6ae6b21bca915b73909e0bb (patch) | |
tree | 115403f8724fbbd5acfb5ed4b921e8b110d5a4a9 /src/main/java | |
parent | a16e0b6323eb58a58a8b859b3af6891876598da9 (diff) | |
download | craftbukkit-8d946b88b3b96be1f6ae6b21bca915b73909e0bb.tar craftbukkit-8d946b88b3b96be1f6ae6b21bca915b73909e0bb.tar.gz craftbukkit-8d946b88b3b96be1f6ae6b21bca915b73909e0bb.tar.lz craftbukkit-8d946b88b3b96be1f6ae6b21bca915b73909e0bb.tar.xz craftbukkit-8d946b88b3b96be1f6ae6b21bca915b73909e0bb.zip |
Add BlockMobSpawner and BlockOre for diff visibility
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockMobSpawner.java | 33 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/BlockOre.java | 56 |
2 files changed, 89 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java new file mode 100644 index 00000000..bff4d028 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java @@ -0,0 +1,33 @@ +package net.minecraft.server; + +import java.util.Random; + +public class BlockMobSpawner extends BlockContainer { + + protected BlockMobSpawner(int i, int j) { + super(i, j, Material.STONE); + } + + public TileEntity a(World world) { + return new TileEntityMobSpawner(); + } + + public int getDropType(int i, Random random, int j) { + return 0; + } + + public int a(Random random) { + return 0; + } + + public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { + super.dropNaturally(world, i, j, k, l, f, i1); + int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15); + + this.g(world, i, j, k, j1); + } + + public boolean d() { + return false; + } +} diff --git a/src/main/java/net/minecraft/server/BlockOre.java b/src/main/java/net/minecraft/server/BlockOre.java new file mode 100644 index 00000000..48246357 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockOre.java @@ -0,0 +1,56 @@ +package net.minecraft.server; + +import java.util.Random; + +public class BlockOre extends Block { + + public BlockOre(int i, int j) { + super(i, j, Material.STONE); + this.a(CreativeModeTab.b); + } + + public int getDropType(int i, Random random, int j) { + return this.id == Block.COAL_ORE.id ? Item.COAL.id : (this.id == Block.DIAMOND_ORE.id ? Item.DIAMOND.id : (this.id == Block.LAPIS_ORE.id ? Item.INK_SACK.id : (this.id == Block.EMERALD_ORE.id ? Item.EMERALD.id : this.id))); + } + + public int a(Random random) { + return this.id == Block.LAPIS_ORE.id ? 4 + random.nextInt(5) : 1; + } + + public int getDropCount(int i, Random random) { + if (i > 0 && this.id != this.getDropType(0, random, i)) { + int j = random.nextInt(i + 2) - 1; + + if (j < 0) { + j = 0; + } + + return this.a(random) * (j + 1); + } else { + return this.a(random); + } + } + + public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { + super.dropNaturally(world, i, j, k, l, f, i1); + if (this.getDropType(l, world.random, i1) != this.id) { + int j1 = 0; + + if (this.id == Block.COAL_ORE.id) { + j1 = MathHelper.a(world.random, 0, 2); + } else if (this.id == Block.DIAMOND_ORE.id) { + j1 = MathHelper.a(world.random, 3, 7); + } else if (this.id == Block.EMERALD_ORE.id) { + j1 = MathHelper.a(world.random, 3, 7); + } else if (this.id == Block.LAPIS_ORE.id) { + j1 = MathHelper.a(world.random, 2, 5); + } + + this.g(world, i, j, k, j1); + } + } + + protected int getDropData(int i) { + return this.id == Block.LAPIS_ORE.id ? 4 : 0; + } +} |