Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
    }
}

  • Author

I've followed through with the tutorial and made any changes where my code had differed, but I still have the mangled texture. :(

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.

  • Author

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.