Skip to content

Commit

Permalink
fix and log too large stack sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Nov 29, 2024
1 parent cb84d4d commit 99c6330
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.minecolonies.api.colony.requestsystem.factory.IFactoryController;
import com.minecolonies.api.crafting.ItemStorage;
import com.minecolonies.api.util.ItemStackUtils;
import com.minecolonies.api.util.Log;
import com.minecolonies.api.util.ReflectionUtils;
import com.minecolonies.api.util.Utils;
import com.minecolonies.api.util.constant.TypeConstants;
Expand Down Expand Up @@ -165,7 +166,17 @@ public Stack(final ItemStack stack, final boolean matchDamage, final boolean mat
throw new IllegalArgumentException("Cannot deliver Empty Stack.");
}

this.theStack = stack.copy();
if (stack.getCount() > stack.getMaxStackSize())
{
Log.getLogger().error("Stack with ItemStack with too large stack size.: ", new Exception());
this.theStack = stack.copy();
this.theStack.setCount(this.theStack.getMaxStackSize());
}
else
{
this.theStack = stack.copy();
}

this.matchDamage = matchDamage;
this.matchNBT = matchNBT;
this.result = result;
Expand Down

0 comments on commit 99c6330

Please sign in to comment.