Jump to content

Recommended Posts

Posted

My custom mob is refusing to load the texture no matter what I try. It's supposed to look like three of the block in my hand stacked.

 

Screenshot:

osvkz74.png

 

Mob class:

package merrychristmas.mod.fhbgds.entity;

import java.util.Random;

import merrychristmas.mod.fhbgds.lib.ContentLoader;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityOwnable;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class EntityKevin extends EntityMob{

Random random = new Random();
int xPos;
int yPos;
int zPos;

public EntityKevin(World world) {
	super(world);
	this.setEntityHealth(getMaxHealth());
	this.setSize(0.9F, 3.0F);
	this.tasks.addTask(2, new EntityAIWander(this, 0.2F));
        this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(3, new EntityAILookIdle(this));
        this.setCustomNameTag("Kevin");
        this.setAlwaysRenderNameTag(true);
}

@Override
public void entityInit(){
	super.entityInit();
}

@Override
public void collideWithEntity(Entity entity){
	super.collideWithEntity(entity);
}

public float getMaxHealth(){
	return 20.0f;
}

@Override
public void onEntityUpdate(){
	super.onEntityUpdate();
}

@Override
public boolean isAIEnabled(){
	return true;
}

public void setPos(int x, int y, int z){
	this.posX = (double) x + 0.5;
	this.posY = (double) y - 1.95;
	this.posZ = (double) z + 0.5;
	this.rotationPitch = 0;
	this.rotationYaw = 0;
	this.boundingBox.setBounds(x, y, z, x + 1, y + 3, z + 1);
}

@Override
protected void fall(float par1) {
	super.fall(par1);
}

@Override
    protected String getLivingSound(){
        return "none";
    }

@Override
    protected String getHurtSound(){
        return "none";
    }

@Override
    protected String getDeathSound(){
        return "none";
    }

@Override
    protected boolean canDespawn(){
        return false;
    }

@Override
protected int getDropItemId(){
        return ContentLoader.dethornedCactus.blockID;
    }

@Override
protected void dropFewItems(boolean par1, int par2){
	int drop = random.nextInt(4);
	this.dropItem(this.getDropItemId(), drop);
}

@Override
public String getEntityName(){
	return "Kevin";
}
}

 

 

Render Class:

package merrychristmas.mod.fhbgds.render;

import merrychristmas.mod.fhbgds.client.ModelKevin;
import merrychristmas.mod.fhbgds.lib.Reference;
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.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderKevin extends RenderLiving {
private static final ResourceLocation field_110833_a = new ResourceLocation(Reference.MOD_ID, "textures/entity/kevin.png");

public RenderKevin(ModelBase model, float par2){
	super(model, par2);
}

protected ResourceLocation func_110832_a(EntityLiving entity){
        return field_110833_a;
    }

    protected ResourceLocation func_110775_a(Entity entity){
        return this.func_110832_a((EntityLiving)entity);
    }
}

 

 

Model Class:

package merrychristmas.mod.fhbgds.client;

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

public class ModelKevin extends ModelBase{


    //fields
    //ModelRenderer body;
ModelRenderer Body1;
    ModelRenderer Body2;
    ModelRenderer Body3;
  
  public ModelKevin()
  {
//    textureWidth = 128;
//    textureHeight = 64;
//    
//      body = new ModelRenderer(this, 0, 0);
//      body.addBox(-7F, -12F, -7F, 14, 48, 14);
//      body.setRotationPoint(0F, -12F, 0F);
//      body.setTextureSize(textureWidth, textureHeight);
//      body.mirror = true;
//      this.setRotation(body, 0F, 0F, 0F);
  
    textureWidth = 64;
    textureHeight = 32;
    
      Body1 = new ModelRenderer(this, 0, 0);
      Body1.addBox(-7F, 0F, -7F, 14, 16, 14);
      Body1.setRotationPoint(0F, 8F, 0F);
      Body1.setTextureSize(textureWidth, textureHeight);
      Body1.mirror = true;
      setRotation(Body1, 0F, 45F, 0F);
      Body2 = new ModelRenderer(this, 0, 0);
      Body2.addBox(-7F, -16F, -7F, 14, 16, 14);
      Body2.setRotationPoint(0F, 8F, 0F);
      Body2.setTextureSize(textureWidth, textureHeight);
      Body2.mirror = true;
      setRotation(Body2, 0F, 0F, 0F);
      Body3 = new ModelRenderer(this, 0, 0);
      Body3.addBox(-7F, -16F, -7F, 14, 16, 14);
      Body3.setRotationPoint(0F, -8F, 0F);
      Body3.setTextureSize(textureWidth, textureHeight);
      Body3.mirror = true;
      setRotation(Body3, 0F, 0F, 0F);
  }
  
