aboutsummaryrefslogtreecommitdiff
path: root/neoforge/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2024-10-26 16:55:52 +0800
committershedaniel <daniel@shedaniel.me>2024-10-26 16:55:57 +0800
commitddb48e2032d1986709cad973067693eec3118504 (patch)
treee7905130008c67767d2ad2a4d72f49ba4df7e6e3 /neoforge/src
parenteaf9236e3da2adafcea204778ecc0072e70d0aa5 (diff)
downloadRoughlyEnoughItems-ddb48e2032d1986709cad973067693eec3118504.tar.gz
RoughlyEnoughItems-ddb48e2032d1986709cad973067693eec3118504.tar.bz2
RoughlyEnoughItems-ddb48e2032d1986709cad973067693eec3118504.zip
Update to 1.21.2 (Please read Primer)
https://hackmd.io/@shedaniel/rei17_primer
Diffstat (limited to 'neoforge/src')
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java65
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java2
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinClientPacketListener.java7
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectsInInventory.java (renamed from neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectRenderingInventoryScreen.java)35
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinRecipeToast.java6
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java20
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagManager.java48
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java35
-rw-r--r--neoforge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java29
-rw-r--r--neoforge/src/main/resources/META-INF/accesstransformer.cfg20
-rw-r--r--neoforge/src/main/resources/rei.mixins.json5
11 files changed, 90 insertions, 182 deletions
diff --git a/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
index ae75e9780..d92e64208 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
@@ -29,8 +29,8 @@ import com.google.common.collect.Iterators;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.plugins.PluginView;
+import me.shedaniel.rei.api.common.plugins.REICommonPlugin;
import me.shedaniel.rei.api.common.plugins.REIPluginProvider;
-import me.shedaniel.rei.api.common.plugins.REIServerPlugin;
import me.shedaniel.rei.impl.init.PluginDetector;
import me.shedaniel.rei.plugin.client.forge.DefaultClientPluginImpl;
import me.shedaniel.rei.plugin.client.runtime.DefaultClientRuntimePlugin;
@@ -97,75 +97,40 @@ public class PluginDetectorImpl implements PluginDetector {
}
@Override
- public void detectServerPlugins() {
- PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPluginImpl()));
- PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimePlugin()));
-
- // Legacy Annotation
- AnnotationUtils.<REIPlugin, REIServerPlugin>scanAnnotation(REIPlugin.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
- });
-
- // Common plugins
- AnnotationUtils.<REIPluginCommon, REIServerPlugin>scanAnnotation(REIPluginCommon.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
- });
-
- // Dist plugins
- if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
- AnnotationUtils.<REIPluginDedicatedServer, REIServerPlugin>scanAnnotation(REIPluginDedicatedServer.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
- });
- } else {
- AnnotationUtils.<REIPluginClient, REIServerPlugin>scanAnnotation(REIPluginClient.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
- });
- }
-
- // Loaders
- for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvided.get()) {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
- }
- for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedCommon.get()) {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
- }
- for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedDist.get()) {
- ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
- }
- }
-
- @Override
public void detectCommonPlugins() {
+ PluginView.getInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPluginImpl()));
+ PluginView.getInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimePlugin()));
+
// Legacy Annotation
- AnnotationUtils.<REIPlugin, me.shedaniel.rei.api.common.plugins.REIPlugin<?>>scanAnnotation(REIPlugin.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ AnnotationUtils.<REIPlugin, REICommonPlugin>scanAnnotation(REIPlugin.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get()));
});
// Common plugins
- AnnotationUtils.<REIPluginCommon, me.shedaniel.rei.api.common.plugins.REIPlugin<?>>scanAnnotation(REIPluginCommon.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ AnnotationUtils.<REIPluginCommon, REICommonPlugin>scanAnnotation(REIPluginCommon.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get()));
});
// Dist plugins
if (FMLEnvironment.dist == Dist.CLIENT) {
- AnnotationUtils.<REIPluginClient, me.shedaniel.rei.api.common.plugins.REIPlugin>scanAnnotation(REIPluginClient.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ AnnotationUtils.<REIPluginClient, REICommonPlugin>scanAnnotation(REIPluginClient.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get()));
});
} else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
- AnnotationUtils.<REIPluginDedicatedServer, me.shedaniel.rei.api.common.plugins.REIPlugin>scanAnnotation(REIPluginDedicatedServer.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ AnnotationUtils.<REIPluginDedicatedServer, REICommonPlugin>scanAnnotation(REIPluginDedicatedServer.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get()));
});
}
// Loaders
for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvided.get()) {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ PluginView.getInstance().registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REICommonPlugin.class)));
}
for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedCommon.get()) {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ PluginView.getInstance().registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REICommonPlugin.class)));
}
for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedDist.get()) {
- ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ PluginView.getInstance().registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REICommonPlugin.class)));
}
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java b/neoforge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java
index 9e29d9501..78751b442 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java
@@ -69,7 +69,7 @@ public class ScreenOverlayImplForge extends ScreenOverlayImpl {
font = ClientHooks.getTooltipFont(itemStack, font);
}
graphics.tooltipStack = itemStack;
- graphics.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ graphics.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, tooltip.getTooltipStyle());
graphics.tooltipStack = ItemStack.EMPTY;
graphics.pose().popPose();
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinClientPacketListener.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinClientPacketListener.java
index 7b059f109..3dfc3fdc5 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinClientPacketListener.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinClientPacketListener.java
@@ -28,8 +28,7 @@ import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.protocol.common.ClientboundUpdateTagsPacket;
import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket;
-import net.minecraft.world.item.crafting.RecipeManager;
-import org.spongepowered.asm.mixin.Final;
+import net.minecraft.world.item.crafting.RecipeAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -38,13 +37,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPacketListener.class)
public abstract class MixinClientPacketListener {
- @Shadow @Final private RecipeManager recipeManager;
+ @Shadow public abstract RecipeAccess recipes();
@Shadow public abstract RegistryAccess.Frozen registryAccess();
@Inject(method = "handleUpdateRecipes", at = @At("HEAD"))
private void handleUpdateRecipes(ClientboundUpdateRecipesPacket clientboundUpdateRecipesPacket, CallbackInfo ci) {
- RoughlyEnoughItemsCoreClient.PRE_UPDATE_RECIPES.invoker().accept(recipeManager, registryAccess());
+ RoughlyEnoughItemsCoreClient.PRE_UPDATE_RECIPES.invoker().accept(recipes(), registryAccess());
}
@Inject(method = "handleUpdateTags", at = @At("HEAD"))
diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectRenderingInventoryScreen.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectsInInventory.java
index db426f893..58518491a 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectRenderingInventoryScreen.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinEffectsInInventory.java
@@ -25,20 +25,19 @@ package me.shedaniel.rei.mixin.forge;
import me.shedaniel.rei.api.client.config.ConfigObject;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
-import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.entity.player.Inventory;
-import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.client.gui.screens.inventory.EffectsInInventory;
+import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
-@Mixin(EffectRenderingInventoryScreen.class)
-public abstract class MixinEffectRenderingInventoryScreen extends AbstractContainerScreen<AbstractContainerMenu> {
- public MixinEffectRenderingInventoryScreen(AbstractContainerMenu menu, Inventory inventory, Component component) {
- super(menu, inventory, component);
- }
+@Mixin(EffectsInInventory.class)
+public abstract class MixinEffectsInInventory {
+ @Shadow
+ @Final
+ private AbstractContainerScreen<?> screen;
@Unique
private boolean leftSideEffects() {
@@ -46,21 +45,21 @@ public abstract class MixinEffectRenderingInventoryScreen extends AbstractContai
}
@ModifyVariable(method = "renderEffects",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getActiveEffects()Ljava/util/Collection;", ordinal = 0),
- ordinal = 2) // 3rd int
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getActiveEffects()Ljava/util/Collection;", ordinal = 0),
+ ordinal = 2) // 3rd int
public int modifyK(int k) {
if (!leftSideEffects()) return k;
- boolean bl = this.leftPos >= 120;
- return bl ? this.leftPos - 120 - 4 : this.leftPos - 32 - 4;
+ boolean bl = this.screen.leftPos >= 120;
+ return bl ? this.screen.leftPos - 120 - 4 : this.screen.leftPos - 32 - 4;
}
@ModifyVariable(method = "renderEffects",
- at = @At(value = "INVOKE",
- target = "Lnet/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen;renderBackgrounds(Lnet/minecraft/client/gui/GuiGraphics;IILjava/lang/Iterable;Z)V",
- ordinal = 0),
- ordinal = 0) // 1st bool
+ at = @At(value = "INVOKE",
+ target = "Lnet/minecraft/client/gui/screens/inventory/EffectsInInventory;renderBackgrounds(Lnet/minecraft/client/gui/GuiGraphics;IILjava/lang/Iterable;Z)V",
+ ordinal = 0),
+ ordinal = 0) // 1st bool
public boolean modifyBl(boolean bl) {
if (!leftSideEffects()) return bl;
- return this.leftPos >= 120;
+ return this.screen.leftPos >= 120;
}
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinRecipeToast.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinRecipeToast.java
index dc12ed85d..fca6eb3c8 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinRecipeToast.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinRecipeToast.java
@@ -25,8 +25,8 @@ package me.shedaniel.rei.mixin.forge;
import me.shedaniel.rei.api.client.config.ConfigObject;
import net.minecraft.client.gui.components.toasts.RecipeToast;
-import net.minecraft.client.gui.components.toasts.ToastComponent;
-import net.minecraft.world.item.crafting.RecipeHolder;
+import net.minecraft.client.gui.components.toasts.ToastManager;
+import net.minecraft.world.item.crafting.display.RecipeDisplay;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -36,7 +36,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(RecipeToast.class)
public class MixinRecipeToast {
@Inject(method = "addOrUpdate", at = @At("HEAD"), cancellable = true)
- private static void addOrUpdate(ToastComponent toastGui, RecipeHolder<?> recipe, CallbackInfo info) {
+ private static void addOrUpdate(ToastManager arg, RecipeDisplay arg2, CallbackInfo info) {
if (disableRecipeBook()) info.cancel();
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java
index 43a5b95c2..d13bad1ae 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java
@@ -33,8 +33,10 @@ import me.shedaniel.rei.impl.common.InternalLogger;
import me.shedaniel.rei.plugin.common.displays.tag.TagNodes;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.tags.TagEntry;
import net.minecraft.tags.TagLoader;
import org.spongepowered.asm.mixin.Final;
@@ -48,7 +50,15 @@ import java.util.*;
@Mixin(TagLoader.class)
public class MixinTagLoader<T> {
- @Shadow @Final private String directory;
+ @Shadow
+ @Final
+ private String directory;
+
+ @Inject(method = "loadPendingTags", at = @At("HEAD"))
+ private static <T> void loadPendingTags(ResourceManager resourceManager, Registry<T> registry, CallbackInfoReturnable<Optional<Registry.PendingTags<T>>> cir) {
+ ResourceKey<? extends Registry<T>> resourceKey = registry.key();
+ TagNodes.TAG_DIR_MAP.put(Registries.tagsDirPath(resourceKey), resourceKey);
+ }
@Inject(method = "build(Ljava/util/Map;)Ljava/util/Map;", at = @At("HEAD"))
private void load(Map<ResourceLocation, TagLoader.EntryWithSource> map, CallbackInfoReturnable<Map<ResourceLocation, Collection<T>>> cir) {
@@ -67,7 +77,7 @@ public class MixinTagLoader<T> {
TagNodes.TAG_DATA_MAP.put(resourceKey, new HashMap<>());
Map<ResourceLocation, TagNodes.TagData> tagDataMap = TagNodes.TAG_DATA_MAP.get(resourceKey);
if (tagDataMap == null) return;
- Registry<T> registry = ((Registry<Registry<T>>) BuiltInRegistries.REGISTRY).get((ResourceKey<Registry<T>>) resourceKey);
+ Registry<T> registry = ((Registry<Registry<T>>) BuiltInRegistries.REGISTRY).getValue((ResourceKey<Registry<T>>) resourceKey);
Stopwatch stopwatch = Stopwatch.createStarted();
Iterator<Map.Entry<TagNodes.CollectionWrapper<?>, TagNodes.RawTagData>> entryIterator = TagNodes.RAW_TAG_DATA_MAP.getOrDefault(directory, Reference2ObjectMaps.emptyMap())
@@ -87,7 +97,7 @@ public class MixinTagLoader<T> {
TagNodes.RawTagData rawTagData = entry.getValue();
IntList elements = new IntArrayList();
for (ResourceLocation element : rawTagData.otherElements()) {
- T t = registry.get(element);
+ T t = registry.getValue(element);
if (t != null) {
elements.add(registry.getId(t));
}
@@ -100,7 +110,7 @@ public class MixinTagLoader<T> {
InternalLogger.getInstance().debug("Processed %d tags in %s for %s", tagDataMap.size(), stopwatch.stop(), resourceKey.location());
}
- @Inject(method = "build(Lnet/minecraft/tags/TagEntry$Lookup;Ljava/util/List;)Lcom/mojang/datafixers/util/Either;", at = @At("RETURN"))
+ @Inject(method = "tryBuildTag", at = @At("RETURN"))
private void load(TagEntry.Lookup<T> lookup, List<TagLoader.EntryWithSource> entries, CallbackInfoReturnable<Either<Collection<TagLoader.EntryWithSource>, Collection<T>>> cir) {
Collection<T> tag = cir.getReturnValue().right().orElse(null);
if (tag != null) {
@@ -121,7 +131,7 @@ public class MixinTagLoader<T> {
otherTags.add(entry.getId());
}
} else {
- T apply = lookup.element(entry.getId());
+ T apply = lookup.element(entry.getId(), entry.isRequired());
if (apply != null) {
otherElements.add(entry.getId());
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagManager.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagManager.java
deleted file mode 100644
index 0dc32c207..000000000
--- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagManager.java
+++ /dev/null
@@ -1,48 +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.mixin.forge;
-
-import me.shedaniel.rei.plugin.common.displays.tag.TagNodes;
-import net.minecraft.core.Registry;
-import net.minecraft.core.RegistryAccess;
-import net.minecraft.core.registries.Registries;
-import net.minecraft.resources.ResourceKey;
-import net.minecraft.server.packs.resources.ResourceManager;
-import net.minecraft.tags.TagManager;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-
-@Mixin(TagManager.class)
-public abstract class MixinTagManager<T> {
- @Inject(method = "createLoader", at = @At("HEAD"))
- private void load(ResourceManager resourceManager, Executor executor, RegistryAccess.RegistryEntry<T> registryEntry, CallbackInfoReturnable<CompletableFuture<TagManager.LoadResult<T>>> cir) {
- ResourceKey<? extends Registry<T>> resourceKey = registryEntry.key();
- TagNodes.TAG_DIR_MAP.put(Registries.tagsDirPath(resourceKey), resourceKey);
- }
-}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java b/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java
index 3131c2658..929d5f6bb 100644
--- a/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java
+++ b/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java
@@ -25,6 +25,9 @@ package me.shedaniel.rei.plugin.client.forge;
import com.google.gson.internal.LinkedTreeMap;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
+import me.shedaniel.rei.api.common.entry.EntryIngredient;
+import me.shedaniel.rei.api.common.entry.EntryStack;
+import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.plugin.client.BuiltinClientPlugin;
import me.shedaniel.rei.plugin.client.DefaultClientPlugin;
import net.minecraft.client.Minecraft;
@@ -39,7 +42,6 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.neoforged.neoforge.common.brewing.BrewingRecipe;
import net.neoforged.neoforge.common.brewing.IBrewingRecipe;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Set;
@@ -52,7 +54,9 @@ public class DefaultClientPluginImpl extends DefaultClientPlugin {
for (IBrewingRecipe recipe : brewing.getRecipes()) {
if (recipe instanceof BrewingRecipe) {
BrewingRecipe brewingRecipe = (BrewingRecipe) recipe;
- clientPlugin.registerBrewingRecipe(brewingRecipe.getInput(), brewingRecipe.getIngredient(), brewingRecipe.getOutput().copy());
+ clientPlugin.registerBrewingRecipe(EntryIngredients.ofIngredient(brewingRecipe.getInput()),
+ EntryIngredients.ofIngredient(brewingRecipe.getIngredient()),
+ EntryIngredients.of(brewingRecipe.getOutput().copy()));
}
}
}
@@ -62,16 +66,21 @@ public class DefaultClientPluginImpl extends DefaultClientPlugin {
for (Ingredient container : brewing.containers) {
for (PotionBrewing.Mix<Potion> mix : brewing.potionMixes) {
Holder<Potion> from = mix.from();
- Ingredient ingredient = mix.ingredient;
+ Ingredient ingredient = mix.ingredient();
Holder<Potion> to = mix.to();
- Ingredient base = Ingredient.of(Arrays.stream(container.getItems())
- .map(ItemStack::copy)
- .peek(stack -> stack.set(DataComponents.POTION_CONTENTS, new PotionContents(from))));
- ItemStack output = Arrays.stream(container.getItems())
- .map(ItemStack::copy)
- .peek(stack -> stack.set(DataComponents.POTION_CONTENTS, new PotionContents(to)))
- .findFirst().orElse(ItemStack.EMPTY);
- clientPlugin.registerBrewingRecipe(base, ingredient, output);
+ EntryIngredient base = EntryIngredients.ofIngredient(container)
+ .map(stack -> {
+ EntryStack<?> copied = stack.copy();
+ copied.<ItemStack>castValue().set(DataComponents.POTION_CONTENTS, new PotionContents(from));
+ return copied;
+ });
+ EntryIngredient output = EntryIngredients.ofIngredient(container)
+ .map(stack -> {
+ EntryStack<?> copied = stack.copy();
+ copied.<ItemStack>castValue().set(DataComponents.POTION_CONTENTS, new PotionContents(to));
+ return copied;
+ });
+ clientPlugin.registerBrewingRecipe(base, EntryIngredients.ofIngredient(ingredient), output);
potions.add(from);
potions.add(to);
}
@@ -83,10 +92,10 @@ public class DefaultClientPluginImpl extends DefaultClientPlugin {
Holder<Item> to = mix.to();
ItemStack baseStack = new ItemStack(from);
baseStack.set(DataComponents.POTION_CONTENTS, new PotionContents(potion));
- Ingredient base = Ingredient.of(baseStack);
+ EntryIngredient base = EntryIngredients.of(baseStack);
ItemStack output = new ItemStack(to);
output.set(DataComponents.POTION_CONTENTS, new PotionContents(potion));
- clientPlugin.registerBrewingRecipe(base, ingredient, output);
+ clientPlugin.registerBrewingRecipe(base, EntryIngredients.ofIngredient(ingredient), EntryIngredients.of(output));
}
}
}
diff --git a/neoforge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java b/neoforge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java
deleted file mode 100644
index 0ad27549a..000000000
--- a/neoforge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java
+++ /dev/null
@@ -1,29 +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.common.displays.crafting.forge;
-
-public class DefaultCraftingDisplayImpl {
- public static void registerPlatformSizeProvider() {
- }
-}
diff --git a/neoforge/src/main/resources/META-INF/accesstransformer.cfg b/neoforge/src/main/resources/META-INF/accesstransformer.cfg
index 17e4ec408..a641f1d56 100644
--- a/neoforge/src/main/resources/META-INF/accesstransformer.cfg
+++ b/neoforge/src/main/resources/META-INF/accesstransformer.cfg
@@ -8,7 +8,7 @@ public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen isQuic
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen leftPos
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen topPos
public net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen f_98699_
-public net.minecraft.client.gui.screens.recipebook.RecipeBookComponent ghostRecipe
+public net.minecraft.client.gui.screens.recipebook.RecipeBookComponent ghostSlots
public net.minecraft.client.gui.screens.recipebook.RecipeBookComponent searchBox
public net.minecraft.client.gui.screens.recipebook.RecipeBookComponent tabButtons
public net.minecraft.client.StringSplitter widthProvider
@@ -29,20 +29,16 @@ public-f net.minecraft.client.gui.screens.inventory.AbstractContainerScreen drag
protected net.minecraft.client.gui.screens.Screen init(Lnet/minecraft/client/Minecraft;II)V
public net.minecraft.client.gui.screens.Screen addRenderableWidget(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
public net.minecraft.client.gui.screens.Screen addRenderableOnly(Lnet/minecraft/client/gui/components/Renderable;)Lnet/minecraft/client/gui/components/Renderable;
-public net.minecraft.client.gui.GuiGraphics renderTooltipInternal(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;)V # renderTooltipInternal
+public net.minecraft.client.gui.GuiGraphics renderTooltipInternal(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;Lnet/minecraft/resources/ResourceLocation;)V # renderTooltipInternal
public net.minecraft.client.gui.GuiGraphics tooltipStack
public net.minecraft.client.gui.GuiGraphics innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFF)V # innerBlit
public net.minecraft.client.renderer.RenderType create(Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;ILnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType;
public net.minecraft.client.renderer.RenderType$OutlineProperty
public net.minecraft.client.renderer.RenderType$CompositeState
public net.minecraft.tags.TagEntry tag # tag
+public net.minecraft.tags.TagEntry required # required
public net.minecraft.tags.TagEntry id # id
-public net.minecraft.world.item.crafting.SmithingTransformRecipe template # template
-public net.minecraft.world.item.crafting.SmithingTransformRecipe base # base
-public net.minecraft.world.item.crafting.SmithingTransformRecipe addition # addition
-public net.minecraft.world.item.crafting.SmithingTrimRecipe template # template
-public net.minecraft.world.item.crafting.SmithingTrimRecipe base # base
-public net.minecraft.world.item.crafting.SmithingTrimRecipe addition # addition
+public net.minecraft.world.item.crafting.SmithingTransformRecipe result # result
public-f net.minecraft.client.gui.font.CodepointMap empty # empty
public-f net.minecraft.client.gui.font.CodepointMap blockMap # blockMap
public-f net.minecraft.client.gui.font.CodepointMap blockConstructor # blockConstructor
@@ -50,3 +46,11 @@ public net.minecraft.world.item.CreativeModeTab displayItemsGenerator # displayI
public net.minecraft.world.item.CreativeModeTab$ItemDisplayBuilder
public net.minecraft.client.multiplayer.ClientLevel connection # connection
public net.minecraft.client.multiplayer.MultiPlayerGameMode connection # connection
+public net.minecraft.world.item.crafting.Ingredient values # values
+public net.minecraft.world.item.crafting.SingleItemRecipe result()Lnet/minecraft/world/item/ItemStack;
+public net.minecraft.world.item.crafting.ShapedRecipe result
+public net.minecraft.world.item.crafting.ShapelessRecipe result
+public net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen recipeBookComponent
+public net.minecraft.client.gui.GuiGraphics innerBlit(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIFFFFI)V
+
+
diff --git a/neoforge/src/main/resources/rei.mixins.json b/neoforge/src/main/resources/rei.mixins.json
index e95039402..65be5712a 100644
--- a/neoforge/src/main/resources/rei.mixins.json
+++ b/neoforge/src/main/resources/rei.mixins.json
@@ -4,7 +4,7 @@
"compatibilityLevel": "JAVA_8",
"client": [
"MixinClientPacketListener",
- "MixinEffectRenderingInventoryScreen",
+ "MixinEffectsInInventory",
"MixinFontSet",
"MixinInputConstants",
"MixinInputConstantsKey",
@@ -12,8 +12,7 @@
],
"mixins": [
"MixinPacketEncoder",
- "MixinTagLoader",
- "MixinTagManager"
+ "MixinTagLoader"
],
"injectors": {
"maxShiftBy": 5,