Jump to content

Recommended Posts

Posted

I have the class

package com.gumble.mobtest;

import com.gumble.basemod.BaseMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.mobexample.ModelGelZombie;
import net.minecraft.util.ResourceLocation;
import net.minecraft.mobexample.ModelGelZombie;

public class FireZombie extends RenderBiped
{
public FireZombie(ModelBiped model, float scale)
{
	super(Minecraft.getMinecraft().getRenderManager(), model, scale);
}


public FireZombie(RenderManager manager) {
	super(manager, fireZombie, 0.5f);
}


protected static ResourceLocation getEntityTexture(Entity entity)
{
	return new ResourceLocation(BaseMod.MODID, "textures/entity/custom_biped.png");
}

}

 

which refuses to work because I need to pass an instance of the ModelBiped class into the RenderManager constructor. Unfortunately, I've had an enormous brain-fart and can't remember how to do this. Can someone refresh me please? I would really appreciate it. Here's my ModelBiped class just in case my problem is coming from that class instead of the Render class.

 

package net.minecraft.test;

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

public class ModelFireZombie extends ModelBiped{
// fields
ModelRenderer head;
ModelRenderer body;
ModelRenderer rightarm;
ModelRenderer leftarm;
ModelRenderer rightleg;
ModelRenderer leftleg;

public ModelFireZombie() {
	textureWidth = 64;
	textureHeight = 32;

	head = new ModelRenderer(this, 0, 0);
	head.addBox(-4F, -8F, -4F, 8, 8, ;
	head.setRotationPoint(0F, 0F, 0F);
	head.setTextureSize(64, 32);
	head.mirror = true;
	setRotation(head, 0F, 0F, 0F);
	body = new ModelRenderer(this, 16, 16);
	body.addBox(-4F, 0F, -2F, 8, 12, 4);
	body.setRotationPoint(0F, 0F, 0F);
	body.setTextureSize(64, 32);
	body.mirror = true;
	setRotation(body, 0F, 0F, 0F);
	rightarm = new ModelRenderer(this, 40, 16);
	rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
	rightarm.setRotationPoint(-5F, 2F, 0F);
	rightarm.setTextureSize(64, 32);
	rightarm.mirror = true;
	setRotation(rightarm, 0F, 0F, 0F);
	leftarm = new ModelRenderer(this, 40, 16);
	leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
	leftarm.setRotationPoint(5F, 2F, 0F);
	leftarm.setTextureSize(64, 32);
	leftarm.mirror = true;
	setRotation(leftarm, 0F, 0F, 0F);
	rightleg = new ModelRenderer(this, 0, 16);
	rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
	rightleg.setRotationPoint(-2F, 12F, 0F);
	rightleg.setTextureSize(64, 32);
	rightleg.mirror = true;
	setRotation(rightleg, 0F, 0F, 0F);
	leftleg = new ModelRenderer(this, 0, 16);
	leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
	leftleg.setRotationPoint(2F, 12F, 0F);
	leftleg.setTextureSize(64, 32);
	leftleg.mirror = true;
	setRotation(leftleg, 0F, 0F, 0F);
}

@Override
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);
	head.render(f5);
	body.render(f5);
	rightarm.render(f5);
	leftarm.render(f5);
	rightleg.render(f5);
	leftleg.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) {
	super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}

}

 

Thank you!

Posted

public FireZombie(ModelBiped model, float scale)

public class ModelFireZombie extends ModelBiped

I'm sorry, I fail to see what's wrong with those two statements. It's been quite a while since I've made a mod in MC, so maybe the syntax has changed or something. Could you perhaps be a little more specific? Thank you!

Posted

Dude... what version?

 

In 1.9 you need factory, besides - why can't you just look into vanilla.

1.7.10 is no longer supported by forge, you are on your own.

Posted

public FireZombie(ModelBiped model, float scale)

public class ModelFireZombie extends ModelBiped

I'm sorry, I fail to see what's wrong with those two statements. It's been quite a while since I've made a mod in MC, so maybe the syntax has changed or something. Could you perhaps be a little more specific? Thank you!

You say you need an instance of ModelBiped, one is provided in the constructor. What you need for I am not sure of, as RenderManager has no constructor that takes a ModelBiped. Even if it did, constructing one would be useless. The information contained in it would not reflect Minecraft, because it would not be the RenderManager Minecraft is using.

 

Posted

We usually don't give Java lessons here, but I'll make an exception: You need to use the "new" operator to create an instance of the class. You can either do it inline as you're calling the constructor, or you can store the result in a field to pass into the constructor.

 

If you have any more questions of this nature, please Google "Java programming" plus whatever keywords you have rather than posting here. Come back when you need to ask about something peculiar to Forge.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.