-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from refinedmods/release/0.4.0
Release v0.4.0
- Loading branch information
Showing
16 changed files
with
408 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...a/com/refinedmods/refinedstorage/jei/common/PatternGridCraftingRecipeTransferHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.refinedmods.refinedstorage.jei.common; | ||
|
||
import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; | ||
import com.refinedmods.refinedstorage.common.content.Menus; | ||
import com.refinedmods.refinedstorage.common.support.resource.ItemResource; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
|
||
import mezz.jei.api.constants.RecipeTypes; | ||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import mezz.jei.api.recipe.transfer.IRecipeTransferError; | ||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.inventory.MenuType; | ||
import net.minecraft.world.item.crafting.CraftingRecipe; | ||
import net.minecraft.world.item.crafting.RecipeHolder; | ||
|
||
class PatternGridCraftingRecipeTransferHandler implements | ||
IRecipeTransferHandler<PatternGridContainerMenu, RecipeHolder<CraftingRecipe>> { | ||
@Override | ||
public Class<? extends PatternGridContainerMenu> getContainerClass() { | ||
return PatternGridContainerMenu.class; | ||
} | ||
|
||
@Override | ||
public Optional<MenuType<PatternGridContainerMenu>> getMenuType() { | ||
return Optional.of(Menus.INSTANCE.getPatternGrid()); | ||
} | ||
|
||
@Override | ||
public RecipeType<RecipeHolder<CraftingRecipe>> getRecipeType() { | ||
return RecipeTypes.CRAFTING; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public IRecipeTransferError transferRecipe(final PatternGridContainerMenu containerMenu, | ||
final RecipeHolder<CraftingRecipe> recipe, | ||
final IRecipeSlotsView recipeSlots, | ||
final Player player, | ||
final boolean maxTransfer, | ||
final boolean doTransfer) { | ||
if (doTransfer) { | ||
final List<List<ItemResource>> inputs = SlotUtil.getItems(recipeSlots, RecipeIngredientRole.INPUT); | ||
containerMenu.transferCraftingRecipe(inputs); | ||
} | ||
return null; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...com/refinedmods/refinedstorage/jei/common/PatternGridProcessingRecipeTransferHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.refinedmods.refinedstorage.jei.common; | ||
|
||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; | ||
import com.refinedmods.refinedstorage.common.content.Menus; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
|
||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import mezz.jei.api.recipe.transfer.IRecipeTransferError; | ||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.inventory.MenuType; | ||
import net.minecraft.world.item.crafting.RecipeHolder; | ||
|
||
class PatternGridProcessingRecipeTransferHandler implements | ||
IRecipeTransferHandler<PatternGridContainerMenu, RecipeHolder<?>> { | ||
@Override | ||
public Class<? extends PatternGridContainerMenu> getContainerClass() { | ||
return PatternGridContainerMenu.class; | ||
} | ||
|
||
@Override | ||
public Optional<MenuType<PatternGridContainerMenu>> getMenuType() { | ||
return Optional.of(Menus.INSTANCE.getPatternGrid()); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings({"DataFlowIssue"}) | ||
public RecipeType<RecipeHolder<?>> getRecipeType() { | ||
return null; // universal transfer handler makes this null safe | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public IRecipeTransferError transferRecipe(final PatternGridContainerMenu containerMenu, | ||
final RecipeHolder<?> recipe, | ||
final IRecipeSlotsView recipeSlots, | ||
final Player player, | ||
final boolean maxTransfer, | ||
final boolean doTransfer) { | ||
if (doTransfer) { | ||
final List<List<ResourceAmount>> inputs = SlotUtil.getResources(recipeSlots, RecipeIngredientRole.INPUT); | ||
final List<List<ResourceAmount>> outputs = SlotUtil.getResources(recipeSlots, RecipeIngredientRole.OUTPUT); | ||
containerMenu.transferProcessingRecipe(inputs, outputs); | ||
} | ||
return null; | ||
} | ||
} |
Oops, something went wrong.