Search in sources :

Example 1 with BlockPartFace

use of net.minecraft.client.renderer.block.model.BlockPartFace in project Binnie by ForestryMC.

the class AABBModelBaker method bakeModel.

@Override
public IModelBakerModel bakeModel(boolean flip) {
    ModelRotation mr = ModelRotation.X0_Y0;
    if (flip) {
        mr = ModelRotation.X0_Y180;
    }
    // Add baked models to the current model.
    for (Pair<IBlockState, IBakedModel> bakedModel : bakedModels) {
        currentModel.addModelQuads(bakedModel);
    }
    for (Pair<IBlockState, IBakedModel> bakedModel : bakedModelsPost) {
        currentModel.addModelQuadsPost(bakedModel);
    }
    for (BoundModelBakerFace face : faces) {
        final AxisAlignedBB modelBounds = face.modelBounds;
        final Vector3f from = new Vector3f((float) modelBounds.minX * 16.0f, (float) modelBounds.minY * 16.0f, (float) modelBounds.minZ * 16.0f);
        final Vector3f to = new Vector3f((float) modelBounds.maxX * 16.0f, (float) modelBounds.maxY * 16.0f, (float) modelBounds.maxZ * 16.0f);
        final EnumFacing myFace = face.face;
        final float[] uvs = getFaceUvs(myFace, to, from);
        final BlockFaceUV uv = new BlockFaceUV(uvs, 0);
        final BlockPartFace bpf = new BlockPartFace(myFace, face.colorIndex, "", uv);
        BakedQuad bf = faceBakery.makeBakedQuad(from, to, bpf, face.spite, myFace, mr, null, true, true);
        currentModel.addQuad(myFace, bf);
    }
    return currentModel;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) IBlockState(net.minecraft.block.state.IBlockState) ModelRotation(net.minecraft.client.renderer.block.model.ModelRotation) Vector3f(org.lwjgl.util.vector.Vector3f) EnumFacing(net.minecraft.util.EnumFacing) BlockPartFace(net.minecraft.client.renderer.block.model.BlockPartFace) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) BlockFaceUV(net.minecraft.client.renderer.block.model.BlockFaceUV)

Example 2 with BlockPartFace

use of net.minecraft.client.renderer.block.model.BlockPartFace in project ForestryMC by ForestryMC.

the class ModelBaker method bakeModel.

@Override
public IModelBakerModel bakeModel(boolean flip) {
    ModelRotation modelRotation = ModelRotation.X0_Y0;
    if (flip) {
        modelRotation = ModelRotation.X0_Y180;
    }
    // Add baked models to the current model.
    for (Pair<IBlockState, IBakedModel> bakedModel : bakedModels) {
        currentModel.addModelQuads(bakedModel);
    }
    for (Pair<IBlockState, IBakedModel> bakedModel : bakedModelsPost) {
        currentModel.addModelQuadsPost(bakedModel);
    }
    for (ModelBakerFace face : faces) {
        EnumFacing facing = face.face;
        BlockFaceUV uvFace = new BlockFaceUV(UVS, 0);
        BlockPartFace partFace = new BlockPartFace(facing, face.colorIndex, "", uvFace);
        BakedQuad quad = FACE_BAKERY.makeBakedQuad(POS_FROM, POS_TO, partFace, face.spite, facing, modelRotation, null, true, true);
        currentModel.addQuad(facing, quad);
    }
    return currentModel;
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) IBlockState(net.minecraft.block.state.IBlockState) ModelRotation(net.minecraft.client.renderer.block.model.ModelRotation) EnumFacing(net.minecraft.util.EnumFacing) BlockPartFace(net.minecraft.client.renderer.block.model.BlockPartFace) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) BlockFaceUV(net.minecraft.client.renderer.block.model.BlockFaceUV)

Aggregations

IBlockState (net.minecraft.block.state.IBlockState)2 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)2 BlockFaceUV (net.minecraft.client.renderer.block.model.BlockFaceUV)2 BlockPartFace (net.minecraft.client.renderer.block.model.BlockPartFace)2 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)2 ModelRotation (net.minecraft.client.renderer.block.model.ModelRotation)2 EnumFacing (net.minecraft.util.EnumFacing)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vector3f (org.lwjgl.util.vector.Vector3f)1