Jump to content

[1.12.2] Rendering json model withn't creating a block/item for it.


Recommended Posts

Posted (edited)

Yea, thats again me with rendering -_-

 

So, what i'm trying to do.

TESR:

 

Spoiler

package com.ancient.thaumicgadgets.objects.machines.stab_2;

import com.ancient.thaumicgadgets.util.IFunctionLibrary;
import com.ancient.thaumicgadgets.util.Reference;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelManager;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.ResourceLocation;

public class RenderStab2 extends TileEntitySpecialRenderer<TileEntityStab2>
{
    private float timer = 0f;
    private int runesCount = 0;
    private float distance = 0.9f;
    private static final ResourceLocation[] textureLoc = {new ResourceLocation(Reference.MOD_ID, "textures/models/runes/1.png"),
                                                          new ResourceLocation(Reference.MOD_ID, "textures/models/runes/2.png"),
                                                          new ResourceLocation(Reference.MOD_ID, "textures/models/runes/3.png"),
                                                          new ResourceLocation(Reference.MOD_ID, "textures/models/runes/4.png"),
                                                          new ResourceLocation(Reference.MOD_ID, "textures/models/runes/5.png"),
                                                          new ResourceLocation(Reference.MOD_ID, "textures/models/runes/6.png")};
    private static final ResourceLocation modelLoc = new ResourceLocation(Reference.MOD_ID, "textures/models/runes/rune");
    private static IBakedModel model;   
    @Override
    public void render(TileEntityStab2 te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) 
    {
        super.render(te, x, y, z, partialTicks, destroyStage, alpha);

        Minecraft mc = Minecraft.getMinecraft();
        BlockRendererDispatcher brd = mc.getBlockRendererDispatcher();
        ModelManager mm = brd.getBlockModelShapes().getModelManager();
        model = mm.getModel(new ModelResourceLocation(Reference.MOD_ID, "textures/models/runes/rune"));
        IBlockState state = te.getWorld().getBlockState(te.getPos());
        this.timer = te.timer *0.05f;
        this.runesCount = te.runesCount;
        
        for (int q = 0; q < this.runesCount; q++)
        {
            GlStateManager.pushMatrix();
            {
                GlStateManager.translate(x + 0.5d, y + 0.9d, z + 0.5d);
                GlStateManager.translate(distance * Math.cos(te.runeAngles.get(q) + timer), y + 0.9d, distance * Math.sin(te.runeAngles.get(q) + timer));
                GlStateManager.scale(1f, 1f, 1f);
                this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
                brd.getBlockModelRenderer().renderModelBrightness(model, state, 1.0f, true);
            }
            GlStateManager.popMatrix();
        }
    }
}

 

 

 And register model baking in client proxy, at init:

ModelBakery.registerItemVariants(ModItems.TG, new ResourceLocation(Reference.MOD_ID, "textures/models/runes/rune"));


But minecraft can't find this model. It's return missing block model. Why? What i'm doing wrong?

Edited by Darth
Posted

Can you explain in more detail what you are trying to do?

 

are you trying to render a model (with a TESR) without having that model attached to a block or item?

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)

Posted
23 hours ago, Cadiboo said:

are you trying to render a model (with a TESR) without having that model attached to a block or item?

Yea, so did u have any idea why it's doesn't work?

Posted (edited)
11 hours ago, Darth said:

Yea, so did u have any idea why it's doesn't work?

 

On 9/4/2018 at 5:50 PM, Darth said:

minecraft can't find this model. It's return missing block model. Why? What i'm doing wrong?

Post your logs, the error should be in them. Also where are you baking the model, why is your IBaked model static and I’m pretty sure that block render dispatcher isn’t the renderer you want. 

 

I have the feeling that this could be done with a custom baked model rather than a TESR, can you please post what you are trying to do. The final aim, not what your code is trying to do.

 

to quote diesieben7

“Do not describe how you want to code things. Describe what you want to achieve, gameplay-wise. Described from an end-user perspective.” 

Edited by Cadiboo

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)

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.