aboutsummaryrefslogtreecommitdiff
path: root/default-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'default-plugin')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java71
-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/tag/DefaultTagCategory.java6
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/CommandSender.java39
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/TimeFavoriteEntry.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/WeatherFavoriteEntry.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/tag/TagNodes.java5
9 files changed, 66 insertions, 73 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 dc02e004d..da031d740 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
@@ -23,12 +23,11 @@
package me.shedaniel.rei.plugin.client;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import com.google.common.collect.*;
import dev.architectury.event.EventResult;
import dev.architectury.networking.NetworkManager;
import dev.architectury.platform.Platform;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import it.unimi.dsi.fastutil.objects.ReferenceSet;
import me.shedaniel.math.Rectangle;
@@ -79,6 +78,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.*;
import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener;
import net.minecraft.core.Registry;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
@@ -123,14 +124,44 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
@Override
public void registerEntries(EntryRegistry registry) {
- for (Item item : Registry.ITEM) {
- try {
- registry.addEntries(EntryIngredients.ofItemStacks(registry.appendStacksForItem(item)));
- } catch (Exception ignored) {
- registry.addEntry(EntryStacks.of(item));
+ if (Minecraft.getInstance().player == null || Minecraft.getInstance().player.connection == null)
+ return;
+ Minecraft.getInstance().executeBlocking(() -> {
+ CreativeModeTabs.tryRebuildTabContents(Minecraft.getInstance().player.connection.enabledFeatures(),
+ Minecraft.getInstance().options.operatorItemsTab().get() && Minecraft.getInstance().player.canUseGameMasterBlocks());
+ });
+ Multimap<Item, EntryStack<ItemStack>> items = Multimaps.newListMultimap(new Reference2ObjectOpenHashMap<>()
+ , ArrayList::new);
+
+ for (CreativeModeTab tab : CreativeModeTabs.allTabs()) {
+ if (tab.getType() != CreativeModeTab.Type.HOTBAR && tab.getType() != CreativeModeTab.Type.INVENTORY) {
+ try {
+ for (ItemStack stack : tab.getDisplayItems()) {
+ try {
+ items.put(stack.getItem(), EntryStacks.of(stack));
+ } catch (Exception ignore) {
+ }
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ }
+
+ for (Item item : BuiltInRegistries.ITEM) {
+ Collection<EntryStack<ItemStack>> stacks = items.get(item);
+ if (stacks.isEmpty()) {
+ try {
+ registry.addEntry(EntryStacks.of(item.getDefaultInstance()));
+ } catch (Exception ignore) {
+ registry.addEntry(EntryStacks.of(item));
+ }
+ } else {
+ registry.addEntries(stacks);
}
}
- for (Fluid fluid : Registry.FLUID) {
+
+ for (Fluid fluid : BuiltInRegistries.FLUID) {
FluidState state = fluid.defaultFluidState();
if (!state.isEmpty() && state.isSource()) {
registry.addEntry(EntryStacks.of(fluid));
@@ -219,7 +250,7 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
}
private static EntryIngredient getTag(ResourceLocation tagId) {
- return EntryIngredients.ofItemTag(TagKey.create(Registry.ITEM_REGISTRY, tagId));
+ return EntryIngredients.ofItemTag(TagKey.create(Registries.ITEM, tagId));
}
@Override
@@ -236,11 +267,11 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
registry.registerFiller(AnvilRecipe.class, DefaultAnvilDisplay::new);
registry.registerFiller(BrewingRecipe.class, DefaultBrewingDisplay::new);
registry.registerFiller(TagKey.class, tagKey -> {
- if (tagKey.isFor(Registry.ITEM_REGISTRY)) {
+ if (tagKey.isFor(Registries.ITEM)) {
return DefaultTagDisplay.ofItems(tagKey);
- } else if (tagKey.isFor(Registry.BLOCK_REGISTRY)) {
+ } else if (tagKey.isFor(Registries.BLOCK)) {
return DefaultTagDisplay.ofItems(tagKey);
- } else if (tagKey.isFor(Registry.FLUID_REGISTRY)) {
+ } else if (tagKey.isFor(Registries.FLUID)) {
return DefaultTagDisplay.ofFluids(tagKey);
}
@@ -276,24 +307,24 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
List<EntryIngredient> entries = iterator.next();
registry.add(new DefaultCompostingDisplay(entries, Collections.singletonList(EntryIngredients.of(new ItemStack(Items.BONE_MEAL)))));
}
- DummyAxeItem.getStrippedBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ DummyAxeItem.getStrippedBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultStrippingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue())));
});
- DummyShovelItem.getPathBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ DummyShovelItem.getPathBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultPathingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue().getBlock())));
});
registry.add(new DefaultBeaconBaseDisplay(Collections.singletonList(EntryIngredients.ofItemTag(BlockTags.BEACON_BASE_BLOCKS)), Collections.emptyList()));
registry.add(new DefaultBeaconPaymentDisplay(Collections.singletonList(EntryIngredients.ofItemTag(ItemTags.BEACON_PAYMENT_ITEMS)), Collections.emptyList()));
- HoneycombItem.WAXABLES.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ HoneycombItem.WAXABLES.get().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultWaxingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue())));
});
- HoneycombItem.WAX_OFF_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ HoneycombItem.WAX_OFF_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultWaxScrapingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue())));
});
- WeatheringCopper.NEXT_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ WeatheringCopper.NEXT_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultOxidizingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue())));
});
- WeatheringCopper.PREVIOUS_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
+ WeatheringCopper.PREVIOUS_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> BuiltInRegistries.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultOxidationScrapingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue())));
});
if (Platform.isFabric()) {
@@ -329,7 +360,7 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
registerForgePotions(registry, this);
}
- for (Registry<?> reg : Registry.REGISTRY) {
+ for (Registry<?> reg : BuiltInRegistries.REGISTRY) {
reg.getTags().forEach(tagPair -> registry.add(tagPair.getFirst()));
}
}
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 025dcffc4..7c7399df0 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
@@ -26,7 +26,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.*;
-import com.mojang.math.Matrix4f;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer;
import me.shedaniel.math.Point;
@@ -51,6 +50,7 @@ import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.util.FormattedCharSequence;
+import org.joml.Matrix4f;
import java.util.Collections;
import java.util.List;
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java
index 911293985..f14b1d833 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java
@@ -25,7 +25,6 @@ package me.shedaniel.rei.plugin.client.categories.tag;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
-import com.mojang.math.Matrix4f;
import me.shedaniel.clothconfig2.api.animator.ValueAnimator;
import me.shedaniel.math.FloatingRectangle;
import me.shedaniel.math.Point;
@@ -51,6 +50,7 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import org.jetbrains.annotations.Nullable;
+import org.joml.Matrix4f;
import java.util.ArrayList;
import java.util.List;
@@ -191,9 +191,9 @@ public class DefaultTagCategory implements DisplayCategory<DefaultTagDisplay<?,
}
}, 0, 0, 10));
- Matrix4f translateMatrix = Matrix4f.createTranslateMatrix(0, 0, 200);
+ Matrix4f translateMatrix = new Matrix4f().translate(0, 0, 200);
Matrix4f identity = new Matrix4f();
- identity.setIdentity();
+ identity.identity();
return CollectionUtils.map(widgets, widget -> Widgets.withTranslate(widget, () ->
expanded[0] || !boundsAnimator.value().equals(boundsAnimator.target()) ? translateMatrix : identity));
}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java
index f2daae995..3f8ae3b9e 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java
@@ -25,7 +25,6 @@ package me.shedaniel.rei.plugin.client.categories.tag;
import com.google.common.base.Predicates;
import com.mojang.blaze3d.vertex.PoseStack;
-import com.mojang.math.Matrix4f;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.*;
@@ -35,6 +34,7 @@ import me.shedaniel.rei.plugin.common.displays.tag.TagNode;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
+import org.joml.Matrix4f;
import java.util.ArrayList;
import java.util.Collections;
@@ -71,7 +71,7 @@ public class ValueTagNodeWidget<S, T> extends TagNodeWidget<S, T> {
i++;
}
this.widget = Widgets.withTranslate(Widgets.concat(this.widgets),
- $ -> Matrix4f.createTranslateMatrix(getBounds().x, getBounds().y, 0));
+ $ -> new Matrix4f().translate(getBounds().x, getBounds().y, 0));
this.children = Collections.singletonList(this.widget);
}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/CommandSender.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/CommandSender.java
deleted file mode 100644
index 0cf4b2076..000000000
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/CommandSender.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package me.shedaniel.rei.plugin.client.favorites;
-
-import dev.architectury.platform.Platform;
-
-import java.lang.reflect.InvocationTargetException;
-
-class CommandSender {
- static void sendCommand(String command) {
- try {
- Class.forName("me.shedaniel.rei.impl.client.%s.CommandSenderImpl".formatted(Platform.isForge() ? "forge" : "fabric"))
- .getDeclaredMethod("sendCommand", String.class).invoke(null, command);
- } catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-}
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 1975d119b..2a07bbdca 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
@@ -147,7 +147,7 @@ public class GameModeFavoriteEntry extends FavoriteEntry {
if (mode == null) {
mode = GameType.byId(Minecraft.getInstance().gameMode.getPlayerMode().getId() + 1 % 4);
}
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getGamemodeCommand().replaceAll("\\{gamemode}", mode.name().toLowerCase(Locale.ROOT)), "/"));
+ Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getGamemodeCommand().replaceAll("\\{gamemode}", mode.name().toLowerCase(Locale.ROOT)), "/"));
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
return true;
}
@@ -275,7 +275,7 @@ public class GameModeFavoriteEntry extends FavoriteEntry {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
boolean disabled = this.minecraft.gameMode.getPlayerMode() == gameMode;
if (!disabled && rendering && mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 12) {
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getGamemodeCommand().replaceAll("\\{gamemode}", gameMode.name().toLowerCase(Locale.ROOT)), "/"));
+ 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;
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 19051bf04..33d95a52d 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
@@ -181,7 +181,7 @@ public class TimeFavoriteEntry extends FavoriteEntry {
if (time == null) {
time = nextTime();
}
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getTimeCommand().replaceAll("\\{time}", time.getPart().toLowerCase(Locale.ROOT)), "/"));
+ Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getTimeCommand().replaceAll("\\{time}", time.getPart().toLowerCase(Locale.ROOT)), "/"));
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
return true;
}
@@ -303,7 +303,7 @@ 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) {
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getTimeCommand().replaceAll("\\{time}", time.getPart().toLowerCase(Locale.ROOT)), "/"));
+ 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;
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 9adba8377..652a498ca 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
@@ -154,7 +154,7 @@ public class WeatherFavoriteEntry extends FavoriteEntry {
public boolean doAction(int button) {
if (button == 0) {
if (weather != null) {
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)), "/"));
+ Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)), "/"));
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
return true;
@@ -312,7 +312,7 @@ 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) {
- CommandSender.sendCommand(StringUtils.removeStart(ConfigObject.getInstance().getWeatherCommand().replaceAll("\\{weather}", weather.name().toLowerCase(Locale.ROOT)), "/"));
+ 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;
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/tag/TagNodes.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/tag/TagNodes.java
index b68a517ef..f2a0747fd 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/tag/TagNodes.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/tag/TagNodes.java
@@ -38,6 +38,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.Registry;
+import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
@@ -194,7 +195,7 @@ public class TagNodes {
}
public static <T> void create(TagKey<T> tagKey, Consumer<DataResult<TagNode<T>>> callback) {
- Registry<T> registry = ((Registry<Registry<T>>) Registry.REGISTRY).get((ResourceKey<Registry<T>>) tagKey.registry());
+ Registry<T> registry = ((Registry<Registry<T>>) BuiltInRegistries.REGISTRY).get((ResourceKey<Registry<T>>) tagKey.registry());
requestTagData(tagKey.registry(), result -> {
callback.accept(result.flatMap(dataMap -> dataMap != null ? resolveTag(tagKey, registry, dataMap).orElse(DataResult.error("No tag data")) : DataResult.error("No tag data")));
});
@@ -207,7 +208,7 @@ public class TagNodes {
TagNode<T> self = TagNode.ofReference(tagKey);
List<Holder<T>> holders = new ArrayList<>();
for (int element : tagData.otherElements()) {
- Optional<Holder<T>> holder = registry.getHolder(element);
+ Optional<Holder.Reference<T>> holder = registry.getHolder(element);
if (holder.isPresent()) {
holders.add(holder.get());
}