Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

The model does not appear


StealerSlain
 Share

Recommended Posts

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

 

package ***; //Secret :)

 

import net.minecraft.src.EntityLiving;

import net.minecraft.src.RenderLiving;

 

import org.lwjgl.opengl.GL11;

 

public class RenderVampire extends RenderLiving

{

protected ModelVampire field_40295_c;

public RenderVampire(ModelVampire ModelVampire, float f)

{

super(ModelVampire, f);

field_40295_c = (ModelVampire)mainModel;

}

 

public void renderNamehereA(EntityVampire entity, double d, double d1, double d2, float f, float f1)

{

super.doRenderLiving(entity, d, d1, d2, f, f1);

 

}

 

public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)

{

super.doRenderLiving((EntityVampire) entityliving, d, d1, d2, f, f1);

}

 

public void renderDeadmau5(EntityVampire par1EntityVampire, double par2, double par4, double par6, float par8, float par9)

{

super.doRenderLiving(par1EntityVampire, par2, par4, par6, par8, par9);

}

 

protected void func_40291_a(EntityVampire par1EntityVampire, float par2)

{

super.renderEquippedItems(par1EntityVampire, par2);

}

 

 

protected void func_40290_a(EntityVampire EntityVampire, double d, double d1, double d2)

{

}

protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)

{

func_40291_a((EntityVampire)par1EntityLiving, par2);

}

 

protected void preRenderScale(EntityVampire entity, float f)

{

GL11.glScalef(1.0F, 1.0F, 1.0F);

}

protected void func_40292_b(EntityVampire par1EntityVampire, float par2)

{

float f = 0.9375F;

 

GL11.glScalef(f, f, f);

}

 

protected void passSpecialRender(EntityLiving par1EntityLiving, double par2, double par4, double par6)

{

func_40290_a((EntityVampire)par1EntityLiving, par2, par4, par6);

}

protected void Vampire(EntityLiving par1EntityLiving, float par2)

{

func_40292_b((EntityVampire)par1EntityLiving, par2);

}

 

 

}

 

 

MODEL

 

package ***;

import net.minecraft.src.*;

 

public class ModelVampire extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer rightarm;

    ModelRenderer leftarm;

    ModelRenderer rightleg;

    ModelRenderer leftleg;

 

  public ModelVampire()

  {

    textureWidth = 64;

    textureHeight = 32;

   

      head = new ModelRenderer(this, 0, 0);

      head.addBox(-4F, -8F, -4F, 8, 8, 8);

      head.setRotationPoint(0F, 3F, -1F);

      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, 2F, 0F);

      body.setTextureSize(64, 32);

      body.mirror = true;

      setRotation(body, 0.4461433F, 0F, 0F);

      rightarm = new ModelRenderer(this, 40, 16);

      rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);

      rightarm.setRotationPoint(-4F, 5F, 2F);

      rightarm.setTextureSize(64, 32);

      rightarm.mirror = true;

      setRotation(rightarm, 0.8551081F, 0F, 0.4089647F);

      leftarm = new ModelRenderer(this, 40, 16);

      leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);

      leftarm.setRotationPoint(4F, 5F, 2F);

      leftarm.setTextureSize(64, 32);

      leftarm.mirror = true;

      setRotation(leftarm, 0.8353827F, 0F, -0.4089647F);

      rightleg = new ModelRenderer(this, 0, 16);

      rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);

      rightleg.setRotationPoint(-2F, 12F, 4F);

      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, 4F);

      leftleg.setTextureSize(64, 32);

      leftleg.mirror = true;

      setRotation(leftleg, 0F, 0F, 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);

    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 par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)

  {

    super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);

  }

 

}

 

 

CLIENT PROXY:

 

package ***;

 

import net.minecraft.client.Minecraft;

import net.minecraft.src.EntityRenderer;

import net.minecraft.src.RenderLiving;

import net.minecraft.src.RenderSnowball;

import net.minecraft.src.ScaledResolution;

import net.minecraft.src.Tessellator;

import net.minecraftforge.client.MinecraftForgeClient;

import net.minecraftforge.common.MinecraftForge;

 

