use of net.glowstone.block.itemtype.ItemFilledBucket in project Glowstone by GlowstoneMC.
the class BucketDispenseBehavior method dispenseStack.
@Override
protected ItemStack dispenseStack(GlowBlock block, ItemStack stack) {
ItemFilledBucket bucket = (ItemFilledBucket) ItemTable.instance().getItem(stack.getType());
BlockLiquid liquid = (BlockLiquid) bucket.getLiquid();
BlockFace facing = BlockDispenser.getFacing(block);
GlowBlock target = block.getRelative(facing);
if (canPlace(target, facing, stack)) {
target.setType(liquid.getMaterial());
stack.setType(Material.BUCKET);
stack.setAmount(1);
return stack;
} else {
return defaultBehavior.dispense(block, stack);
}
}
Aggregations