Example usage for net.minecraftforge.registries ForgeRegistries FLUIDS

List of usage examples for net.minecraftforge.registries ForgeRegistries FLUIDS

Introduction

In this page you can find the example usage for net.minecraftforge.registries ForgeRegistries FLUIDS.

Prototype

IForgeRegistry FLUIDS

To view the source code for net.minecraftforge.registries ForgeRegistries FLUIDS.

Click Source Link

Usage

From source file:com.teambrmodding.assistedprogression.client.model.ModelPipette.java

License:Creative Commons License

/**
 * Process the model, used when adding data to the model
 * @param customData Custom info// w ww. jav  a 2  s .c  o m
 * @return An instance of the model with custom data applied
 */
@Override
public ModelPipette process(ImmutableMap<String, String> customData) {
    Fluid fluid = ForgeRegistries.FLUIDS.getValue(new ResourceLocation(customData.get("fluid")));

    if (fluid == null)
        fluid = this.fluid;

    // create new model with correct liquid
    return new ModelPipette(fluid);
}

From source file:com.teambrmodding.assistedprogression.common.item.PipetteItem.java

License:Creative Commons License

/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 *///from   w  w  w. ja  v a 2  s  .co m
@Override
public void fillItemGroup(ItemGroup itemIn, NonNullList<ItemStack> tab) {
    if (itemIn == ItemManager.itemGroupAssistedProgressionPipettes) {
        tab.add(new ItemStack(this));

        // Add for all fluids
        ForgeRegistries.FLUIDS.getValues().stream().filter(fluid -> fluid.isSource(fluid.getDefaultState()))
                .forEach(fluid -> {
                    ItemStack pipetteStack = new ItemStack(this);
                    FluidHandlerItemStack fluidStack = new FluidHandlerItemStack(pipetteStack,
                            FluidAttributes.BUCKET_VOLUME);
                    if (fluidStack.fill(new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME),
                            IFluidHandler.FluidAction.EXECUTE) == FluidAttributes.BUCKET_VOLUME)
                        tab.add(pipetteStack);
                });
    }
}