Jump to content

[1.7.10] Adding Extra Rotations to Custom Models


Saracalia

Recommended Posts

I am currently working on a mod called Saracalia's Vehicle Mod, and well, the idea of this mod is to place cars down for Decorational purposes, instead of allowing them to be driven around. Now, I am currently having trouble with something. I am wanting to have the vehicles placed down in 16 rotations, instead of 4, similar to how the Skull gets placed down. I posted it on MC forums, but didn't get much help there, so thought to come onto the forums here and ask for help.

 

Now, I got a message on MC forums to use lines 32-33 from the class, TileEntitySignRenderer which seems to make sense except for, it does nothing.

The code I got in a class that is off from TileEntitySpecialRender is:

 private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
      int meta = world.getBlockMetadata(x, y, z);
        GL11.glPushMatrix();
        GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
        GL11.glPopMatrix();
    }

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_){
    	
	GL11.glPushMatrix();
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
        ResourceLocation textures = (new ResourceLocation(getTexturePath()));
        Minecraft.getMinecraft().renderEngine.bindTexture(textures);
        GL11.glPushMatrix();
        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
        int i;
        if(!te.hasWorldObj()) 
        {
        i = 0;
        } else
        {
        i = te.getBlockMetadata();
        }
        double rotate = (double)((double)i * 90D);
        GL11.glRotated(rotate + adjustAngleBy(), 0, 1D, 0);
        //this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        this.ModelRender();
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    }

 

And the lines I have been told to use from TileEntitySignRender is

GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);
this.field_147514_c.signStick.showModel = true;

 

Can someone help me out here for this please?

Link to comment
Share on other sites

In before "1.7.10 not supported bla bla":

 

You need to store the rotation[0-15] somehow in your tileentity. And then in your tileentity renderer read this rotation field and do a glRotate by 360/16 * <rotation field>.

 

to store the rotation you would do this on block placement. (Your Block class). You then get the tileentity and set the rotation according to current player rotation. (you need to map the degrees to 0-15).

 

Look for tutorials about TileEntity Rendering in 1.7. There should be some. Or tile entities in general for how to store the values.

Link to comment
Share on other sites

1.7.10 is no longer supported by Forge.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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