use of gregtech.api.capability.impl.ElectricItem in project GregTech by GregTechCE.
the class MetaItem method initCapabilities.
// ////////////////////////////////////////////////////////////////
// FluidContainer Stuff //
// ////////////////////////////////////////////////////////////////
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
T metaValueItem = getItem(stack);
if (metaValueItem == null) {
return null;
}
IFluidStats fluidStats = metaValueItem.getFluidStats();
IElectricStats electricStats = metaValueItem.getElectricStats();
if (electricStats != null && fluidStats != null) {
ThermalFluidHandlerItemStack handlerItemStack = new ThermalFluidHandlerItemStack(stack, fluidStats.getCapacity(stack), fluidStats.getMinFluidTemperature(stack), fluidStats.getMaxFluidTemperature(stack));
ElectricItem electricItem = new ElectricItem(electricStats.getMaxCharge(), electricStats.getTier(), electricStats.isChargeable(), electricStats.isDischargeable());
return new CombinedCapabilityProvider(handlerItemStack, electricItem);
}
if (fluidStats != null) {
return new ThermalFluidHandlerItemStack(stack, fluidStats.getCapacity(stack), fluidStats.getMinFluidTemperature(stack), fluidStats.getMaxFluidTemperature(stack));
}
if (electricStats != null) {
return new ElectricItem(electricStats.getMaxCharge(), electricStats.getTier(), electricStats.isChargeable(), electricStats.isDischargeable());
}
return null;
}
Aggregations