Example usage for net.minecraftforge.client.model ItemTextureQuadConverter convertTexture

List of usage examples for net.minecraftforge.client.model ItemTextureQuadConverter convertTexture

Introduction

In this page you can find the example usage for net.minecraftforge.client.model ItemTextureQuadConverter convertTexture.

Prototype

public static List<BakedQuad> convertTexture(TransformationMatrix transform, TextureAtlasSprite template,
        TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) 

Source Link

Document

Takes a texture and converts it into BakedQuads.

Usage

From source file:mod.rankshank.arbitraria.client.item.spraybottle.ModelSprayBottleFluid.java

@Override
@SuppressWarnings({ "ConstantConditions", "Guava" })
public IBakedModel bake(IModelState state, VertexFormat format,
        Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = IPerspectiveAwareModel.MapWrapper
            .getTransforms(state);/*from w  w w.j  a v  a2s. c o  m*/
    ImmutableList.Builder<BakedQuad> bob = ImmutableList.builder();
    TRSRTransformation transform = state.apply(Optional.absent()).or(TRSRTransformation.identity());
    TextureAtlasSprite fluidSprite = null;

    if (this.bottle != null)
        bob.addAll(new ItemLayerModel(ImmutableList.of(this.bottle)).bake(state, format, bakedTextureGetter)
                .getQuads(null, null, 0L));

    if (this.filler != null && this.fluid != null
            && (fluidSprite = bakedTextureGetter.apply(this.fluid.getStill())) != null) {
        TextureAtlasSprite fillerSprite = bakedTextureGetter.apply(this.filler);
        bob.addAll(ItemTextureQuadConverter.convertTexture(format, transform, fillerSprite, fluidSprite,
                0.468625f, EnumFacing.NORTH, fluid.getColor()));
        bob.addAll(ItemTextureQuadConverter.convertTexture(format, transform, fillerSprite, fluidSprite,
                0.531375f, EnumFacing.SOUTH, fluid.getColor()));
    }

    return new BakedSprayBottleFluid(this, bob.build(), fluidSprite, format, transformMap);
}