diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-10-14 19:00:54 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-10-14 19:00:54 +0800 |
| commit | 47f541ef0166caad1cb1906f237a2ff3cf8cd115 (patch) | |
| tree | 5d8bc4f1552864ba34229a7bc1e402be0eacd8b3 /default-plugin | |
| parent | 81f07b79c7560c4b0aba0d6dd3c1cac781fad68a (diff) | |
| download | RoughlyEnoughItems-47f541ef0166caad1cb1906f237a2ff3cf8cd115.tar.gz RoughlyEnoughItems-47f541ef0166caad1cb1906f237a2ff3cf8cd115.tar.bz2 RoughlyEnoughItems-47f541ef0166caad1cb1906f237a2ff3cf8cd115.zip | |
21w41a
Diffstat (limited to 'default-plugin')
| -rw-r--r-- | default-plugin/src/main/java/me/shedaniel/rei/plugin/client/exclusionzones/DefaultPotionEffectExclusionZones.java | 10 |
1 files changed, 6 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 bdc495ec2..e07e521b3 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 @@ -41,19 +41,21 @@ import java.util.List; public class DefaultPotionEffectExclusionZones implements ExclusionZonesProvider<EffectRenderingInventoryScreen<?>> { @Override public Collection<Rectangle> provide(EffectRenderingInventoryScreen<?> screen) { - if (!screen.doRenderEffects) + if (!screen.canSeeEffects()) return Collections.emptyList(); Collection<MobEffectInstance> activePotionEffects = Minecraft.getInstance().player.getActiveEffects(); - if (activePotionEffects.isEmpty()) + int x = screen.leftPos + screen.imageWidth + 2; + int availableWidth = screen.width - x; + if (activePotionEffects.isEmpty() || availableWidth < 32) return Collections.emptyList(); + boolean fullWidth = availableWidth >= 120; List<Rectangle> zones = new ArrayList<>(); - int x = screen.leftPos - 124; int y = screen.topPos; int height = 33; if (activePotionEffects.size() > 5) height = 132 / (activePotionEffects.size() - 1); for (MobEffectInstance instance : Ordering.natural().sortedCopy(activePotionEffects)) { - zones.add(new Rectangle(x, y, 166, height)); + zones.add(new Rectangle(x, y, fullWidth ? 120 : 32, 32)); y += height; } return zones; |
