diff options
| author | shedaniel <daniel@shedaniel.me> | 2025-04-12 16:43:27 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2025-04-12 16:43:27 +0800 |
| commit | 9b367326a210dc6842c45341ddf4f3d599158736 (patch) | |
| tree | 9e268d360eec78f372f62d8a7d4600fd6154a185 /default-plugin/src | |
| parent | e0f7553d6eaa7a702b37143d07f0d9627797d93a (diff) | |
| download | RoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.tar.gz RoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.tar.bz2 RoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.zip | |
Fix #1863
Diffstat (limited to 'default-plugin/src')
3 files changed, 27 insertions, 21 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java index bdf7456df..e78e10cc3 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java @@ -275,14 +275,16 @@ public class GameModeFavoriteEntry extends FavoriteEntry { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { + Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getGamemodeCommand().replaceAll("\\{gamemode}", gameMode.name().toLowerCase(Locale.ROOT)), "/")); + minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + closeMenu(); + return true; + } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { boolean disabled = this.minecraft.gameMode.getPlayerMode() == gameMode; - if (!disabled && rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12) { - Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getGamemodeCommand().replaceAll("\\{gamemode}", gameMode.name().toLowerCase(Locale.ROOT)), "/")); - minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - closeMenu(); - return true; - } - return super.mouseClicked(mouseX, mouseY, button); + return rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12 && !disabled; } } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java index c6c0d6bdc..dec965a60 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java @@ -300,13 +300,15 @@ public class TimeFavoriteEntry extends FavoriteEntry { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12) { - Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getTimeCommand().replaceAll("\\{time}", time.getPart().toLowerCase(Locale.ROOT)), "/")); - minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - closeMenu(); - return true; - } - return super.mouseClicked(mouseX, mouseY, button); + Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getTimeCommand().replaceAll("\\{time}", time.getPart().toLowerCase(Locale.ROOT)), "/")); + minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + closeMenu(); + return true; + } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12; } } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java index bfb0334cc..fde840d21 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java @@ -309,13 +309,15 @@ public class WeatherFavoriteEntry extends FavoriteEntry { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12) { - Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)), "/")); - minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - closeMenu(); - return true; - } - return super.mouseClicked(mouseX, mouseY, button); + Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)), "/")); + minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + closeMenu(); + return true; + } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12; } } } |
