Jump to content

Using a RenderTickHandler makes the game lag, not even opening the save


someonewithpc

Recommended Posts

I'm having problems with Rendering a Wavefront Object as Armor.

 

So, I've been looking around 'da webs' and didn't find anything usefull. I tried using the 'getArmorModel' method in the ItemArmor class (overriding it in my Item class), but it doesn't get called. Do I need to make anything else so it does get called?

 

As that didn't work I tried to setup a RenderTickHandler, however, now the game runs really slowly, and fails to open the world, because of that slowness.

I'm using TickEvents.RenderTickEvent, and I've tried  registering my handler in both FMLCommonHandler and MinecraftForge.EVENT_BUS. here is my code:

 

RenderTickHandler:

 

public class RenderTickHandler{

/*public RenderTickHandler(){ }*/

HashMap<EntityPlayer, ItemStack> map = new HashMap();

public void addArmorToList(EntityPlayer player, ItemStack stack){

	if(map.get(player) != null)
		map.put(player, stack);
}

@SubscribeEvent
public void onPlayerRender(/*RenderPlayerEvent*/ TickEvent.RenderTickEvent event){

	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	ItemStack stack = map.get(player);

	if(stack != null){
		if(stack.getItem() instanceof WuellrovKnightArmor){

			WuellrovKnightArnorRender.render(player, ((ItemArmor) stack.getItem()).armorType);

		}


	}
}
}

 

 

ClientProxy:

 

	public static RenderTickHandler renderer;

@Override
public void initRenderes() {

	renderer = new RenderTickHandler();
	//FMLCommonHandler.instance().bus().register(renderer);
	MinecraftForge.EVENT_BUS.register(renderer);
}
}

 

 

Additionally, I'm running the game on debug mode, in eclipse, which ran just fine using the RenderPlayerEvent, however it didn't get called (that might be why... </sarcasm>), and other models work just fine.

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.