SHiLLySiT Posted July 6, 2016 Posted July 6, 2016 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. https://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); } } Quote
Egietje Posted July 6, 2016 Posted July 6, 2016 is the texture the right size? Quote http://i.imgur.com/J4rrGt6.png[/img]
SHiLLySiT Posted July 6, 2016 Author Posted July 6, 2016 I just downloaded this skin to test. Its 64x64 which I assume is the right size? Quote
SHiLLySiT Posted July 6, 2016 Author Posted July 6, 2016 I've followed through with the tutorial and made any changes where my code had differed, but I still have the mangled texture. Quote
Alexthe666 Posted July 6, 2016 Posted July 6, 2016 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. Quote
SHiLLySiT Posted July 6, 2016 Author Posted July 6, 2016 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: https://s31.postimg.org/v8n57m67v/2016_07_06_1211.png[/img] Unless I'm misunderstanding, it appears I still have something else wrong. Quote
SHiLLySiT Posted July 6, 2016 Author Posted July 6, 2016 Ahhhhh, that fixed it. So it indeed was just the texture size. Thank you! Quote
Recommended Posts
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.