Jump to content

Recommended Posts

Posted

I know this topic was discussed a thousand times, but I have not found a good answer, which would have helped me. Maybe you can help me?

Problem: registered render, entity, model, but in the game is the new model is shown as a model player (ModelBiped)

 

MY FILES:

 

RENDER

 

  Reveal hidden contents

 

 

MODEL

 

  Reveal hidden contents

 

 

CLIENT PROXY:

 

  Reveal hidden contents

 

 

COMMON PROXY

 

  Reveal hidden contents

 

 

MOD BASE FILE

 

  Reveal hidden contents

 

 

Please help me

 

 

 

Posted

did you put annotation @Init above load()? If so thats probably the easy fix, otherwise I will have to look more into this

Edit:Or is it just showing up as the wrong textures?

The Korecraft Mod

Posted

I have not really looked at models much, but here is code I puled from ModelBat

 

  Reveal hidden contents

 

If not, then just take a look at the model that you are basing it off of and make sure that you have made it with all the right params and variables

The Korecraft Mod

Posted

RenderingRegistry.registerEntityRenderingHandler(EntityVampire.class, new RenderLiving(new ModelVampire(),0.5F));

 

RenderLiving should be your own renderer

 

ModLoader.getUniqueEntityId()

Doesn't work for me. As soon as i register 2 entities one overwrites the other.

 

And use @Override above methods you are overriding. It is possible that one of your method names is outdated and doesn't work anymore

Posted

Sure, here are my source files:

 

@Init
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
registerEntity(EntityFireBolt.class, new RenderBolt(0), "fireBolt", "a hot ball of fire", 1, 64, 10, true);
}

private void registerEntity(Class <? extends Entity> entityClass, Render renderer, String entityName, String description, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) {
	RenderingRegistry.registerEntityRenderingHandler(entityClass, renderer);
	EntityRegistry.registerModEntity(entityClass, entityName, id, Scrolls.instance, trackingRange, updateFrequency, sendsVelocityUpdates);
	LanguageRegistry.instance().addStringLocalization("entity.Scrolls." + entityName + ".name", description);
}

One of the entities:

public class EntityEarthBolt extends EntityBolt {
public EntityEarthBolt(World world) {
	super(world);
}

public EntityEarthBolt(World world, EntityLiving entity, double powerMod) {
        super(world, entity, powerMod, 10);
    }
}

As you can see EntityBolt is a throwable. I'm just showing the necessary stuff here

public class EntityBolt extends EntityThrowable {
    public EntityBolt(World world) {
        super(world);
    }

    public EntityBolt(World world, EntityLiving entity, double powerMod, int defaultDamage) {
        super(world, entity);
    }

The paramater type in the constructor is just something I added, you don't need it

public class RenderBolt extends Render {

public ModelBase modelbolt;
public float rotationSpeed;

public RenderBolt(int type) {
	modelbolt = new ModelBolt(type);
}

public void doRenderBolt(EntityBolt var1, double var2, double var4, double var6, float var8, float var9) {
        float var10 = (float)var1.innerRotation + var9;
	GL11.glPushMatrix();
        GL11.glTranslatef((float)var2, (float)var4, (float)var6);
        this.loadTexture(CommonProxy.BOLTS_PNG);
        modelbolt.render(var1, 0.0F, var10 * this.rotationSpeed, 0.0F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
}

@Override
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
        this.doRenderBolt((EntityBolt)par1Entity, par2, par4, par6, par8, par9);
    }
}

Last but not least, the model:

Please not that the rotations in render(...) are not necessary

public class ModelBolt extends ModelBase {

public ModelRenderer box;
public ModelRenderer box0;
public ModelRenderer box1;

public ModelBolt(int type) {
	this.textureWidth = 128;
	this.textureHeight = 48;

	box = new ModelRenderer(this, type*32, 0);
	box.addBox(-4F, -4F, -4F, 8, 8, ;
	box.setRotationPoint(0F, 0F, 0F);

	box0 = new ModelRenderer(this, type*32, 16);
	box0.addBox(-4F, -4F, -4F, 8, 8, ;
	box0.setRotationPoint(0F, 0F, 0F);

	box1 = new ModelRenderer(this, type*32, 32);
	box1.addBox(-4F, -4F, -4F, 8, 8, ;
	box1.setRotationPoint(0F, 0F, 0F);
}

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {	
	GL11.glPushMatrix();
        GL11.glRotatef(30.0F, 0.7F, 0.0F, 0.7F);
        GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
        this.box.render(f5);
        GL11.glRotatef(60.0F, 0.8F, 0.0F, 0.8F);
        GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
        this.box0.render(f5);
        GL11.glRotatef(90.0F, 0.9F, 0.0F, 0.9F);
        GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
        this.box1.render(f5);
        GL11.glPopMatrix();
}
}

 

EDIT:

What the hell is mainModel here?

field_40295_c = (ModelVampire)mainModel;

It should be:

field_40295_c = new ModelVampire();

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.