Removed direct references to VanillaTypes.ITEM_STACK
The constant value causes the JVM to try to link JEI classes at runtime when the callers class is loaded
Luckily JEI added convenience functions to remove the need for VanillaTypes.ITEM_STACK ( 6a332a73f7 )
This commit is contained in:
@@ -4,7 +4,6 @@ import com.refinedmods.refinedstorage.RSItems;
|
|||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||||
import com.refinedmods.refinedstorage.item.CoverItem;
|
import com.refinedmods.refinedstorage.item.CoverItem;
|
||||||
import com.refinedmods.refinedstorage.recipe.CoverRecipe;
|
import com.refinedmods.refinedstorage.recipe.CoverRecipe;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
|
||||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||||
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
|
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
|
||||||
import mezz.jei.api.gui.ingredient.ICraftingGridHelper;
|
import mezz.jei.api.gui.ingredient.ICraftingGridHelper;
|
||||||
@@ -55,8 +54,8 @@ public class CoverCraftingCategoryExtension implements ICraftingCategoryExtensio
|
|||||||
List<List<ItemStack>> inputs = new ArrayList<>(Collections.nCopies(9, new ArrayList<>()));
|
List<List<ItemStack>> inputs = new ArrayList<>(Collections.nCopies(9, new ArrayList<>()));
|
||||||
inputs.set(3, nuggets);
|
inputs.set(3, nuggets);
|
||||||
inputs.set(4, input);
|
inputs.set(4, input);
|
||||||
List<IRecipeSlotBuilder> inputSlots = craftingGridHelper.createAndSetInputs(builder, VanillaTypes.ITEM_STACK, inputs, 3, 3);
|
List<IRecipeSlotBuilder> inputSlots = craftingGridHelper.createAndSetInputs(builder, inputs, 3, 3);
|
||||||
IRecipeSlotBuilder outputSlot = craftingGridHelper.createAndSetOutputs(builder, VanillaTypes.ITEM_STACK, output);
|
IRecipeSlotBuilder outputSlot = craftingGridHelper.createAndSetOutputs(builder, output);
|
||||||
|
|
||||||
builder.createFocusLink(inputSlots.get(4), outputSlot);
|
builder.createFocusLink(inputSlots.get(4), outputSlot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.refinedmods.refinedstorage.network.grid.GridCraftingPreviewRequestMes
|
|||||||
import com.refinedmods.refinedstorage.network.grid.GridProcessingTransferMessage;
|
import com.refinedmods.refinedstorage.network.grid.GridProcessingTransferMessage;
|
||||||
import com.refinedmods.refinedstorage.network.grid.GridTransferMessage;
|
import com.refinedmods.refinedstorage.network.grid.GridTransferMessage;
|
||||||
import com.refinedmods.refinedstorage.screen.grid.GridScreen;
|
import com.refinedmods.refinedstorage.screen.grid.GridScreen;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
|
||||||
import mezz.jei.api.forge.ForgeTypes;
|
import mezz.jei.api.forge.ForgeTypes;
|
||||||
import mezz.jei.api.gui.ingredient.IRecipeSlotView;
|
import mezz.jei.api.gui.ingredient.IRecipeSlotView;
|
||||||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
||||||
@@ -67,7 +66,7 @@ public class GridRecipeTransferHandler implements IRecipeTransferHandler<GridCon
|
|||||||
|
|
||||||
Ingredient.IngredientList ingredientList = new Ingredient.IngredientList();
|
Ingredient.IngredientList ingredientList = new Ingredient.IngredientList();
|
||||||
for (IRecipeSlotView slotView : recipeSlots.getSlotViews(RecipeIngredientRole.INPUT)) {
|
for (IRecipeSlotView slotView : recipeSlots.getSlotViews(RecipeIngredientRole.INPUT)) {
|
||||||
Optional<ItemStack> firstStack = slotView.getIngredients(VanillaTypes.ITEM_STACK).findAny();
|
Optional<ItemStack> firstStack = slotView.getItemStacks().findAny();
|
||||||
ingredientList.add(new Ingredient(slotView, firstStack.map(ItemStack::getCount).orElse(0)));
|
ingredientList.add(new Ingredient(slotView, firstStack.map(ItemStack::getCount).orElse(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,10 +138,10 @@ public class GridRecipeTransferHandler implements IRecipeTransferHandler<GridCon
|
|||||||
List<List<ItemStack>> inputs = recipeSlotsView.getSlotViews(RecipeIngredientRole.INPUT).stream().map(view -> {
|
List<List<ItemStack>> inputs = recipeSlotsView.getSlotViews(RecipeIngredientRole.INPUT).stream().map(view -> {
|
||||||
|
|
||||||
//Creating a mutable list
|
//Creating a mutable list
|
||||||
List<ItemStack> stacks = view.getIngredients(VanillaTypes.ITEM_STACK).collect(Collectors.toCollection(ArrayList::new));
|
List<ItemStack> stacks = view.getItemStacks().collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
|
||||||
//moving the displayed stack to first
|
//moving the displayed stack to first
|
||||||
Optional<ItemStack> displayStack = view.getDisplayedIngredient(VanillaTypes.ITEM_STACK);
|
Optional<ItemStack> displayStack = view.getDisplayedItemStack();
|
||||||
displayStack.ifPresent(stack -> {
|
displayStack.ifPresent(stack -> {
|
||||||
int index = stacks.indexOf(stack);
|
int index = stacks.indexOf(stack);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
@@ -185,11 +184,11 @@ public class GridRecipeTransferHandler implements IRecipeTransferHandler<GridCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleItemIngredient(List<ItemStack> list, IRecipeSlotView slotView, GridContainerMenu gridContainer, Player player) {
|
private void handleItemIngredient(List<ItemStack> list, IRecipeSlotView slotView, GridContainerMenu gridContainer, Player player) {
|
||||||
if (slotView != null && slotView.getIngredients(VanillaTypes.ITEM_STACK).findAny().isPresent()) {
|
if (slotView != null && slotView.getItemStacks().findAny().isPresent()) {
|
||||||
ItemStack stack = IngredientTracker.getTracker(gridContainer).findBestMatch(gridContainer, player, slotView.getIngredients(VanillaTypes.ITEM_STACK).toList());
|
ItemStack stack = IngredientTracker.getTracker(gridContainer).findBestMatch(gridContainer, player, slotView.getItemStacks().toList());
|
||||||
|
|
||||||
if (stack.isEmpty() && slotView.getDisplayedIngredient(VanillaTypes.ITEM_STACK).isPresent()) {
|
if (stack.isEmpty() && slotView.getDisplayedItemStack().isPresent()) {
|
||||||
stack = slotView.getDisplayedIngredient(VanillaTypes.ITEM_STACK).get();
|
stack = slotView.getDisplayedItemStack().get();
|
||||||
}
|
}
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
list.add(stack);
|
list.add(stack);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.refinedmods.refinedstorage.RSItems;
|
|||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||||
import com.refinedmods.refinedstorage.item.CoverItem;
|
import com.refinedmods.refinedstorage.item.CoverItem;
|
||||||
import com.refinedmods.refinedstorage.recipe.HollowCoverRecipe;
|
import com.refinedmods.refinedstorage.recipe.HollowCoverRecipe;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
|
||||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||||
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
|
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
|
||||||
import mezz.jei.api.gui.ingredient.ICraftingGridHelper;
|
import mezz.jei.api.gui.ingredient.ICraftingGridHelper;
|
||||||
@@ -52,8 +51,8 @@ public class HollowCoverCraftingCategoryExtension implements ICraftingCategoryEx
|
|||||||
}
|
}
|
||||||
|
|
||||||
stacks.set(4, input);
|
stacks.set(4, input);
|
||||||
List<IRecipeSlotBuilder> inputSlots = craftingGridHelper.createAndSetInputs(builder, VanillaTypes.ITEM_STACK, stacks, 0, 0);
|
List<IRecipeSlotBuilder> inputSlots = craftingGridHelper.createAndSetInputs(builder, stacks, 0, 0);
|
||||||
IRecipeSlotBuilder outputSlot = craftingGridHelper.createAndSetOutputs(builder, VanillaTypes.ITEM_STACK, output);
|
IRecipeSlotBuilder outputSlot = craftingGridHelper.createAndSetOutputs(builder, output);
|
||||||
builder.createFocusLink(inputSlots.get(4), outputSlot);
|
builder.createFocusLink(inputSlots.get(4), outputSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack;
|
|||||||
import com.refinedmods.refinedstorage.screen.grid.stack.ItemGridStack;
|
import com.refinedmods.refinedstorage.screen.grid.stack.ItemGridStack;
|
||||||
import com.refinedmods.refinedstorage.screen.grid.view.IGridView;
|
import com.refinedmods.refinedstorage.screen.grid.view.IGridView;
|
||||||
import com.refinedmods.refinedstorage.util.ItemStackKey;
|
import com.refinedmods.refinedstorage.util.ItemStackKey;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.CraftingContainer;
|
import net.minecraft.world.inventory.CraftingContainer;
|
||||||
@@ -162,7 +161,7 @@ public class IngredientTracker {
|
|||||||
|
|
||||||
//Gather available Stacks
|
//Gather available Stacks
|
||||||
for (Ingredient ingredient : ingredientList.ingredients) {
|
for (Ingredient ingredient : ingredientList.ingredients) {
|
||||||
ingredient.getSlotView().getIngredients(VanillaTypes.ITEM_STACK).takeWhile(stack -> !ingredient.isAvailable()).forEach(stack -> {
|
ingredient.getSlotView().getItemStacks().takeWhile(stack -> !ingredient.isAvailable()).forEach(stack -> {
|
||||||
|
|
||||||
if(ingredient.getCraftStackId() == null) {
|
if(ingredient.getCraftStackId() == null) {
|
||||||
ingredient.setCraftStackId(craftableItems.get(new ItemStackKey(stack)));
|
ingredient.setCraftStackId(craftableItems.get(new ItemStackKey(stack)));
|
||||||
|
|||||||
Reference in New Issue
Block a user