aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
index 761dafd73..b16e41e2c 100644
--- a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
+++ b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
@@ -33,10 +33,10 @@ import me.shedaniel.rei.plugin.crafting.DefaultCraftingDisplay;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
import net.minecraft.client.resource.language.I18n;
-import net.minecraft.container.CraftingContainer;
-import net.minecraft.container.CraftingTableContainer;
-import net.minecraft.container.PlayerContainer;
import net.minecraft.recipe.Recipe;
+import net.minecraft.screen.CraftingScreenHandler;
+import net.minecraft.screen.CraftingTableScreenHandler;
+import net.minecraft.screen.PlayerScreenHandler;
public class DefaultRecipeBookHandler implements AutoTransferHandler {
@Override
@@ -44,17 +44,17 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
if (context.getRecipe() instanceof TransferRecipeDisplay && DefaultCategoryHandler.canUseMovePackets())
return Result.createNotApplicable();
RecipeDisplay display = context.getRecipe();
- if (!(context.getContainer() instanceof CraftingContainer))
+ if (!(context.getScreenHandler() instanceof CraftingScreenHandler))
return Result.createNotApplicable();
- CraftingContainer<?> container = (CraftingContainer<?>) context.getContainer();
+ CraftingScreenHandler<?> container = (CraftingScreenHandler<?>) context.getScreenHandler();
if (display instanceof DefaultCraftingDisplay) {
DefaultCraftingDisplay craftingDisplay = (DefaultCraftingDisplay) display;
if (craftingDisplay.getOptionalRecipe().isPresent()) {
int h = -1, w = -1;
- if (container instanceof CraftingTableContainer) {
+ if (container instanceof CraftingTableScreenHandler) {
h = 3;
w = 3;
- } else if (container instanceof PlayerContainer) {
+ } else if (container instanceof PlayerScreenHandler) {
h = 2;
w = 2;
}
@@ -67,9 +67,9 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
return Result.createFailed(I18n.translate("error.rei.recipe.not.unlocked"));
if (!context.isActuallyCrafting())
return Result.createSuccessful();
- context.getMinecraft().openScreen(context.getContainerScreen());
- if (context.getContainerScreen() instanceof RecipeBookProvider)
- ((RecipeBookGuiHooks) ((RecipeBookProvider) context.getContainerScreen()).getRecipeBookWidget()).rei_getGhostSlots().reset();
+ context.getMinecraft().openScreen(context.getScreenWithHandler());
+ if (context.getScreenWithHandler() instanceof RecipeBookProvider)
+ ((RecipeBookGuiHooks) ((RecipeBookProvider) context.getScreenWithHandler()).getRecipeBookWidget()).rei_getGhostSlots().reset();
context.getMinecraft().interactionManager.clickRecipe(container.syncId, recipe, Screen.hasShiftDown());
ScreenHelper.getLastOverlay().init();
}
@@ -81,9 +81,9 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
return Result.createFailed(I18n.translate("error.rei.recipe.not.unlocked"));
if (!context.isActuallyCrafting())
return Result.createSuccessful();
- context.getMinecraft().openScreen(context.getContainerScreen());
- if (context.getContainerScreen() instanceof RecipeBookProvider)
- ((RecipeBookGuiHooks) ((RecipeBookProvider) context.getContainerScreen()).getRecipeBookWidget()).rei_getGhostSlots().reset();
+ context.getMinecraft().openScreen(context.getScreenWithHandler());
+ if (context.getScreenWithHandler() instanceof RecipeBookProvider)
+ ((RecipeBookGuiHooks) ((RecipeBookProvider) context.getScreenWithHandler()).getRecipeBookWidget()).rei_getGhostSlots().reset();
context.getMinecraft().interactionManager.clickRecipe(container.syncId, recipe, Screen.hasShiftDown());
ScreenHelper.getLastOverlay().init();
}