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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
  • Topics

×
×
  • Create New...

Important Information

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