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

Hi, I'm new to minecraft rendering, I' ve searched a bit on the forums and google and managed to pick some information about how to change the default renderer.

But im not sure what to change in order to make my renderer, and how to make the renderer,

 

I have this, (I dont know if works)

 

Player Render

 

 

import net.minecraft.client.model.ModelBiped;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.util.ResourceLocation;

import net.minecraft.world.World;

import net.minecraftforge.fml.client.registry.IRenderFactory;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

 

import org.lwjgl.opengl.GL11;

 

import com.mojang.authlib.GameProfile;

 

 

public class RenderPlayer extends EntityPlayer{

 

public static void start() {

RenderingRegistry.registerEntityRenderingHandler(RenderPlayer.class, new Ren());

}

 

public RenderPlayer(World worldIn, GameProfile gameProfileIn) {

super(worldIn, gameProfileIn);

}

 

@Override

public boolean isSpectator() {

return false;

}

 

@Override

public boolean isCreative() {

return false;

}

}

 

 

 

IRenderFactory

 

 

package nwdv.ndmm.render;

 

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraftforge.fml.client.registry.IRenderFactory;

 

public class Ren implements IRenderFactory{

 

@Override

public Render createRenderFor(RenderManager manager) {

return null;

}

 

}

 

 

 

To change the actual renderer, do I use this?

RenderingRegistry.registerEntityRenderingHandler(RenderPlayer.class, new Ren());

 

To render the player, do i implement this?

@Override

public Render createRenderFor(RenderManager manager) {

return null;

}

 

Thanks in advance,

NewDivide

1. RenderPlayer extends EntityPlayer

Wtf? Render is not Entity (EntityPlayer). You need to extend Render class or some subclass (e.g living render).

 

2. As of 1.9 (I think) you no longer register Render in Init - you register factory in PreInit instead.

RenderingRegistry.registerEntityRenderingHandler(EntityClass.class, new FactoryClass());

 

Your factory should return Render instance in createRenderFor.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Would this work then?

Player Render:

 

 

 

public class RenderPlayer extends Render implements IRenderFactory{

 

protected RenderPlayer(RenderManager renderManager) {

super(renderManager);

}

 

public static void start() {

RenderingRegistry.registerEntityRenderingHandler(EntityPlayer.class, (RenderPlayer::new));

}

 

@Override

protected ResourceLocation getEntityTexture(Entity entity) {

return new ResourceLocation("nwmm:textures/entity/newSkin.png");//Path to texture

}

 

@Override

public Render createRenderFor(RenderManager manager) {

//CODE HERE?

return new RenderPlayer(manager);

}

}

 

 

The

IRenderFactory

must be a separate class to the

Render

(it can also be a lambda, method reference or anonymous class). The whole point of

IRenderFactory

being introduced was to delay the creation of the

Render

instances until the

RenderManager

is ready.

 

If you're extending

Render

directly, you need to override

Render#doRender

to actually render the player. Extend from

RenderPlayer

if you want the default player model to be rendered.

 

Player renderers receive special treatment, so

RenderingRegistry#registerEntityRenderingHandler

probably won't work in this case. You'll need to create your

Render

instances in the init phase and use reflection to assign them to the

RenderManager#playerRenderer

field and the

"default"

and

"slim"

keys of the

RenderManager#skinMap

field.

 

Note that your changes will be completely overwritten if another mod does the same thing.

 

If you want to replace the skin for a specific player, consider doing something similar to what I did for capes here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

The

IRenderFactory

must be a separate class to the

Render

(it can also be a lambda, method reference or anonymous class). The whole point of

IRenderFactory

being introduced was to delay the creation of the

Render

instances until the

RenderManager

is ready.

 

If you're extending

Render

directly, you need to override

Render#doRender

to actually render the player. Extend from

RenderPlayer

if you want the default player model to be rendered.

 

Player renderers receive special treatment, so

RenderingRegistry#registerEntityRenderingHandler

probably won't work in this case. You'll need to create your

Render

instances in the init phase and use reflection to assign them to the

RenderManager#playerRenderer

field and the

"default"

and

"slim"

keys of the

RenderManager#skinMap

field.

 

Note that your changes will be completely overwritten if another mod does the same thing.

 

If you want to replace the skin for a specific player, consider doing something similar to what I did for capes here.

 

i ve tried to do it that way, but it seems that @SubscribeEvent doesnt work like i thought,

 

 

 

package nwdv.ndmm.render;

 

import net.minecraft.client.entity.AbstractClientPlayer;

import net.minecraftforge.event.entity.EntityJoinWorldEvent;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class RenderEvent {

@SubscribeEvent

public void entityJoin(EntityJoinWorldEvent event) {

System.out.println("fire");

}

}

 

 

 

 

this doesnt fire at all, am i doing it 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.