Jump to content

[1.7.10]Block with custom model renders as an invisible block


UntouchedWagons

Recommended Posts

Source code can be found in my git repo: https://github.com/UntouchedWagons/PowerLines

 

My mod will add, among other things, a large power line like the ones you find outside. I've made a babby's first model using Tabula and have hacked together the rendering stuff using Mekanism as a point of reference. The large power line is supposed to look like this: http://i.imgur.com/na6ceWe.png but instead looks like this: http://i.imgur.com/qPOXbjC.png What did I do wrong? It's bound to be something stupidly simple.

 

I know I screwed up the texture size.

I like trains.

Link to comment
Share on other sites

I just copied this from the client proxy of one of my mods PreInit method

 

GameTable.gameTableRenderID = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(GameTable.gameTableRenderID, new GameTableRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGameTable.class, new TileEntityGameTableRenderer());

 

this registers a renderer to the block and one to the tileentity

 

hope this is of some help

 

Link to comment
Share on other sites

X, y, z, rot, rot, partialTicks

that's six

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

So like this:

 

    public void renderTileEntityAt(TileEntityLargePowerLine te, double x, double y, double z, float partialTick) {
        GL11.glPushMatrix();
        //GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

        bindTexture(new ResourceLocation("powerlines", "render/largePowerLine.png"));

        GL11.glRotatef(180, 0F, 0F, 1F);

        model.render(null, (float)x, (float)y, (float)z, 0, 0, partialTick);

        GL11.glPopMatrix();
    }

 

It doesn't seem right that I have to cast the doubles to floats, but what do I know? I'm basically a monkey at a keyboard when it comes to this rendering stuff.

I like trains.

Link to comment
Share on other sites

Through the power of shotgun debugging and looking at what others have done I have finally got my model to render properly. This is what I have now to make it work:

 

    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

        bindTexture(texture);

        GL11.glRotatef(180, 0F, 0F, 1F);

        model.render(null, 0, 0, 0, 0, 0, 0.0625F);

        GL11.glPopMatrix();
    }

 

The glTranslatef method allows you to moves the model around. The glRotatef method allows you to rotate the model which you'd want if you need to rotate your machine. The first parameter is the amount to rotate in degrees along the X axis, the second is the Y axis and the third is the Z axis. I don't know what the parameters for the render method do but in my model classes only the last parameter is ever used.

I like trains.

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.