aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2025-04-12 16:43:27 +0800
committershedaniel <daniel@shedaniel.me>2025-04-12 16:43:27 +0800
commit9b367326a210dc6842c45341ddf4f3d599158736 (patch)
tree9e268d360eec78f372f62d8a7d4600fd6154a185
parente0f7553d6eaa7a702b37143d07f0d9627797d93a (diff)
downloadRoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.tar.gz
RoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.tar.bz2
RoughlyEnoughItems-9b367326a210dc6842c45341ddf4f3d599158736.zip
Fix #1863
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java16
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java16
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java16
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FadingFavoritesPanelButton.java1
6 files changed, 35 insertions, 23 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;
}
}
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java
index 7aae3ef19..7d7135373 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java
@@ -561,8 +561,11 @@ public class EntryWidget extends Slot implements DraggableStackProviderWidget {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
- if (containsMouse(mouseX, mouseY))
+ if (containsMouse(mouseX, mouseY)) {
this.wasClicked = true;
+ return true;
+ }
+
return super.mouseClicked(mouseX, mouseY, button);
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java
index ea026dcfd..d9ea0710b 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java
@@ -234,9 +234,11 @@ public class DisplayEntry extends WidgetWithBounds {
return true;
}
}
+
+ return true;
}
- return super.mouseClicked(mouseX, mouseY, button);
+ return false;
}
@Override
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FadingFavoritesPanelButton.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FadingFavoritesPanelButton.java
index cacf858b6..0dd9caf7e 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FadingFavoritesPanelButton.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FadingFavoritesPanelButton.java
@@ -105,6 +105,7 @@ public abstract class FadingFavoritesPanelButton extends WidgetWithBounds {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (isVisible() && containsMouse(mouseX, mouseY)) {
this.wasClicked = true;
+ return true;
}
return false;
}