Jump to content

How to do rendering on a json model?


FireIsH0t

Recommended Posts

Hello! I am trying to do rendering on a json model but I did everything that I am suppose to do like register 

registerNormalItemModel(event, ModItems.M1911);
ModItems.M1911.setTileEntityItemStackRenderer(RenderM1911.instance);

But when I use the item on my hand it just shows nothing unlike the other rendering I have done BUT for java models.

 

Here is just some of my json model (Cause its way to big):

 

{
   "credit": "Made by MaxIsH0t",
   "parent": "builtin/entity",
   "textures": {
      "texture": "arsenalmod:items/darkgrey"
   },
   "elements": [

 

Rendering Class:

package net.arsenalnetwork.arsenalmod.client.render.items.guns;

import net.arsenalnetwork.arsenalmod.utilities.ModReference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class RenderM1911 extends TileEntityItemStackRenderer
{
    private static final ResourceLocation MODEL = new ResourceLocation(ModReference.MOD_ID, "models/item/m1911.json");
    public static final ResourceLocation TEXTURE = new ResourceLocation(ModReference.MOD_ID, "textures/items/darkgrey.png");
    Minecraft mc;

    public static ResourceLocation getMODEL() {
        return MODEL;
    }

    public RenderM1911() {
        mc = Minecraft.getMinecraft();
    }

    @Override
    public void renderByItem(ItemStack itemStackIn)
    {
        EntityPlayer player = Minecraft.getMinecraft().player;

        GlStateManager.pushMatrix();
        mc.getTextureManager().bindTexture(TEXTURE);

        GlStateManager.rotate(130, 0, 1, 0);
        GlStateManager.rotate(0, 0, 0, 1);
        GlStateManager.rotate(0, 1, 0, 0);

        GlStateManager.translate(-0.2f, 1.2f, 0.1f);
        final double scale2 = 0.4;
        GlStateManager.scale(scale2, scale2, scale2);
        MODEL.getResourceDomain();
        GlStateManager.popMatrix();
    }
}
Link to comment
Share on other sites

The solution was to call ItemRenderer#renderModel with the proper transforms I think

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.