From 08571477c095235110f3d9097a06baaf42e1b1c9 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 15 Jan 2022 00:49:22 +0800 Subject: Close #683 --- .../DefaultPotionEffectExclusionZones.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'default-plugin/src/main/java/me') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java index e07e521b3..c987fffb1 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java @@ -25,6 +25,7 @@ package me.shedaniel.rei.plugin.client.exclusionzones; import com.google.common.collect.Ordering; import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.registry.screen.ExclusionZonesProvider; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -43,12 +44,26 @@ public class DefaultPotionEffectExclusionZones implements ExclusionZonesProvider public Collection provide(EffectRenderingInventoryScreen screen) { if (!screen.canSeeEffects()) return Collections.emptyList(); + boolean leftSideMobEffects = ConfigObject.getInstance().isLeftSideMobEffects(); Collection activePotionEffects = Minecraft.getInstance().player.getActiveEffects(); - int x = screen.leftPos + screen.imageWidth + 2; - int availableWidth = screen.width - x; - if (activePotionEffects.isEmpty() || availableWidth < 32) + int x; + boolean fullWidth; + + if (!leftSideMobEffects) { + x = screen.leftPos + screen.imageWidth + 2; + int availableWidth = screen.width - x; + fullWidth = availableWidth >= 120; + + if (availableWidth < 32) { + return Collections.emptyList(); + } + } else { + fullWidth = screen.leftPos >= 120; + x = screen.leftPos - (fullWidth ? 124 : 36); + } + + if (activePotionEffects.isEmpty()) return Collections.emptyList(); - boolean fullWidth = availableWidth >= 120; List zones = new ArrayList<>(); int y = screen.topPos; int height = 33; -- cgit