Jump to content

[1.7.2] Rendering previously held item.


Recommended Posts

I wondering if anyone out there can help me with my predicament, its probably simple code and i'm just being blind. But I am trying to set a ItemStack to he previous item the player was holding before they switch to a new one.


public void onPlayerRender(RenderPlayerEvent.Specials.Post event){
	if(event.isCanceled()) return;

	ItemStack currentHeldItem = event.entityPlayer.getCurrentEquippedItem();
	ItemStack tempStk = null;
	ItemStack prevHeldItem = null;

	if(currentHeldItem != null){
		tempStk = currentHeldItem;

	if(tempStk != null && prevHeldItem != currentHeldItem){
		prevHeldItem = tempStk;


	if (prevHeldItem != currentHeldItem) {

		if ((prevHeldItem.getItem() instanceof ItemSword)
			|| (prevHeldItem.getItem() instanceof ItemTool)
			|| (prevHeldItem.getItem() instanceof ItemHoe)) {


I need to get the currentHeldItem and set it to the prevHeld so it can be renderer when they are holding a different Item.


Help would be greatly appreciated.

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.

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.


  • Create New...

Important Information

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