Jump to content

Recommended Posts

Posted

It just appears as a white box running around and I can't figure out what I'm missing.

Can someone tell me what I'm missing?

 

Main registry

EntityHandler.registerMonsters(EntityCuccoo.class, "Cuccoo");

 

ClientProxy

package com.pixelmoncore.main;

import assets.pixelmoncore.models.ModelCuccoo;
import com.pixelmoncore.entity.EntityCuccoo;
import com.pixelmoncore.entity.RenderCuccoo;

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

public class ClientProxy extends ServerProxy
{
public void registerRenderThings()
{
	RenderingRegistry.registerEntityRenderingHandler(EntityCuccoo.class, new RenderCuccoo(new ModelCuccoo(), 0.3F));
}
}

 

ModelCuccoo

package assets.pixelmoncore.models;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ModelCuccoo extends ModelBase
{
    public ModelRenderer beak;
    public ModelRenderer head;
    public ModelRenderer headthing;
    public ModelRenderer breast;
    public ModelRenderer back;
    public ModelRenderer tail;
    public ModelRenderer leftwing;
    public ModelRenderer rightwing;
    public ModelRenderer rightleg;
    public ModelRenderer leftleg;
  
  public ModelCuccoo()
  {
    textureWidth = 64;
    textureHeight = 64;
    
      beak = new ModelRenderer(this, 0, 12);
      beak.addBox(1F, 0F, 0F, 3, 2, 3);
      beak.setRotationPoint(-2.5F, 10.5F, -7F);
      beak.setTextureSize(64, 64);
      beak.mirror = true;
      setRotation(beak, 0F, 0F, 0F);
      head = new ModelRenderer(this, 0, 0);
      head.addBox(0F, 0F, 0F, 6, 6, 6);
      head.setRotationPoint(-3F, 7.5F, -5F);
      head.setTextureSize(64, 64);
      head.mirror = true;
      setRotation(head, 0F, 0F, 0F);
      headthing = new ModelRenderer(this, 0, 10);
      headthing.addBox(0F, 0F, 0F, 0, 9, 7);
      headthing.setRotationPoint(0F, 3.5F, -1.5F);
      headthing.setTextureSize(64, 64);
      headthing.mirror = true;
      setRotation(headthing, -0.6320364F, 0F, 0F);
      breast = new ModelRenderer(this, 24, 0);
      breast.addBox(0F, 0F, 0F, 5, 5, 5);
      breast.setRotationPoint(-2.5F, 13F, -1F);
      breast.setTextureSize(64, 64);
      breast.mirror = true;
      setRotation(breast, -0.5205006F, 0F, 0F);
      back = new ModelRenderer(this, 17, 10);
      back.addBox(0F, 0F, 0F, 6, 5, 7);
      back.setRotationPoint(-3F, 14.75F, 0F);
      back.setTextureSize(64, 64);
      back.mirror = true;
      setRotation(back, 0.1487144F, 0F, 0F);
      tail = new ModelRenderer(this, 1, 16);
      tail.addBox(0F, 0F, 0F, 0, 10, 10);
      tail.setRotationPoint(0F, 6F, 6F);
      tail.setTextureSize(64, 64);
      tail.mirror = true;
      setRotation(tail, -0.2602503F, 0F, 0F);
      leftwing = new ModelRenderer(this, 21, 22);
      leftwing.addBox(0F, 0F, 0F, 1, 5, 6);
      leftwing.setRotationPoint(-3F, 14.5F, 0F);
      leftwing.setTextureSize(64, 64);
      leftwing.mirror = true;
      setRotation(leftwing, -0.1487144F, -0.1115358F, 0.4089647F);
      rightwing = new ModelRenderer(this, 21, 22);
      rightwing.addBox(0F, 0F, 0F, 1, 5, 6);
      rightwing.setRotationPoint(2F, 14.5F, 0F);
      rightwing.setTextureSize(64, 64);
      rightwing.mirror = true;
      setRotation(rightwing, -0.1487195F, 0.111544F, -0.4089656F);
      rightleg = new ModelRenderer(this, 0, 0);
      rightleg.addBox(0F, 0F, 0F, 1, 5, 1);
      rightleg.setRotationPoint(0.7F, 19F, 3F);
      rightleg.setTextureSize(64, 64);
      rightleg.mirror = true;
      setRotation(rightleg, 0F, 0F, 0F);
      leftleg = new ModelRenderer(this, 0, 0);
      leftleg.addBox(0F, 0F, 0F, 1, 5, 1);
      leftleg.setRotationPoint(-1.7F, 19F, 3F);
      leftleg.setTextureSize(64, 64);
      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);
    beak.render(f5);
    head.render(f5);
    headthing.render(f5);
    breast.render(f5);
    back.render(f5);
    tail.render(f5);
    leftwing.render(f5);
    rightwing.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, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    
    this.head.rotateAngleX = f4 / (180F / (float)Math.PI);
    this.head.rotateAngleY = f3 / (180F / (float)Math.PI);
    this.beak.rotateAngleX = this.head.rotateAngleX;
    this.beak.rotateAngleY = this.head.rotateAngleY;
    this.headthing.rotateAngleX = this.head.rotateAngleX;
    this.headthing.rotateAngleY = this.head.rotateAngleY;
    this.back.rotateAngleX = ((float)Math.PI / 2F);
    this.breast.rotateAngleX = this.back.rotateAngleX;
    this.breast.rotateAngleY = this.back.rotateAngleY;
    this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
    this.rightwing.rotateAngleZ = f5;
    this.leftwing.rotateAngleZ = -f5;
  }

}

 

