net.minecraft.client.resources.model.IBakedModel Java Examples

The following examples show how to use net.minecraft.client.resources.model.IBakedModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderItemHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void renderToxicArrowPoisonEffect(IBakedModel model, ItemStack stack) {
    SkyblockAddons main = SkyblockAddons.getInstance();

    if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.TURN_BOW_GREEN_WHEN_USING_TOXIC_ARROW_POISON)
            && main.getInventoryUtils().isUsingToxicArrowPoison() && Items.bow.equals(stack.getItem()) && main.getUtils().itemIsInHotbar(stack)) {
        TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

        GlStateManager.depthMask(false);
        GlStateManager.depthFunc(514);
        GlStateManager.disableLighting();
        GlStateManager.blendFunc(768, 1);
        textureManager.bindTexture(BLANK);
        GlStateManager.matrixMode(5890);

        GlStateManager.pushMatrix();

        Minecraft.getMinecraft().getRenderItem().renderModel(model, 0x201cba41);
        GlStateManager.popMatrix();

        GlStateManager.matrixMode(5888);
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableLighting();
        GlStateManager.depthFunc(515);
        GlStateManager.depthMask(true);
        textureManager.bindTexture(TextureMap.locationBlocksTexture);
    }
}
 
Example #2
Source File: MixinBlockModelRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderModelAmbientOcclusion", at = @At("HEAD"), cancellable = true)
private void renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSide, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) {
    final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class);

    if (xray.getState() && !xray.getXrayBlocks().contains(blockIn))
        booleanCallbackInfoReturnable.setReturnValue(false);
}
 
Example #3
Source File: MixinBlockModelRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderModelStandard", at = @At("HEAD"), cancellable = true)
private void renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) {
    final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class);

    if (xray.getState() && !xray.getXrayBlocks().contains(blockIn))
        booleanCallbackInfoReturnable.setReturnValue(false);
}
 
Example #4
Source File: MixinBlockModelRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderModelAmbientOcclusion", at = @At("HEAD"), cancellable = true)
private void renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSide, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) {
    final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class);

    if (xray.getState() && !xray.getXrayBlocks().contains(blockIn))
        booleanCallbackInfoReturnable.setReturnValue(false);
}
 
Example #5
Source File: MixinBlockModelRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderModelStandard", at = @At("HEAD"), cancellable = true)
private void renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) {
    final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class);

    if (xray.getState() && !xray.getXrayBlocks().contains(blockIn))
        booleanCallbackInfoReturnable.setReturnValue(false);
}
 
Example #6
Source File: HyperiumRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean renderShinyPot(ItemStack stack, IBakedModel model, boolean isInv) {
    boolean renderedAsPotion = false;
    if (Settings.SHINY_POTS && isInv && stack.getItem() != null && stack.getItem() instanceof ItemPotion) {
        int glintColor = getPotionColor(stack);
        renderPot(model, glintColor);

        renderedAsPotion = true;
    }
    return renderedAsPotion;
}
 
Example #7
Source File: HyperiumRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Basically the same as renderEffect, but does not include the depth code and uses custom color
 *
 * @param model the model
 */
private void renderPot(IBakedModel model, int color) {
    GlStateManager.depthMask(false);
    GlStateManager.disableLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_COLOR, 1);
    ((IMixinRenderItem) parent).getTextureManager().bindTexture(RES_ITEM_GLINT);
    GlStateManager.matrixMode(GL11.GL_TEXTURE);
    GlStateManager.pushMatrix();
    GlStateManager.scale(8.0F, 8.0F, 8.0F);
    float f = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F;
    GlStateManager.translate(f, 0.0F, 0.0F);
    GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F);
    ((IMixinRenderItem2) parent).callRenderModel(model, color);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    GlStateManager.scale(8.0F, 8.0F, 8.0F);
    float f1 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F;
    GlStateManager.translate(-f1, 0.0F, 0.0F);
    GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F);
    ((IMixinRenderItem2) parent).callRenderModel(model, color);
    GlStateManager.popMatrix();
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableLighting();
    GlStateManager.depthMask(true);

    ((IMixinRenderItem) parent).getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
}
 
Example #8
Source File: MixinRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer;renderByItem(Lnet/minecraft/item/ItemStack;)V"))
private void onRenderItem1(ItemStack stack, IBakedModel model, CallbackInfo ci) {
    hyperiumRenderItem.callHeadScale(stack, isInv, Settings.HEAD_SCALE_FACTOR);
}
 
Example #9
Source File: MixinRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderModel(Lnet/minecraft/client/resources/model/IBakedModel;Lnet/minecraft/item/ItemStack;)V"))
private void onRenderItem2(ItemStack stack, IBakedModel model, CallbackInfo ci) {
    wasJustRenderedAsPotion = hyperiumRenderItem.renderShinyPot(stack, model, isInv);
    hyperiumRenderItem.callHeadScale(stack, isInv, Settings.HEAD_SCALE_FACTOR);
}
 
Example #10
Source File: MixinRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V"))
private void onRenderItem3(ItemStack stack, IBakedModel model, CallbackInfo ci) {
    hyperiumRenderItem.callHeadScale(stack, isInv, 1.0 / Settings.HEAD_SCALE_FACTOR);
}
 
Example #11
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void register(ModelResourceLocation location, IBakedModel model) {
    registerModels.add(new ImmutablePair<ModelResourceLocation, IBakedModel>(location, model));
}
 
Example #12
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
    for(Pair<ModelResourceLocation, IBakedModel> pair : registerModels)
        event.modelRegistry.putObject(pair.getKey(), pair.getValue());
}
 
Example #13
Source File: MixinBlockModelRenderer.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject(method="renderModel", at=@At("HEAD"), cancellable=true)
private void onRenderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, WorldRenderer buffer, boolean checkSides, CallbackInfoReturnable<Boolean> ci) {
    if (UyjuliansXrayModMain.xrayEnabled()) {
        Block blockIn = stateIn.getBlock();
        if (!UyjuliansXrayModMain.checkBlockList(blockIn)) {
            try {
                boolean flag = false;
                BitSet bitset = new BitSet(3);

                for (EnumFacing enumfacing : EnumFacing.values())
                {
                    List<BakedQuad> list = modelIn.func_177551_a(enumfacing);

                    if (!list.isEmpty())
                    {
                        BlockPos blockpos = posIn.offset(enumfacing);

                        if (!checkSides || UyjuliansXrayModMain.checkBlockList(worldIn.getBlockState(posIn.offset(enumfacing)).getBlock()))
                        {
                            int i = 15 << 20 | 15 << 4;
                            this.func_178260_a(worldIn, blockIn, posIn, enumfacing, i, false, buffer, list, bitset);
                            flag = true;
                        }
                    }
                }

                List<BakedQuad> list1 = modelIn.func_177550_a();

                if (list1.size() > 0)
                {
                    this.func_178260_a(worldIn, blockIn, posIn, null, -1, true, buffer, list1, bitset);
                    flag = true;
                }

                ci.setReturnValue(flag);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model while using uyjulian's X-ray mod");
                CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated");
                CrashReportCategory.addBlockInfo(crashreportcategory, posIn, stateIn);
                throw new ReportedException(crashreport);
            }
        }
        else {
            ci.setReturnValue(false);
        }
    }
}
 
Example #14
Source File: IMixinRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 votes vote down vote up
@Invoker void callRenderModel(IBakedModel model, ItemStack stack); 
Example #15
Source File: IMixinRenderItem2.java    From Hyperium with GNU Lesser General Public License v3.0 votes vote down vote up
@Invoker void callRenderModel(IBakedModel model, int color);