geforkt von Mirrors/Paper
39 Zeilen
1.3 KiB
Java
39 Zeilen
1.3 KiB
Java
|
package net.minecraft.server;
|
||
|
|
||
|
final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
|
||
|
|
||
|
private boolean b = true;
|
||
|
|
||
|
DispenseBehaviorFlintAndSteel() {}
|
||
|
|
||
|
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||
|
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
|
||
|
World world = isourceblock.k();
|
||
|
int i = isourceblock.getBlockX() + enumfacing.c();
|
||
|
int j = isourceblock.getBlockY() + enumfacing.d();
|
||
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||
|
|
||
|
if (world.isEmpty(i, j, k)) {
|
||
|
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
|
||
|
if (itemstack.isDamaged(1, world.random)) {
|
||
|
itemstack.count = 0;
|
||
|
}
|
||
|
} else if (world.getTypeId(i, j, k) == Block.TNT.id) {
|
||
|
Block.TNT.postBreak(world, i, j, k, 1);
|
||
|
world.setAir(i, j, k);
|
||
|
} else {
|
||
|
this.b = false;
|
||
|
}
|
||
|
|
||
|
return itemstack;
|
||
|
}
|
||
|
|
||
|
protected void a(ISourceBlock isourceblock) {
|
||
|
if (this.b) {
|
||
|
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||
|
} else {
|
||
|
isourceblock.k().triggerEffect(1001, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||
|
}
|
||
|
}
|
||
|
}
|