Search in sources :

Example 6 with IBakedModel

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);
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) IBakedModel(net.minecraft.client.renderer.model.IBakedModel)

Example 7 with IBakedModel

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()));
        }
    }
}
Also used : MimicBlock(logictechcorp.libraryex.block.MimicBlock) ModelResourceLocation(net.minecraft.client.renderer.model.ModelResourceLocation) IBakedModel(net.minecraft.client.renderer.model.IBakedModel) MimicBakedModel(logictechcorp.libraryex.client.render.model.MimicBakedModel) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

IBakedModel (net.minecraft.client.renderer.model.IBakedModel)7 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)3 BlockPos (net.minecraft.util.math.BlockPos)3 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)2 RenderType (net.minecraft.client.renderer.RenderType)2 ModelResourceLocation (net.minecraft.client.renderer.model.ModelResourceLocation)2 Random (java.util.Random)1 MimicBlock (logictechcorp.libraryex.block.MimicBlock)1 MimicBakedModel (logictechcorp.libraryex.client.render.model.MimicBakedModel)1 BlockState (net.minecraft.block.BlockState)1 IUnbakedModel (net.minecraft.client.renderer.model.IUnbakedModel)1 Direction (net.minecraft.util.Direction)1 World (net.minecraft.world.World)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1