LaserIO

LaserIO

21M Downloads

Itemstacks use isEmpty. Not this Nightmare

Soaryn opened this issue · 3 comments

commented

In theory, your check on if an itemstack is empty is causing this crash

public boolean hasCraftingRemainingItem(ItemStack stack) {

Itemstacks have an isEmpty as there are a lot of cases where something can be empty but not literally Itemstack.EMPTY

commented

Just tested this — it does indeed fix the crash — thanks!

commented

TBH, if he's the only one ever managing that inventory, this check might be okay. It obviously has been for a few releases now. I agree with you that isEmpty is the proper way to do things.

But two things here:

  1. Don't be a dick. There was no reason for the title of the issue to be this.
  2. WTF is the Fabricator even doing attempting to rip the card out of the node? Sure seems like it shouldn't be doing that.
commented

For the second point, I only grab items that are in valid item handlers that are adjacent to the fabricator. I'm not pulling items that are not meant to be pulled. I make a copy, and check the recipe. The reasoj they are pullable, Dire wanted the laser nodes to be changeable with sneaky pipes(access to other side of blocks) and other lasers. But this in theory would crash with just a configured card in an arbitrary inv and the hasRemainder is misfiring then resulting in null in a construction somewhere down the line.

There is a defensive check ontop of the defensive check I could employ, but as I already told Dire, I cant release a build at the moment nor should it be necessary.

As for the first point. A bit hypocritical, but for this is was more in line with dire's usual shenanigan repertoire we have. Not sure why you felt you needed to be involved.