  @Override
  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);
    Body1.render(f5);
    Body2.render(f5);
    Body3.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  @Override
  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);
  }

}

 

Client Proxy:

package merrychristmas.mod.fhbgds.client;

import merrychristmas.mod.fhbgds.common.ProxyCommon;
import merrychristmas.mod.fhbgds.entity.EntityKevin;
import merrychristmas.mod.fhbgds.render.RenderKevin;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ProxyClient extends ProxyCommon {

@Override
public void addRenderer(){
	RenderingRegistry.registerEntityRenderingHandler(EntityKevin.class, new RenderKevin(new ModelKevin(), 0.5F));
}

}

 

Let me know if you need more info, any help is greatly appreciated!

Posted

I'm assuming this is what you meant?

 

Render:

package merrychristmas.mod.fhbgds.render;

import merrychristmas.mod.fhbgds.client.ModelKevin;
import merrychristmas.mod.fhbgds.lib.Reference;
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.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderKevin extends RenderLiving {
private static final ResourceLocation textureLoc = new ResourceLocation(Reference.MOD_ID, "textures/entity/kevin.png");

public RenderKevin(ModelBase model, float par2){
	super(model, par2);
}

protected ResourceLocation getTextureLoc(EntityLiving entity){
        return textureLoc;
    }

@Override
    protected ResourceLocation func_110775_a(Entity entity){
        return this.getTextureLoc((EntityLiving)entity);
    }
}

 

texture is located at "assets.merrychristmas.textures.entity"

 

Reference.MOD_ID == "merrychristmas"

 

Still nothing.  :(

Posted

Now for the stupid, but necessary, questions:

-is your texture white ?

-did you call addRenderer() from your proxy ?

-did you register your entity ?

-are you sure your model works ? (like, did it work in previous versions ?)

-is your assets folder in mcp/src ?

-is the texture path all lowercase ?

  • 4 weeks later...

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

    • So am trying to make a custom 1.19.2 modpack and everything works until I add Oculus. I have tried Oculus+Embedium and Oculus+Rubdium and by themselves they work but as soon as I add anything it crashes no matter what it is. The modpack works fine with just Embedium and Rubdium. Can you help me to see if this is something i can fix or do i just have to deal with not having shaders. Here is the crash log. Thank you for your time. https://paste.ee/p/WXfNZ24K
    • What do I do now when it says "1 error"?
    • Hello everyone new here how are you all?
    • I haven't tested it but under https://minecraft.wiki/w/Items_model_definition it says now:   So I guess the resource location must have changed with 1.24.4, which means you need to move your models/item/ to the new source. But as I said I haven't tested this so it also may be that this wont work. Nevertheless give it a try      EDIT (important) So now I tested it and found out how it works   Let the model files (e.g. the .json from blockbench) within "assets/<your_mod_id>/models/item" In addition to that do the following: Every model you added will need a new file under "assets/<your_mod_id>/items" That file is also a JSON and looks like this: { "model": { "type": "minecraft:model", "model": "your_mod_id:item/custom_item" } } - "type" can be minecraft:model, minecraft:composite, minecraft:condition, minecraft:select, minecraft:range_dispatch, minecraft:empty, minecraft:bundle/selected_item or minecraft:special. (In most cases you would need minecraft:model) - "model" is the path to your actual model for this item. For example the value above would point to "assets/your_mod_id/models/item/custom_item"
  • Topics

×
×
  • Create New...

Important Information

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