diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-11-09 22:22:39 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-11-09 22:23:11 +0800 |
| commit | a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c (patch) | |
| tree | daec80c222da6969bef0c42f0b1636a21381438b /forge | |
| parent | 66bd26b6ab2172a834d06e9f70d09a659faa8ebd (diff) | |
| parent | c6f180f73bcbf5aa23b8b741e6a4f617439214e5 (diff) | |
| download | RoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.tar.gz RoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.tar.bz2 RoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.zip | |
Merge remote-tracking branch 'origin/9.x-1.19' into feature/1.19.3
Diffstat (limited to 'forge')
| -rw-r--r-- | forge/build.gradle | 7 | ||||
| -rw-r--r-- | forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java | 60 | ||||
| -rw-r--r-- | forge/src/main/resources/rei.mixins.json | 1 |
3 files changed, 62 insertions, 6 deletions
diff --git a/forge/build.gradle b/forge/build.gradle index b827d9b18..2aa93e09e 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -49,12 +49,6 @@ processServerComponentResources { } loom { - launches { - all { - arg "--mixin", "rei-jei-internals-workaround.mixins.json" - } - } - forge { mixinConfig "rei.mixins.json" } @@ -72,6 +66,7 @@ dependencies { shadowCommon(project(path: it, configuration: "transformProductionForge")) { transitive false } } + modRuntime("curse.maven:lazy-dfu-forge-460819:3544496") // modRuntime("curse.maven:chiselsbits-231095:3492889") // modRuntime("curse.maven:jumbofurnace-390880:3120970") // modRuntime("curse.maven:cyclic-239286:3221427") diff --git a/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java new file mode 100644 index 000000000..0cba3c2ad --- /dev/null +++ b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java @@ -0,0 +1,60 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021, 2022 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 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 Int2ObjectMap<BakedGlyph> glyphs; + @Shadow @Mutable @Final private Int2ObjectMap<GlyphInfo> glyphInfos; + @Shadow @Mutable @Final private Int2ObjectMap<IntList> glyphsByWidth; + @Shadow @Mutable @Final private List<FontTexture> textures; + + @Inject(method = "<init>", at = @At("RETURN")) + private void init(TextureManager textureManager, ResourceLocation id, CallbackInfo ci) { + this.glyphs = Int2ObjectMaps.synchronize(this.glyphs); + this.glyphInfos = Int2ObjectMaps.synchronize(this.glyphInfos); + this.glyphsByWidth = Int2ObjectMaps.synchronize(this.glyphsByWidth); + this.textures = Collections.synchronizedList(this.textures); + } +} diff --git a/forge/src/main/resources/rei.mixins.json b/forge/src/main/resources/rei.mixins.json index d729d79f9..838df45f2 100644 --- a/forge/src/main/resources/rei.mixins.json +++ b/forge/src/main/resources/rei.mixins.json @@ -5,6 +5,7 @@ "client": [ "MixinClientPacketListener", "MixinEffectRenderingInventoryScreen", + "MixinFontSet", "MixinInputConstants", "MixinRecipeToast" ], |
