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

 

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

 

 

 

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

 

 

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am using forge 1.20.1 (version 47.3.0). My pc has an RTX 4080 super and an i9 14900 KF, I am on the latest Nvidia graphics driver, latest windows 10 software, I have java 23, forge 1.12.2 works and so does all vanilla versions but for some reason no version of forge 1.20.1 works and instead the game just crashes with the error code "-1." I have no mods in my mods fodler, I have deleted my options.txt and forge.cfg files in case my settings were causing a crash and have tried removing my forge version from the installations folder and reinstalling but no matter what I still crash with the same code and my log doesn't tell me anything: 18:34:53.924 game 2025-02-06 18:34:53,914 main WARN Advanced terminal features are not available in this environment 18:34:54.023 game [18:34:54] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, mrmirchi, --version, 1.20.1-forge-47.3.0, --gameDir, C:\Users\aryam\AppData\Roaming\.minecraft, --assetsDir, C:\Users\aryam\AppData\Roaming\.minecraft\assets, --assetIndex, 5, --uuid, 2db00ea8d678420a8956109a85d90e9d, --accessToken, ????????, --clientId, ZWI3NThkNzMtNmNlZS00MGI5LTgyZTgtYmZkNzcwMTM5MGMx, --xuid, 2535436222989555, --userType, msa, --versionType, release, --quickPlayPath, C:\Users\aryam\AppData\Roaming\.minecraft\quickPlay\java\1738838092785.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.3.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] 18:34:54.027 game [18:34:54] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 10 arch amd64 version 10.0 18:34:54.132 game [18:34:54] [main/INFO] [ne.mi.fm.lo.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow 18:34:54.191 game [18:34:54] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 18:34:54.303 game [18:34:54] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 18:34:54.367 monitor Process Monitor Process crashed with exit code -1     screenshot of log: https://drive.google.com/file/d/1WdkH88H865XErvmIqAKjlg7yrmj8EYy7/view?usp=sharing
    • I am currently working on a big mod, but I'm having trouble with my tabs, I want to find a way to add tabs inside tabs, like how in mrcrayfishes furniture mod, his furniture tab has multiple other sub tabs to them, so i know it is possible but i just don't know how it is possible, any help would be appreciated, thanks
    • Add the crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here  
    • Make a test with adding this mod: https://www.curseforge.com/minecraft/mc-mods/betterrandomsourceconcurrencycrash If you have further issues, create an own thread
    • hi same thing happened to me this is my paste bin please help!  crash report - https://pastes.io/crash-rep
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.