RenderCucco

package com.pixelmoncore.entity;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import assets.pixelmoncore.models.ModelCuccoo;

public class RenderCuccoo extends RenderLiving
{

private static final ResourceLocation texture = new ResourceLocation("pixelmoncore/textures/models/entity/cuccoo.png");

protected ModelCuccoo modelEntity;

public RenderCuccoo(ModelBase par1ModelBase, float par2)
{
	super(par1ModelBase, par2);
	modelEntity = ((ModelCuccoo) mainModel);

}

public void renderCuccoo(EntityCuccoo entity, double x, double y, double z, float u, float v)
{
	super.doRender(entity, x, y, z, u, v);

}

public void doRenderLiving(EntityLiving entityLiving, double x, double y, double z, float u, float v)
{
	renderCuccoo((EntityCuccoo)entityLiving, x, y, z, u, v);

}

public void doRender(Entity entity, double x, double y, double z, float u, float v)
{
	renderCuccoo((EntityCuccoo)entity, x, y, z, u, v);

}

@Override
protected ResourceLocation getEntityTexture(Entity var1)
{
	return texture;
}

}

 

EntityHandler

package com.pixelmoncore.main;

import java.util.Random;

import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.registry.EntityRegistry;

public class EntityHandler
{
public static void registerMonsters(Class entityClass, String name)
{
	int entityId = EntityRegistry.findGlobalUniqueEntityId();
	long x = name.hashCode();
	Random random = new Random(x);
	int mainColour = random.nextInt() * 16777215;
	int secondColour = random.nextInt() * 16777215;

	EntityRegistry.registerGlobalEntityID(entityClass, name, entityId);
	EntityRegistry.addSpawn(entityClass, 50, 2, 4, EnumCreatureType.ambient, BiomeGenBase.desertHills, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.hell, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.savanna, BiomeGenBase.stoneBeach);
	EntityRegistry.registerModEntity(entityClass, name, entityId, Main.instance, 32, 1, true);
	EntityList.entityEggs.put(Integer.valueOf(entityId), new EntityList.EntityEggInfo(entityId, mainColour, secondColour));

}
}

Posted

Where do you register your renderer?  I see you have a method ClientProxy.registerRenderThings() but do you call that in your main mod preInit() event handler?

 

I do my ClientProxy differently -- I have an actual preInit() method there and in my main mod class's preInit() event handler I call proxy.preInit().  The latter contains the code that actually calls the registration methods.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

The white box is the default rendering, basically rendering a white box the size of the hitbox. We don't see it at all because most of the time we either mess up our rendering defining, or we are extending a class that does have rendering and it uses that classes rendering.

 

As jabelar said, make sure registerRenderThings() is being called

Posted

Apparently I //commented the line that calls registerRenderThings() when I gave up on making a mob last time...

Works now, thanks for reminding me.

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.