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

    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
    • Necro'ing that thread to ask if you found a solution ? I'm encountering the same crash on loading the world. I created the world in Creative to test my MP, went into survival to test combat, died, crashed on respawn and since then crash on loading the world. Deactivating Oculus isn't fixing it either, and I don't have Optifine (Twilight forest is incompatible)
  • Topics

×
×
  • Create New...

Important Information

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