import org.lwjgl.input.Mouse;

import org.lwjgl.opengl.GL11;

 

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.client.registry.ClientRegistry;

import cpw.mods.fml.client.registry.RenderingRegistry;

import cpw.mods.fml.common.ObfuscationReflectionHelper;

 

public class ClientProxy extends CommonProxy

{

 

public void registerRenders()

  { 

  MinecraftForgeClient.preloadTexture("blocks.png");

  MinecraftForgeClient.preloadTexture("items.png");

  MinecraftForgeClient.preloadTexture("items32.png");

  RenderingRegistry.instance().registerEntityRenderingHandler(EntityMagicBullet.class, new RenderSnowball(SMCrafting.MagicBullet.getIconFromDamage(0)));

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

  }

 

// Override any other methods that need to be handled differently client side.

 

}// End class ClientProxy

 

 

COMMON PROXY

 

package ***;

 

public class CommonProxy {

public static String ITEMS_PNG = "path";

public static String BLOCK_PNG = "path";

 

// Client stuff

public void registerRenderers() {

// Nothing here as this is the server side proxy

}

}

 

 

MOD BASE FILE

 

public void load(FMLInitializationEvent event){

NetworkRegistry.instance().registerGuiHandler(this, guiHandler);

LanguageRegistry.instance().addStringLocalization("entity.Vampire.name", "en_US", "Vampire");

EntityRegistry.registerGlobalEntityID(EntityVampire.class, "Santa", ModLoader.getUniqueEntityId(), 11 ,115);

EntityList.entityEggs.put(Integer.valueOf(30), new EntityEggInfo(30, 894731, (new Color(21, 15, 6)).getRGB()));

proxy.registerRenderers();

//And much, but I showed you only, due to the ENTITY

}

 

 

Please help me

 

 

 

Link to comment
Share on other sites

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

 

 

ModelRenderer var1 = new ModelRenderer(this, 24, 0);

        var1.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1);

        this.batBody.addChild(var1);

        ModelRenderer var2 = new ModelRenderer(this, 24, 0);

        var2.mirror = true;

        var2.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1);

 

 

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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();

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Good Morning, I tried overriding one of the vanilla rock blocks according to instructions in this old thread, but failed for the same reason the org TM did, even though I got a tiny bit farther than he did. I can remove the original block entirely from world spawn, and replace it with custom version, which I want to prevent due to following up workload(adapting recipes etc. to custom block). What I tried solving the issue/actually making replacing(partially) work: 1. I had to use the original Forge variant of registering the block in main class, like that: which actually did use the custom granite block as replacer(not exactly illustrated in the old thread), but didn't consider it on world feature generation... 2. I then believed it was due to not using correct path variables for assets texture/models/blockstates etc., so I created missing asset packets for both, vanilla asset path, and my mod path. This also did not fix the issue with creating holes filled up with Items.AIR on world feature generation. 3. I then tried to remove the vanilla granite block during feature generation, and reimported it after with my replacement set up, during feature generation as well(according to @Luis_ST advice). But the holes were still there, only this time I got my replaced granite block spawned as well. What do I want to achieve(asking myself and you in hope maybe there's a better solution)? Mojang found it a good idea, to give one of the hardest rock materials on this planet, the .harvestLevel(soft as a pillow), so I can harvest it with a wooden pickaxes(which technically is even worth, but doesn't matter since wooden "pickaxe" tools do not exist in my mod). I really just want to compare harvestLevel of any of my tools, against the harvestLevel of the targetBlock, so I can automatically disallow harvesting it, if the tool doesn't match the harvestLevel(which for whatever reason does not work as intended in 1.16.5 Minecraft). Edit: and before you shout "doPlayerHarvestCheck". Yes, I do that! Edit2: Also, why are there Manga Comic Girls, on the right upper corner of my Monitor, stating how can it be that big?(whatever "it" is?)
    • so do i just change the launcher to java 8?  
    • I have this error when using forge (with mods or without) and have tried the official minecraft solution but it does not work, I am using the latest version for 1.18 and the official minecraft launcher
    • https://github.com/NotAFlyingGoose/GooseMod
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.