Jump to content

Recommended Posts

Posted

GL11 has a function called scale, you can just render the model you want to shrink and just call the scale function before the render method to make it bigger/smaller

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Posted

You have to be a bit careful though, because the scale will scale around the origin of entity model which happens to be at 1.5 blocks above the ground. If you just scale it bigger then the bottom of your entity will go into the ground, and if you just scale it smaller then the bottom of your entity will not touch the ground.

 

So you need to translate the model, then scale it. I've worked out the formula. You just need to push a transformation matrix then translate and scale (and don't forget to pop the matrix at the end). So like this:

 

public void render(Entity parEntity, float par2, float par3, float par4, float par5, float par6, float par7)

{

        setRotationAngles(parEntity, par2, par3, par4, par5, par6, par7, parEntity);

 

        // scale the whole thing for big or small entities

        GL11.glPushMatrix();

        GL11.glTranslatef(0F, 1.5F-1.5F*parEntity.getScaleFactor(), 0F);

    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

 

        myModel.render(par7);

 

        // don't forget to pop the matrix for overall scaling

        GL11.glPopMatrix();

  }

 

You would substitute your scale factor and model of course for you your entity.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

I tried to add the code you specified, jabelar, to the render() method of ModelSpider.java, but I get the error "The method getScaleFactor() is unidentified for the Type Entity."

 

Here is what I have for render():

 

public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)

{

this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);

 

// scale the whole thing for big or small entities

GL11.glPushMatrix();

GL11.glTranslatef(0F, 1.5F-1.5F*p_78088_1_.getScaleFactor(), 0F);

GL11.glScalef(p_78088_1_.getScaleFactor(), p_78088_1_.getScaleFactor(), p_78088_1_.getScaleFactor());

 

this.spiderHead.render(p_78088_7_);

this.spiderNeck.render(p_78088_7_);

this.spiderBody.render(p_78088_7_);

this.spiderLeg1.render(p_78088_7_);

this.spiderLeg2.render(p_78088_7_);

this.spiderLeg3.render(p_78088_7_);

this.spiderLeg4.render(p_78088_7_);

this.spiderLeg5.render(p_78088_7_);

this.spiderLeg6.render(p_78088_7_);

this.spiderLeg7.render(p_78088_7_);

this.spiderLeg8.render(p_78088_7_);

 

// don't forget to pop the matrix for overall scaling

GL11.glPopMatrix();

}

Posted

In Jabelar's example, he uses

Entity#getScaleFactor()

. In his own code, where he uses that, he probably casts the

Entity

parameter to his own

Entity

, which has the

getScaleFactor()

method. Now, you need to substitute the

getScaleFactor()

for your own way of getting the scale. You can either harcode it, or use a method in your own

Entity

.

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/

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.