From bcef0b6c1e151fc46ba3641cb29060c0a4c6ecb7 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 25 Nov 2025 15:51:07 +0800 Subject: Update to 1.21.9 --- .../me/shedaniel/rei/forge/AnnotationUtils.java | 6 +-- .../me/shedaniel/rei/forge/PluginDetectorImpl.java | 10 ++-- .../rei/forge/PrimitivePlatformAdapterImpl.java | 5 +- .../rei/forge/RoughlyEnoughItemsForge.java | 2 +- .../me/shedaniel/rei/mixin/forge/MixinFontSet.java | 62 ---------------------- .../rei/mixin/forge/MixinInputConstants.java | 3 +- 6 files changed, 13 insertions(+), 75 deletions(-) delete mode 100644 neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java (limited to 'neoforge/src/main/java') diff --git a/neoforge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java b/neoforge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java index 6486f0aba..3cd9d22f8 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java +++ b/neoforge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java @@ -66,15 +66,15 @@ public class AnnotationUtils { boolean enabled; if (value instanceof Dist[]) { - enabled = Arrays.asList((Dist[]) value).contains(FMLEnvironment.dist); + enabled = Arrays.asList((Dist[]) value).contains(FMLEnvironment.getDist()); } else if (value instanceof ModAnnotation.EnumHolder) { - enabled = Objects.equals(((ModAnnotation.EnumHolder) value).value(), FMLEnvironment.dist.name()); + enabled = Objects.equals(((ModAnnotation.EnumHolder) value).value(), FMLEnvironment.getDist().name()); } else if (value instanceof List) { List holders = ((List) value).stream().filter(o -> o instanceof ModAnnotation.EnumHolder) .map(o -> (ModAnnotation.EnumHolder) o).toList(); if (!holders.isEmpty()) { enabled = holders.stream() - .anyMatch(o -> Objects.equals(o.value(), FMLEnvironment.dist.name())); + .anyMatch(o -> Objects.equals(o.value(), FMLEnvironment.getDist().name())); } else { enabled = true; } 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 d92e64208..cfd507ca4 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java +++ b/neoforge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java @@ -75,11 +75,11 @@ public class PluginDetectorImpl implements PluginDetector { static { Supplier>, List>>> dist; - if (FMLEnvironment.dist == Dist.CLIENT) { + if (FMLEnvironment.getDist() == Dist.CLIENT) { dist = Suppliers.memoize(() -> getPluginsLoader(REIPluginLoaderClient.class)); - } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) { + } else if (FMLEnvironment.getDist() == Dist.DEDICATED_SERVER) { dist = Suppliers.memoize(() -> getPluginsLoader(REIPluginLoaderDedicatedServer.class)); - } else throw new IllegalStateException("Unknown environment: " + FMLEnvironment.dist); + } else throw new IllegalStateException("Unknown environment: " + FMLEnvironment.getDist()); loaderProvidedDist = dist; } @@ -112,11 +112,11 @@ public class PluginDetectorImpl implements PluginDetector { }); // Dist plugins - if (FMLEnvironment.dist == Dist.CLIENT) { + if (FMLEnvironment.getDist() == Dist.CLIENT) { AnnotationUtils.scanAnnotation(REIPluginClient.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get())); }); - } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) { + } else if (FMLEnvironment.getDist() == Dist.DEDICATED_SERVER) { AnnotationUtils.scanAnnotation(REIPluginDedicatedServer.class, REICommonPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { PluginView.getInstance().registerPlugin(wrapPlugin(modId, plugin.get())); }); diff --git a/neoforge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java b/neoforge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java index 6174b100c..c3cabbf02 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java +++ b/neoforge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java @@ -27,13 +27,12 @@ import me.shedaniel.rei.impl.init.PrimitivePlatformAdapter; import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.ModList; import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.fml.loading.FMLLoader; import org.apache.maven.artifact.versioning.ComparableVersion; public class PrimitivePlatformAdapterImpl implements PrimitivePlatformAdapter { @Override public boolean isClient() { - return FMLEnvironment.dist == Dist.CLIENT; + return FMLEnvironment.getDist() == Dist.CLIENT; } @Override @@ -42,7 +41,7 @@ public class PrimitivePlatformAdapterImpl implements PrimitivePlatformAdapter { @Override public boolean isDev() { - return !FMLLoader.isProduction(); + return !FMLEnvironment.isProduction(); } @Override diff --git a/neoforge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java b/neoforge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java index e61f92b2b..b95638f63 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java +++ b/neoforge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java @@ -39,7 +39,7 @@ public class RoughlyEnoughItemsForge { if (!DatagenModLoader.isRunningDataGen()) { RoughlyEnoughItemsInitializer.onInitialize(); - if (FMLEnvironment.dist == Dist.CLIENT) { + if (FMLEnvironment.getDist() == Dist.CLIENT) { run(() -> RoughlyEnoughItemsInitializer::onInitializeClient); } } diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java deleted file mode 100644 index 4d0adc4fd..000000000 --- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java +++ /dev/null @@ -1,62 +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 com.mojang.blaze3d.font.GlyphInfo; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import it.unimi.dsi.fastutil.ints.IntList; -import me.shedaniel.rei.impl.client.CodepointMapWrapper; -import net.minecraft.client.gui.font.CodepointMap; -import net.minecraft.client.gui.font.FontSet; -import net.minecraft.client.gui.font.FontTexture; -import net.minecraft.client.gui.font.glyphs.BakedGlyph; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.resources.ResourceLocation; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.Collections; -import java.util.List; - -@Mixin(FontSet.class) -public class MixinFontSet { - @Shadow @Mutable @Final private CodepointMap glyphs; - @Shadow @Mutable @Final private CodepointMap glyphInfos; - @Shadow @Mutable @Final private Int2ObjectMap glyphsByWidth; - @Shadow @Mutable @Final private List textures; - - @Inject(method = "", at = @At("RETURN")) - private void init(TextureManager textureManager, ResourceLocation id, CallbackInfo ci) { - this.glyphs = new CodepointMapWrapper<>(this.glyphs); - this.glyphInfos = new CodepointMapWrapper<>(this.glyphInfos); - this.glyphsByWidth = Int2ObjectMaps.synchronize(this.glyphsByWidth); - this.textures = Collections.synchronizedList(this.textures); - } -} diff --git a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java index 24069895f..1e6324711 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java +++ b/neoforge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java @@ -24,6 +24,7 @@ package me.shedaniel.rei.mixin.forge; import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.rei.api.client.config.ConfigObject; import org.spongepowered.asm.mixin.Mixin; @@ -35,7 +36,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(InputConstants.class) public class MixinInputConstants { @Inject(method = "isKeyDown", at = @At("HEAD"), cancellable = true) - private static void isKeyDown(long windowId, int key, CallbackInfoReturnable cir) { + private static void isKeyDown(Window window, int key, CallbackInfoReturnable cir) { if (isPatchingAsyncThreadCrash() && !RenderSystem.isOnRenderThread()) { cir.setReturnValue(false); } -- cgit