Jump to content

[1.7.10] Mangled Mob Texture


SHiLLySiT

Recommended Posts

I'm attempting to create an NPC using the Biped model. While I can get the NPC to spawn, it spawns with the texture mangled.

width=800 height=476https://s32.postimg.org/9gd2ryu45/2016_07_06_1000.png[/img]

 

Any ideas? Here's the relevant code:

 

Renderer:

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderQuestNpc extends RenderLiving {

private static final ResourceLocation texture = new ResourceLocation(EmpathyMod.MODID + ":textures/npc/testskin2.png");

public RenderQuestNpc() {
	super(new ModelBiped(), 0.75f);
}

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

}

 

Entity:

import net.minecraft.entity.monster.EntityMob;
import net.minecraft.world.World;

public class EntityQuestNpc extends EntityMob {
private final Emotions _emotions;

public EntityQuestNpc(World world) {
	super(world);
	_emotions = new Emotions(this);
}

public void render(double x, double y, double z) {
	_emotions.render(x, y, z);
}
}

 

Render Registry:

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

public class Renderers {
public static void init() {
	RenderingRegistry.registerEntityRenderingHandler(EntityQuestNpc.class, new RenderQuestNpc());
}
}

 

Client Proxy:

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.common.MinecraftForge;

public class ClientProxy extends CommonProxy {

    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
        MinecraftForge.EVENT_BUS.register(new EventHandler());
        Entities.preInit();
    }

    @Override
    public void init(FMLInitializationEvent e) {
        super.init(e);
        Renderers.init();
    }

    @Override
    public void postInit(FMLPostInitializationEvent e) {
        super.postInit(e);
    }

    @Override
    public void serverLoad(FMLServerStartingEvent e) {
    	super.serverLoad(e);
    }
}

Link to comment
Share on other sites

ModelBiped's textureHeight is 32. ModelPlayer's texture height is 64. here is your two options:

 

new model, extending ModelBiped and setting textureHeight to 64,

 

or

 

change your texture to ModelBiped's format, look at the normal zombie texture as an example.

Link to comment
Share on other sites

Hm, I took a look at the zombie texture and the png dimensions are the same. Although the zombie appears to be laid out differently on the texture, is this what you were referring to?

 

Regardless, I figured I'd test with the zombie texture so I changed my resource location to this:

 

private static final ResourceLocation texture = new ResourceLocation("minecraft:textures/entity/zombie/zombie.png");

 

Which resulted in this:

 

width=800 height=476https://s31.postimg.org/v8n57m67v/2016_07_06_1211.png[/img]

 

Unless I'm misunderstanding, it appears I still have something else wrong.

Link to comment
Share on other sites

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.