Jump to content

Recommended Posts

Posted

I have this model:

NbEdQUX.png

 

It renders in game, but upsidedown:

11l9JSN.png

 

Model Code:

// Date: 4/6/2014 5:32:28 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package realmoffera.client.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelCoinBagRF extends ModelBase {
//fields
ModelRenderer Shape1;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Shape4;
ModelRenderer Shape6;
ModelRenderer Shape5;

public ModelCoinBagRF() {
	textureWidth = 64;
	textureHeight = 64;
	Shape1 = new ModelRenderer(this, 0, 0);
	Shape1.addBox(0F, 0F, 0F, 16, 10, 16);
	Shape1.setRotationPoint(-8F, 12F, -8F);
	Shape1.setTextureSize(64, 64);
	Shape1.mirror = true;
	setRotation(Shape1, 0F, 0F, 0F);
	Shape2 = new ModelRenderer(this, 0, 26);
	Shape2.addBox(0F, 0F, 0F, 14, 2, 14);
	Shape2.setRotationPoint(-7F, 22F, -7F);
	Shape2.setTextureSize(64, 64);
	Shape2.mirror = true;
	setRotation(Shape2, 0F, 0F, 0F);
	Shape3 = new ModelRenderer(this, 0, 26);
	Shape3.addBox(0F, 0F, 0F, 14, 2, 14);
	Shape3.setRotationPoint(-7F, 10F, -7F);
	Shape3.setTextureSize(64, 64);
	Shape3.mirror = true;
	setRotation(Shape3, 0F, 0F, 0F);
	Shape4 = new ModelRenderer(this, 0, 42);
	Shape4.addBox(0F, 0F, 0F, 4, 2, 4);
	Shape4.setRotationPoint(-2F, 8F, -2F);
	Shape4.setTextureSize(64, 64);
	Shape4.mirror = true;
	setRotation(Shape4, 0F, 0F, 0F);
	Shape6 = new ModelRenderer(this, 0, 48);
	Shape6.addBox(0F, 0F, 0F, 6, 2, 6);
	Shape6.setRotationPoint(-3F, 6F, -3F);
	Shape6.setTextureSize(64, 64);
	Shape6.mirror = true;
	setRotation(Shape6, 0F, 0F, 0F);
	Shape5 = new ModelRenderer(this, 16, 42);
	Shape5.addBox(0F, 0F, 0F, 1, 2, 4);
	Shape5.setRotationPoint(-2F, 8F, 1F);
	Shape5.setTextureSize(64, 64);
	Shape5.mirror = true;
	setRotation(Shape5, 0F, -0.7853982F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
	super.render(entity, f, f1, f2, f3, f4, f5);
	setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	Shape1.render(f5);
	Shape2.render(f5);
	Shape3.render(f5);
	Shape4.render(f5);
	Shape6.render(f5);
	Shape5.render(f5);
}

private void setRotation(ModelRenderer model, float x, float y, float z) {
	model.rotateAngleX = x;
	model.rotateAngleY = y;
	model.rotateAngleZ = z;
}

public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
	super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

Kain

Posted

This screws up the rendering a little bit:

3lWNWks.png

 

Render Code:

package realmoffera.client.render;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import realmoffera.UtilRF;
import realmoffera.client.model.ModelCoinBagRF;
import realmoffera.entity.EntityCoinBagRF;

public class RenderCoinBagRF extends Render {
public static final ResourceLocation TEX = UtilRF.newResource("textures/entity/coinBag.png");
public static final ModelCoinBagRF model = new ModelCoinBagRF();

public RenderCoinBagRF() {
	super();
}

@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) {
	GL11.glPushMatrix();
	GL11.glTranslated(x, y, z);
	GL11.glScalef(0.5F, 0.5F, 0.5F);
	GL11.glRotated(180, 0, 0, 0);
	bindTexture(getEntityTexture(entity));
	model.render(entity, 0, 0, 0, 0, 0, 0.0625F);
	GL11.glPopMatrix();
}

@Override
protected ResourceLocation getEntityTexture(Entity e) {
	return TEX;
}
}

Kain

Posted

First translate to the center of your model. Then, scale the model if needed. Then...

You want to rotate about either the X or Z axis by 180 or pi.

Then translate back to the original position

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.