Skip to content

Commit

Permalink
Fixed stack comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Jun 28, 2023
1 parent 370b9f1 commit c33fa53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand,
compactingUtil.setup(stack);
handler.setup(compactingUtil);
for (int i = 0; i < handler.getResultList().size(); i++) {
if (ItemStack.matches(handler.getResultList().get(i).getResult(), stack)){
if (ItemStack.isSameItem(handler.getResultList().get(i).getResult(), stack)) {
slot = i;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public InteractionResult onSlotActivated(Player playerIn, InteractionHand hand,
compactingUtil.setup(stack);
handler.setup(compactingUtil);
for (int i = 0; i < handler.getResultList().size(); i++) {
if (ItemStack.matches(handler.getResultList().get(i).getResult(), stack)) {
if (ItemStack.isSameItem(handler.getResultList().get(i).getResult(), stack)) {
slot = i;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private Result findUpperTier(ItemStack stack){
container = createContainerAndFill(1, output);
List<ItemStack> reversed = findAllMatchingRecipes(container);
for (ItemStack reversedStack : reversed) {
if (reversedStack.getCount() != sizeCheck || !ItemStack.matches(reversedStack, stack)){
if (reversedStack.getCount() != sizeCheck || !ItemStack.isSameItem(reversedStack, stack)) {
continue;
}
realOutputs.add(output);
Expand All @@ -113,7 +113,7 @@ private Result findLowerTier(ItemStack stack){
Map<ItemStack, Integer> candidatesRate = new HashMap<>();
for (CraftingRecipe craftingRecipe : level.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING)) {
ItemStack output = craftingRecipe.getResultItem(this.level.registryAccess());
if (!ItemStack.matches(stack, output)) continue;
if (!ItemStack.isSameItem(stack, output)) continue;
ItemStack match = tryMatch(stack, craftingRecipe.getIngredients());
if (!match.isEmpty()){
int recipeSize = craftingRecipe.getIngredients().size();
Expand All @@ -124,7 +124,7 @@ private Result findLowerTier(ItemStack stack){
CraftingContainer container = createContainerAndFill(1, output);
List<ItemStack> matchStacks = findAllMatchingRecipes(container);
for (ItemStack matchStack : matchStacks) {
if (ItemStack.matches(match, matchStack) && matchStack.getCount() == recipeSize){
if (ItemStack.isSameItem(match, matchStack) && matchStack.getCount() == recipeSize) {
candidates.add(match);
candidatesRate.put(match, recipeSize);
break;
Expand Down Expand Up @@ -204,7 +204,7 @@ private CraftingContainer createContainerAndFill(int size, ItemStack stack){
CraftingContainer inventoryCrafting = new TransientCraftingContainer(new AbstractContainerMenu(null, 0) {
@Override
public ItemStack quickMoveStack(Player p_38941_, int p_38942_) {
return null;
return ItemStack.EMPTY;
}

@Override
Expand Down

0 comments on commit c33fa53

Please sign in to comment.