use of net.minecraft.client.renderer.model.IBakedModel in project Bookshelf by Darkhax-Minecraft.
the class RenderUtils method renderBlock.
/**
* Renders a block state into the world. This only exists for optifine compatibility mode.
*
* @param state The state to render.
* @param world The world context to render into.
* @param pos The position of the block.
* @param matrix The render matrix.
* @param buffer The render buffer.
*/
private static void renderBlock(BlockState state, World world, BlockPos pos, MatrixStack matrix, IRenderTypeBuffer buffer) {
final BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRenderer();
final IBakedModel model = dispatcher.getBlockModel(state);
final boolean useAO = Minecraft.useAmbientOcclusion() && state.getLightValue(world, pos) == 0 && model.useAmbientOcclusion();
final RenderType type = RenderUtils.findRenderType(state);
if (type != null) {
ForgeHooksClient.setRenderLayer(type);
final IVertexBuilder builder = buffer.getBuffer(type);
renderModel(dispatcher.getModelRenderer(), useAO, world, model, state, pos, matrix, builder, false, OverlayTexture.NO_OVERLAY);
ForgeHooksClient.setRenderLayer(null);
}
}
use of net.minecraft.client.renderer.model.IBakedModel in project Overloaded by CJ-MC-Mods.
the class RenderMultiToolAssist method renderRemovePreview.
private static void renderRemovePreview(RenderWorldLastEvent event, BlockRayTraceResult result) {
IBakedModel bakeModel = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation(MODID + ":remove_preview", ""));
BlockPos toRenderAt = result.getBlockPos();
renderBlockModel(event, toRenderAt, bakeModel, Blocks.COBBLESTONE.defaultBlockState());
}
use of net.minecraft.client.renderer.model.IBakedModel in project Overloaded by CJ-MC-Mods.
the class ClientProxy method bakeModelAndPut.
private static void bakeModelAndPut(ResourceLocation raw, ResourceLocation baked, ModelBakeEvent event) {
IUnbakedModel unbakedModel = event.getModelLoader().getModel(raw);
IBakedModel bakedModel = unbakedModel.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), ModelRotation.X0_Y0, baked);
event.getModelRegistry().put(baked, bakedModel);
}
use of net.minecraft.client.renderer.model.IBakedModel in project Overloaded by CJ-MC-Mods.
the class RenderMultiToolAssist method renderBlockPreview.
private static void renderBlockPreview(RenderWorldLastEvent event, BlockRayTraceResult result, @Nonnull BlockState state) {
IBakedModel model = Minecraft.getInstance().getBlockRenderer().getBlockModel(state);
BlockPos toRenderAt = result.getBlockPos().offset(result.getDirection().getNormal());
renderBlockModel(event, toRenderAt, model, state);
}
use of net.minecraft.client.renderer.model.IBakedModel in project NetherEx by LogicTechCorp.
the class MimicModelHandler method onModelBake.
@SubscribeEvent
public static void onModelBake(ModelBakeEvent event) {
MimicBlock quartzOreBlock = (MimicBlock) NetherExBlocks.QUARTZ_ORE.get();
if (quartzOreBlock != null) {
ModelResourceLocation modelLocation = quartzOreBlock.getModelLocation();
IBakedModel model = event.getModelRegistry().get(modelLocation);
if (model != null) {
event.getModelRegistry().put(modelLocation, new MimicBakedModel(model, quartzOreBlock.getMimicType()));
}
}
}
Aggregations