Java 类net.minecraftforge.client.model.ISmartBlockModel 实例源码

项目:NOVA-Core    文件:FWSmartBlockModel.java   
@Override
public ISmartBlockModel handleBlockState(IBlockState state) {
    FWBlock block = (FWBlock) state.getBlock();

    Block blockInstance = block.getBlockInstance(block.lastExtendedWorld, VectorConverter.instance().toNova(block.lastExtendedStatePos));

    if (blockInstance.components.has(StaticRenderer.class)) {
        return new FWSmartBlockModel(blockInstance);
    }

    return new FWEmptyModel();
}
项目:ZeldaSwordSkills    文件:ModelDungeonBlock.java   
@Override
public IBakedModel handleBlockState(IBlockState state) {
    if (state instanceof IExtendedBlockState) {
        IBlockState renderState = ((IExtendedBlockState) state).getValue(BlockDungeonStone.RENDER_BLOCK);
        if (renderState != null) {
            IBakedModel renderModel = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(renderState);
            if (renderModel instanceof ISmartBlockModel) {
                renderModel = ((ISmartBlockModel) renderModel).handleBlockState(renderState);
            }
            return renderModel;
        }
    }
    return defaultModel;
}
项目:NOVA-Core    文件:FWEmptyModel.java   
@Override
public ISmartBlockModel handleBlockState(IBlockState state) {
    return this;
}
项目:GearSwapper1.8    文件:ClientProxy.java   
@SubscribeEvent
public void onModelBakeEvent(ModelBakeEvent event) {
    for (Map.Entry<String, Block> entry : GearSwapperBlock.nameToMimicingBlock.entrySet()) {
        event.modelRegistry.putObject(new ModelResourceLocation(entry.getKey()),
                new ISmartBlockModel() {
                    private IBakedModel model;

                    @Override
                    public IBakedModel handleBlockState(IBlockState state) {
                        if (model == null) {
                            model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(entry.getValue().getDefaultState());
                            ;
                        }
                        return model;
                    }

                    @Override
                    public List<BakedQuad> getFaceQuads(EnumFacing f) {
                        return model.getFaceQuads(f);
                    }

                    @Override
                    public List<BakedQuad> getGeneralQuads() {
                        return model.getGeneralQuads();
                    }

                    @Override
                    public boolean isAmbientOcclusion() {
                        return model.isAmbientOcclusion();
                    }

                    @Override
                    public boolean isGui3d() {
                        return model.isGui3d();
                    }

                    @Override
                    public boolean isBuiltInRenderer() {
                        return model.isBuiltInRenderer();
                    }

                    @Override
                    public TextureAtlasSprite getParticleTexture() {
                        return model.getParticleTexture();
                    }

                    @Override
                    public ItemCameraTransforms getItemCameraTransforms() {
                        return model.getItemCameraTransforms();
                    }
                });

    }

}