use of net.glowstone.block.itemtype.ItemTool in project Glowstone by GlowstoneMC.
the class FlintAndSteelDispenseBehavior method dispenseStack.
@Override
protected ItemStack dispenseStack(GlowBlock block, ItemStack stack) {
GlowBlock target = block.getRelative(BlockDispenser.getFacing(block));
successful = true;
if (target.getType() == Material.AIR) {
target.setType(Material.FIRE);
stack.setDurability((short) (stack.getDurability() + 1));
ItemType type = ItemTable.instance().getItem(stack.getType());
if (!(type instanceof ItemTool)) {
return stack;
}
ItemTool toolType = (ItemTool) type;
if (stack.getDurability() > toolType.getMaxDurability()) {
stack.setAmount(0);
}
} else if (target.getType() == Material.TNT) {
BlockTNT.igniteBlock(target, false);
} else {
successful = false;
}
return stack.getAmount() > 0 ? stack : null;
}