Jump to content

Recommended Posts

Posted

Ok so I've read up and watched two tutorial videos but can't seem to find anyone that knows exactly what the mergeItemStack parameters do.  Either there is no explanation or they say "this is just how it works" :).

 

Anyway, trying to troubleshoot here and having a hard time understanding the code (especially with no real variable names in the fml class).

 

So I figured this out:

 

mergeItemStack(clickedStackObject, slotStart, slotEnd+ 1, BOOLEAN)

 

First off I'm unsure why it only works when I add one to the end slot.  I see this in the original code:

 

if (p_75135_4_) {
     k = p_75135_3_ - 1;
}

Where p_75135_3_ is the slotEnd and p_75135_4_ is the BOOLEAN.  This suggests it subtracts one from the end, but only if the BOOLEAN is set to true.  As per the example I was looking at I set the BOOLEAN to false so this shouldn't get run.

 

The other question I was wondering is what is the BOOL parameter for?  True or False does not seem to make a difference?

 

Any help is greatly appreciated!

 

Posted

Ooop, spoke to soon.  It's often the case that as soon as I give up and go looking for help I find the answer.

 

Setting k in the if statement sets it to the END parameter.  Either way it subtracts one, the BOOLEAN is just so you can choose if it starts at the end of the slots or the beginning.

 

The reason I'm trying to figure this out btw is I have an item that ItemRecord and it doesn't allow mergeItemStack to be used on it.  At first I thought it was because it wasn't stackable, but neither are swords and they work, so trying to figure out what I need to change in my item to allow shift clicking to a crafting table :)

Posted

Well, figured out the culprit but not the solution.  It seems anything that is ItemRecord has a stackSize of 0.  Other items, including non stackable items like Swords all have a stackSize of 1.

 

I haven't been able to find where this is set or why.

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.