Search in sources :

Example 1 with ExtBlockstateAdapter

use of blusunrize.immersiveengineering.client.models.smart.ConnModelReal.ExtBlockstateAdapter in project ImmersiveEngineering by BluSunrize.

the class IESmartObjModel method getQuads.

public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand, OBJState objstate, Map<String, String> tex, boolean addAnimationAndTex) {
    texReplace = tex;
    this.tempState = blockState;
    if (blockState instanceof IExtendedBlockState) {
        IExtendedBlockState exState = (IExtendedBlockState) blockState;
        ExtBlockstateAdapter adapter;
        if (objstate != null) {
            if (objstate.parent == null || objstate.parent == TRSRTransformation.identity())
                objstate.parent = this.getState();
            if (objstate.getVisibilityMap().containsKey(Group.ALL) || objstate.getVisibilityMap().containsKey(Group.ALL_EXCEPT))
                this.updateStateVisibilityMap(objstate);
        }
        if (addAnimationAndTex)
            adapter = new ExtBlockstateAdapter(exState, MinecraftForgeClient.getRenderLayer(), ExtBlockstateAdapter.CONNS_OBJ_CALLBACK, new Object[] { objstate, tex });
        else
            adapter = new ExtBlockstateAdapter(exState, MinecraftForgeClient.getRenderLayer(), ExtBlockstateAdapter.CONNS_OBJ_CALLBACK);
        List<BakedQuad> quads = modelCache.get(adapter);
        if (quads == null) {
            IESmartObjModel model = null;
            if (objstate != null)
                model = new IESmartObjModel(baseModel, getModel(), objstate, getFormat(), getTextures(), transformationMap, isDynamic);
            if (model == null)
                model = new IESmartObjModel(baseModel, getModel(), this.getState(), getFormat(), getTextures(), transformationMap, isDynamic);
            model.tempState = blockState;
            model.texReplace = tex;
            quads = model.buildQuads();
            modelCache.put(adapter, quads);
        }
        return Collections.synchronizedList(Lists.newArrayList(quads));
    }
    if (bakedQuads == null)
        bakedQuads = buildQuads();
    List<BakedQuad> quadList = Lists.newArrayList(bakedQuads);
    return Collections.synchronizedList(quadList);
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) ExtBlockstateAdapter(blusunrize.immersiveengineering.client.models.smart.ConnModelReal.ExtBlockstateAdapter) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Aggregations

ExtBlockstateAdapter (blusunrize.immersiveengineering.client.models.smart.ConnModelReal.ExtBlockstateAdapter)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)1