summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockTNT.java
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2012-01-17 19:37:58 -0500
committerEvilSeph <evilseph@gmail.com>2012-01-24 05:18:23 -0500
commitc7716e1de4eac70725d39994909a23e71b188dab (patch)
tree26d9b87ab8fb04fdca41589bfe1241d303c9692c /src/main/java/net/minecraft/server/BlockTNT.java
parente92bdab57a1bc5a02801fbf1568e746a66678c3a (diff)
downloadcraftbukkit-c7716e1de4eac70725d39994909a23e71b188dab.tar
craftbukkit-c7716e1de4eac70725d39994909a23e71b188dab.tar.gz
craftbukkit-c7716e1de4eac70725d39994909a23e71b188dab.tar.lz
craftbukkit-c7716e1de4eac70725d39994909a23e71b188dab.tar.xz
craftbukkit-c7716e1de4eac70725d39994909a23e71b188dab.zip
[Bleeding] Audit of onPlace methods, Moved to postPlace as appropriate.
Closes BUKKIT-89
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockTNT.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockTNT.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
new file mode 100644
index 00000000..c4ddec8b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -0,0 +1,75 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockTNT extends Block {
+
+ public BlockTNT(int i, int j) {
+ super(i, j, Material.TNT);
+ }
+
+ public int a(int i) {
+ return i == 0 ? this.textureId + 2 : (i == 1 ? this.textureId + 1 : this.textureId);
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ super.onPlace(world, i, j, k);
+ // CraftBukkit start - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
+ }
+
+ public void postPlace(World world, int i, int j, int k, int l) {
+ super.postPlace(world, i, j, k, l);
+ // CraftBukkit end
+ if (world.isBlockIndirectlyPowered(i, j, k)) {
+ this.postBreak(world, i, j, k, 1);
+ world.setTypeId(i, j, k, 0);
+ }
+ }
+
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ if (l > 0 && Block.byId[l].isPowerSource() && world.isBlockIndirectlyPowered(i, j, k)) {
+ this.postBreak(world, i, j, k, 1);
+ world.setTypeId(i, j, k, 0);
+ }
+ }
+
+ public int a(Random random) {
+ return 0;
+ }
+
+ public void wasExploded(World world, int i, int j, int k) {
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
+
+ entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
+ world.addEntity(entitytntprimed);
+ }
+
+ public void postBreak(World world, int i, int j, int k, int l) {
+ if (!world.isStatic) {
+ if ((l & 1) == 0) {
+ this.a(world, i, j, k, new ItemStack(Block.TNT.id, 1, 0));
+ } else {
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
+
+ world.addEntity(entitytntprimed);
+ world.makeSound(entitytntprimed, "random.fuse", 1.0F, 1.0F);
+ }
+ }
+ }
+
+ public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
+ if (entityhuman.Q() != null && entityhuman.Q().id == Item.FLINT_AND_STEEL.id) {
+ world.setRawData(i, j, k, 1);
+ }
+
+ super.attack(world, i, j, k, entityhuman);
+ }
+
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ return super.interact(world, i, j, k, entityhuman);
+ }
+
+ protected ItemStack a_(int i) {
+ return null;
+ }
+}