Jump to content

Rendering a simple entity


TLHPoE

Recommended Posts

I know how to render a living entity, but I have no clue how to render just an entity that has a model.

 

Render:

package realmoffera.client.render;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import realmoffera.UtilRF;
import realmoffera.client.model.ModelCoinsRF;
import realmoffera.entity.EntityCoinsRF;

public class RenderCoinsRF extends Render {
public static final ResourceLocation COPPER = UtilRF.newResource("textures/entity/coins/copper.png"), SILVER = UtilRF.newResource("textures/entity/coins/silver.png"), GOLD = UtilRF.newResource("textures/entity/coins/gold.png"), PLATINUM = UtilRF.newResource("textures/entity/coins/platinum.png");
public static final ModelCoinsRF model = new ModelCoinsRF();

@Override
public void doRender(Entity entity, double d, double d1, double d2, float d3, float d4) {
}

protected ResourceLocation getEntityTexture(EntityCoinsRF coins) {
	return coins.value >= 100000 ? PLATINUM : (coins.value >= 10000 ? GOLD : (coins.value >= 1000 ? SILVER : COPPER));
}

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

 

Model:

package realmoffera.client.model;

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

public class ModelCoinsRF extends ModelBase {
ModelRenderer coin1;
ModelRenderer coin2;
ModelRenderer coin3;
ModelRenderer coin4;

public ModelCoinsRF() {
	textureWidth = 32;
	textureHeight = 32;
	coin1 = new ModelRenderer(this, 0, 0);
	coin1.addBox(0F, 0F, 0F, 4, 1, 4);
	coin1.setRotationPoint(-2F, 23F, -2F);
	coin1.setTextureSize(32, 32);
	coin1.mirror = true;
	setRotation(coin1, 0F, 0F, 0F);
	coin2 = new ModelRenderer(this, 0, 0);
	coin2.addBox(0F, 0F, 2F, 4, 1, 4);
	coin2.setRotationPoint(-1F, 23F, 7F);
	coin2.setTextureSize(32, 32);
	coin2.mirror = true;
	setRotation(coin2, 0.1858931F, 2.918521F, 0.0371786F);
	coin3 = new ModelRenderer(this, 0, 0);
	coin3.addBox(0F, 0F, 0F, 4, 1, 4);
	coin3.setRotationPoint(-2F, 23F, -5F);
	coin3.setTextureSize(32, 32);
	coin3.mirror = true;
	setRotation(coin3, 0.0371786F, -0.6878043F, -0.3346075F);
	coin4 = new ModelRenderer(this, 0, 0);
	coin4.addBox(0F, 0F, 0F, 4, 1, 4);
	coin4.setRotationPoint(4.2F, 23F, 1.4F);
	coin4.setTextureSize(32, 32);
	coin4.mirror = true;
	setRotation(coin4, 0F, -2.9557F, -0.2974289F);
}

public void render(EntityCoinsRF coins, float f, float f1, float f2, float f3, float f4, float f5) {
	super.render(coins, f, f1, f2, f3, f4, f5);
	setRotationAngles(f, f1, f2, f3, f4, f5, coins);
	coin1.render(f5);
	if(coins.value < 100) {
		if(coins.value >= 25) {
			coin2.render(f5);
		}
		if(coins.value >= 50) {
			coin3.render(f5);
		}
		if(coins.value >= 75) {
			coin4.render(5);
		}
	} else if(coins.value < 1000) {
		if(coins.value >= 250) {
			coin2.render(f5);
		}
		if(coins.value >= 500) {
			coin3.render(f5);
		}
		if(coins.value >= 750) {
			coin4.render(5);
		}
	} else if(coins.value < 10000) {
		if(coins.value >= 2500) {
			coin2.render(f5);
		}
		if(coins.value >= 5000) {
			coin3.render(f5);
		}
		if(coins.value >= 7500) {
			coin4.render(5);
		}
	} else if(coins.value < 100000) {
		if(coins.value >= 25000) {
			coin2.render(f5);
		}
		if(coins.value >= 50000) {
			coin3.render(f5);
		}
		if(coins.value >= 75000) {
			coin4.render(5);
		}
	}
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
	this.render((EntityCoinsRF) entity, f, f1, f2, f3, f4, 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);
}
}

 

Basically what I'm asking is, what do I put in the doRender method in the render. There's a render method in my model class but I'm not sure what the parameters are.

Kain

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.