use of gregtech.api.items.IToolItem in project GregTech by GregTechCE.
the class PlungerBehaviour method createProvider.
@Override
public ICapabilityProvider createProvider(ItemStack itemStack) {
return new VoidFluidHandlerItemStack(itemStack) {
@Override
public int fill(FluidStack resource, boolean doFill) {
int result = super.fill(resource, doFill);
if (result > 0) {
// Adjust the fluid amount based on remaining durability/charge of the item
final ItemStack container = getContainer();
final IToolItem plunger = (IToolItem) container.getItem();
double operations = result;
operations /= 1000;
final int damage = (int) Math.ceil(operations);
result = 1000 * plunger.damageItem(container, damage, true, !doFill);
}
// TODO play sound (how to get the player?)
return result;
}
};
}
Aggregations