aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-01-15 00:49:22 +0800
committershedaniel <daniel@shedaniel.me>2022-01-15 00:49:22 +0800
commit08571477c095235110f3d9097a06baaf42e1b1c9 (patch)
tree3cf6c0c524379d5cb6c07e534654a87bce49b277 /default-plugin/src
parentb07b0f77ec1327a8f927e4f4559387a0560b02ba (diff)
downloadRoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.tar.gz
RoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.tar.bz2
RoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.zip
Close #683
Diffstat (limited to 'default-plugin/src')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java23
1 files changed, 19 insertions, 4 deletions
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<Rectangle> provide(EffectRenderingInventoryScreen<?> screen) {
if (!screen.canSeeEffects())
return Collections.emptyList();
+ boolean leftSideMobEffects = ConfigObject.getInstance().isLeftSideMobEffects();
Collection<MobEffectInstance> 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<Rectangle> zones = new ArrayList<>();
int y = screen.topPos;
int height = 33;