Search in sources :

Example 1 with EnumContainerType

use of forestry.core.items.ItemLiquidContainer.EnumContainerType in project ForestryMC by ForestryMC.

the class PluginFluids method doInit.

@Override
public void doInit() {
    for (Fluids fluidType : Fluids.values()) {
        if (fluidType.getFluid() == null) {
            continue;
        }
        for (EnumContainerType type : EnumContainerType.values()) {
            ForestryItem container = fluidType.getContainerForType(type);
            if (container == null) {
                continue;
            }
            LiquidHelper.injectLiquidContainer(fluidType, container.getItemStack());
        }
        for (ItemStack filledContainer : fluidType.getOtherContainers()) {
            LiquidHelper.injectLiquidContainer(fluidType, filledContainer);
        }
    }
}
Also used : Fluids(forestry.core.fluids.Fluids) EnumContainerType(forestry.core.items.ItemLiquidContainer.EnumContainerType) ForestryItem(forestry.core.config.ForestryItem) ItemStack(net.minecraft.item.ItemStack)

Example 2 with EnumContainerType

use of forestry.core.items.ItemLiquidContainer.EnumContainerType 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());
        }
    }
}
Also used : Item(net.minecraft.item.Item) ForestryItem(forestry.core.config.ForestryItem) ItemLiquidContainer(forestry.core.items.ItemLiquidContainer) EnumContainerType(forestry.core.items.ItemLiquidContainer.EnumContainerType) Fluids(forestry.core.fluids.Fluids) ForestryItem(forestry.core.config.ForestryItem)

Aggregations

ForestryItem (forestry.core.config.ForestryItem)2 Fluids (forestry.core.fluids.Fluids)2 EnumContainerType (forestry.core.items.ItemLiquidContainer.EnumContainerType)2 ItemLiquidContainer (forestry.core.items.ItemLiquidContainer)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1