aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src/main/java/me/shedaniel/rei/plugin/client
diff options
context:
space:
mode:
Diffstat (limited to 'default-plugin/src/main/java/me/shedaniel/rei/plugin/client')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultSmithingCategory.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java18
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java18
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java18
6 files changed, 33 insertions, 29 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
index 6c93af751..4ea379854 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
@@ -448,7 +448,7 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
ItemStack itemStack = stack.castValue();
if (!itemStack.isEnchantable()) return;
for (Pair<EnchantmentInstance, ItemStack> pair : enchantmentBooks) {
- if (!pair.getKey().enchantment.value().canEnchant(itemStack)) continue;
+ if (!pair.getKey().enchantment().value().canEnchant(itemStack)) continue;
Optional<Pair<ItemStack, Integer>> output = DefaultAnvilDisplay.calculateOutput(itemStack, pair.getValue());
if (output.isEmpty()) continue;
registry.add(new DefaultAnvilDisplay(List.of(EntryIngredients.of(itemStack), EntryIngredients.of(pair.getValue())),
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java
index 7d1e9455c..9ef500b6f 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java
@@ -24,7 +24,6 @@
package me.shedaniel.rei.plugin.client.categories;
import com.google.common.collect.Lists;
-import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.VertexConsumer;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer;
@@ -99,7 +98,6 @@ public class DefaultInformationCategory implements DisplayCategory<DefaultInform
return new Renderer() {
@Override
public void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) {
- RenderSystem.setShaderTexture(0, REIRuntime.getInstance().getDefaultDisplayTexture());
graphics.pose().pushPose();
graphics.pose().translate(-1.2f, -1, 0);
Matrix4f matrix = graphics.pose().last().pose();
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultSmithingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultSmithingCategory.java
index 003e9410b..2dc96a7b8 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultSmithingCategory.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultSmithingCategory.java
@@ -100,8 +100,8 @@ public class DefaultSmithingCategory implements DisplayCategory<SmithingDisplay>
@ApiStatus.Experimental
private static EntryIngredient getOutput(SmithingDisplay display, RegistryAccess registryAccess, EntryStack<?> template, EntryStack<?> base, EntryStack<?> addition) {
- if (display.type() == SmithingDisplay.SmithingRecipeType.TRIM) {
- EntryIngredient output = DefaultSmithingDisplay.getTrimmingOutput(registryAccess, template, base, addition);
+ if (display.type() == SmithingDisplay.SmithingRecipeType.TRIM && display instanceof SmithingDisplay.Trimming trimming) {
+ EntryIngredient output = DefaultSmithingDisplay.getTrimmingOutput(registryAccess, trimming.pattern(), base, addition);
if (!output.isEmpty()) return output;
}
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 d58d4f501..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
@@ -193,7 +193,7 @@ public class GameModeFavoriteEntry extends FavoriteEntry {
@Override
public DataResult<GameModeFavoriteEntry> read(CompoundTag object) {
- String stringValue = object.getString(KEY);
+ String stringValue = object.getStringOr(KEY, "NOT_SET");
GameType type = stringValue.equals("NOT_SET") ? null : GameType.valueOf(stringValue);
return DataResult.success(new GameModeFavoriteEntry(type), Lifecycle.stable());
}
@@ -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 e78cb4016..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
@@ -223,7 +223,7 @@ public class TimeFavoriteEntry extends FavoriteEntry {
@Override
public DataResult<TimeFavoriteEntry> read(CompoundTag object) {
- String stringValue = object.getString(KEY);
+ String stringValue = object.getStringOr(KEY, "NOT_SET");
Time type = stringValue.equals("NOT_SET") ? null : Time.valueOf(stringValue);
return DataResult.success(new TimeFavoriteEntry(type), Lifecycle.stable());
}
@@ -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 902b96a5c..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
@@ -197,7 +197,7 @@ public class WeatherFavoriteEntry extends FavoriteEntry {
@Override
public DataResult<WeatherFavoriteEntry> read(CompoundTag object) {
- String stringValue = object.getString(KEY);
+ String stringValue = object.getStringOr(KEY, "NOT_SET");
Weather weather = stringValue.equals("NOT_SET") ? null : Weather.valueOf(stringValue);
return DataResult.success(new WeatherFavoriteEntry(weather), Lifecycle.stable());
}
@@ -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;
}
}
}