use of forestry.core.items.ItemLiquidContainer in project ForestryMC by ForestryMC.
the class LiquidHelper method injectLiquidContainer.
public static void injectLiquidContainer(Fluids fluid, ItemStack filled) {
Item item = filled.getItem();
if (item.getContainerItem() instanceof ItemBucket) {
LiquidHelper.injectLiquidContainer(fluid, Defaults.BUCKET_VOLUME, filled, new ItemStack(Items.bucket));
return;
} else if (item instanceof ItemLiquidContainer) {
ItemLiquidContainer liquidContainer = (ItemLiquidContainer) item;
switch(liquidContainer.getType()) {
case CAN:
LiquidHelper.injectTinContainer(fluid, Defaults.BUCKET_VOLUME, filled, ForestryItem.canEmpty.getItemStack());
return;
case CAPSULE:
LiquidHelper.injectWaxContainer(fluid, Defaults.BUCKET_VOLUME, filled, ForestryItem.waxCapsule.getItemStack());
return;
case REFRACTORY:
LiquidHelper.injectRefractoryContainer(fluid, Defaults.BUCKET_VOLUME, filled, ForestryItem.refractoryEmpty.getItemStack());
return;
}
}
Proxies.log.warning("Unable to inject liquid container: " + filled);
}
use of forestry.core.items.ItemLiquidContainer in project ForestryMC by ForestryMC.
the class PluginFluids method registerItems.
@Override
public void registerItems() {
for (EnumContainerType type : EnumContainerType.values()) {
Item emptyContainer = new ItemLiquidContainer(type, Blocks.air, null);
switch(type) {
case CAN:
ForestryItem.canEmpty.registerItem(emptyContainer, "canEmpty");
break;
case CAPSULE:
ForestryItem.waxCapsule.registerItem(emptyContainer, "waxCapsule");
break;
case REFRACTORY:
ForestryItem.refractoryEmpty.registerItem(emptyContainer, "refractoryEmpty");
break;
}
for (Fluids fluidType : Fluids.values()) {
ForestryItem container = fluidType.getContainerForType(type);
if (container == null) {
continue;
}
ItemLiquidContainer liquidContainer = new ItemLiquidContainer(type, fluidType.getBlock(), fluidType.getColor());
fluidType.setProperties(liquidContainer);
container.registerItem(liquidContainer, container.toString());
}
}
}
Aggregations