Example usage for net.minecraftforge.fluids IFluidBlock getFluid

List of usage examples for net.minecraftforge.fluids IFluidBlock getFluid

Introduction

In this page you can find the example usage for net.minecraftforge.fluids IFluidBlock getFluid.

Prototype

Fluid getFluid();

Source Link

Document

Returns the Fluid associated with this Block.

Usage

From source file:com.globbypotato.rockhounding_chemistry.fluids.FluidModelHandler.java

License:Open Source License

private void registerFluidModel(IFluidBlock fluidBlock) {
    final Item item = Item.getItemFromBlock((Block) fluidBlock);
    ModelBakery.registerItemVariants(item);
    final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(FLUID_MODEL_PATH,
            fluidBlock.getFluid().getName());
    ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create(stack -> modelResourceLocation));
    ModelLoader.setCustomStateMapper((Block) fluidBlock, new StateMapperBase() {
        @Override/*from   ww  w  .ja  va2 s .c  o  m*/
        protected ModelResourceLocation getModelResourceLocation(IBlockState p_178132_1_) {
            return modelResourceLocation;
        }
    });
}

From source file:com.globbypotato.rockhounding_surface.fluids.FluidModelHandler.java

License:Open Source License

private void registerFluidModel(IFluidBlock fluidBlock) {
    final Item item = Item.getItemFromBlock((Block) fluidBlock);

    ModelBakery.registerItemVariants(item);

    final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(FLUID_MODEL_PATH,
            fluidBlock.getFluid().getName());

    ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create(stack -> modelResourceLocation));

    ModelLoader.setCustomStateMapper((Block) fluidBlock, new StateMapperBase() {
        @Override// w w w  .  ja va  2  s.c  o  m
        protected ModelResourceLocation getModelResourceLocation(IBlockState p_178132_1_) {
            return modelResourceLocation;
        }
    });
}