Jump to content

[Solved] Shift click an item to go into slot in two input furnace


Jeerdus

Recommended Posts

I have a two input furnace and I want to say that when itemstack1 isn't Elementum.ironCell OR TileEntityCellingMachine.isItemFuel(itemstack1) // which means all items that power the furnace

put the itemstack1 (which can be any item) into a slot number 0.

 

For some weird reason it won't work.

 

Here's the method:

public ItemStack transferStackInSlot(EntityPlayer player, int slotNum)
{	
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(slotNum);

if(slot != null && slot.getHasStack()){
	ItemStack itemstack1 = slot.getStack();
	itemstack = itemstack1.copy();

	if(slotNum == 3){
		if(!this.mergeItemStack(itemstack1, 4, 40, true))
		{
			return null;
		}

		slot.onSlotChange(itemstack1, itemstack);
	}
	else if(slotNum != 2 && slotNum != 1 && slotNum != 0){
		if(itemstack1.getItem() != Elementum.ironCell || !TileEntityCellingMachine.isItemFuel(itemstack1)){
				if(!this.mergeItemStack(itemstack1, 0, 1, false)){
					return null;
				}
		}
		else if(TileEntityCellingMachine.isItemFuel(itemstack1)){
			if (!this.mergeItemStack(itemstack1, 2, 3, false)){
				return null;
			}
		}
		else if(itemstack1.getItem() == Elementum.ironCell){
			if (!this.mergeItemStack(itemstack1, 1, 2, false)){
				return null;
			}
		}
		else if(slotNum >= 4 && slotNum < 31){
			if(!this.mergeItemStack(itemstack1, 31, 40, false)){
				return null;
			}
		}
		else if(slotNum >= 31 && slotNum > 40 && !this.mergeItemStack(itemstack1, 31, 40, false)){
			if(!this.mergeItemStack(itemstack1, 4, 31, false)){
				return null;
			}
		}
	}
	else if(!this.mergeItemStack(itemstack1, 4, 31, false)){
		return null;
	}
	if(itemstack1.stackSize == 0){
		slot.putStack((ItemStack)null);
	}
	else{
		slot.onSlotChanged();
	}
	if(itemstack1.stackSize == itemstack.stackSize){
		return null;
	}

	slot.onPickupFromSlot(player, itemstack1);
}


return itemstack;
}

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.