craftbukkit/src/main/java/net/minecraft/server/BlockTNT.java
Warren Loo c100e20d60 Reverting the Drop API for now, we need to re-evalute this as it is causing too many issues and blocking releases.
This reverts commits:
- d2d03afc8854394aeefb40ea5ebf224c8032b19f
- 6245746e91123dd8ef70e5f15b7cdfc7e36d8e8c
- 41fae5c613e9e69a8f6bdf33b23bb09d7f407433
- c34bdecab42cf4098054a5ea43e1c2958d44ae92
- d7445084ac9a90fa0b66d8b050b8d0d2a062eaf3
- 6a6ed2e6ae2328a8a791bcc6857c44dc6c6a7030
- a783bc4dc95da8e26c673abe48fad96b550aba28
- cb50fd68766df8e07631ba5be85759f8257e8068
- 34dfff2ad5c407c712b2783f02960aac5e8649f2
- f33b513820de987b49a4338e85df80968217a601
- 5fd9fdfde055e6eb6a83db246d009b69377b7c94
- 2795b116f40d06551fbb7b96d1963c0ddbeac384
2012-03-27 20:04:26 -04:00

71 lines
2.4 KiB
Java

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);
if (!world.suppressPhysics && world.isBlockIndirectlyPowered(i, j, k)) { // CraftBukkit
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) {
if (!world.isStatic) {
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.U() != null && entityhuman.U().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;
}
}