From de461fde691f593b85ffeae837b5b419a9abf7cc Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 9 Mar 2021 23:17:05 +0800 Subject: Use AbstractRecipeViewingScreen and remove static from ScreenHelper Signed-off-by: shedaniel --- .../me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java index 9fd033af6..f46d5433b 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java @@ -25,10 +25,10 @@ package me.shedaniel.rei.plugin; import com.google.common.collect.Ordering; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.REIHelper; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; import net.minecraft.world.effect.MobEffectInstance; @@ -43,12 +43,13 @@ import java.util.function.Supplier; public class DefaultPotionEffectExclusionZones implements Supplier> { @Override public List get() { - if (!(REIHelper.getInstance().getPreviousContainerScreen() instanceof EffectRenderingInventoryScreen) || !((EffectRenderingInventoryScreen) REIHelper.getInstance().getPreviousContainerScreen()).doRenderEffects) + Screen screen = Minecraft.getInstance().screen; + if (!(screen instanceof EffectRenderingInventoryScreen) || !((EffectRenderingInventoryScreen) screen).doRenderEffects) return Collections.emptyList(); Collection activePotionEffects = Minecraft.getInstance().player.getActiveEffects(); if (activePotionEffects.isEmpty()) return Collections.emptyList(); - AbstractContainerScreen containerScreen = REIHelper.getInstance().getPreviousContainerScreen(); + AbstractContainerScreen containerScreen = (AbstractContainerScreen) screen; List list = new ArrayList<>(); int x = containerScreen.leftPos - 124; int y = containerScreen.topPos; -- cgit