如何在开发环境中使用 OptiFine ?


版本信息
你使用的IDE:IntelliJ IDEA
你使用的IDE版本: 2019.3.3
Forge版本: 14.23.5.2847
Minecraft版本: 1.12.2
Mapping 文件版本: stable_39

错误情况简述
我尝试把 Extract 之后的 OptiFine 1.12.2 F6 pre1 反混淆后放入 ./run/mods 内,然后配合自己的 Tweaker 和 ClassTransformer 启动游戏,游戏内 OptiFine 是被正常加载的,但是会出现了下面的景象:

报错日志

[12:19:16] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:red_stained_glass_pane#east=true,north=true,south=false,west=true for blockstate "minecraft:stained_glass_pane[color=red,east=true,north=true,south=false,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:red_stained_glass_pane#east=true,north=true,south=false,west=true with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerMultipartVariant(ModelLoader.java:251) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:152) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:132) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:block/red_stained_glass_pane_post with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
Caused by: java.io.FileNotFoundException: minecraft:models/models/block/red_stained_glass_pane_post.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:73) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:365) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
[12:19:16] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:glass_pane#east=true,north=false,south=true,west=false for blockstate "minecraft:glass_pane[east=true,north=false,south=true,west=false]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:glass_pane#east=true,north=false,south=true,west=false with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerMultipartVariant(ModelLoader.java:251) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:152) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:132) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:block/glass_pane_post with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
Caused by: java.io.FileNotFoundException: minecraft:models/models/block/glass_pane_post.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:73) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:365) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
[12:19:16] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:glass_pane#east=false,north=false,south=true,west=true for blockstate "minecraft:glass_pane[east=false,north=false,south=true,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:glass_pane#east=false,north=false,south=true,west=true with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerMultipartVariant(ModelLoader.java:251) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:152) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:132) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:block/glass_pane_post with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
Caused by: java.io.FileNotFoundException: minecraft:models/models/block/glass_pane_post.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:73) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:365) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
[12:19:16] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:redstone_wire#east=up,north=none,south=side,west=up for blockstates ["minecraft:redstone_wire[east=up,north=none,power=2,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=3,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=0,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=1,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=6,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=7,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=4,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=5,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=10,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=11,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=8,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=9,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=14,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=15,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=12,south=side,west=up]", "minecraft:redstone_wire[east=up,north=none,power=13,south=side,west=up]"]
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:redstone_wire#east=up,north=none,south=side,west=up with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.registerMultipartVariant(ModelLoader.java:251) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:152) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:132) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:block/redstone_dot with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
Caused by: java.io.FileNotFoundException: minecraft:models/models/block/redstone_dot.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:73) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:365) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:658) ~[ModelLoader$WeightedRandomModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$MultipartModel.<init>(ModelLoader.java:1214) ~[ModelLoader$MultipartModel.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 22 more
[12:19:16] [Client thread/FATAL] [FML]: Suppressed additional 644 model loading errors for domain minecraft

相关代码
OptiFineDevTweaker.java

package io.github.zekerzhayard.optifinedevloader;

import java.io.File;
import java.util.List;

import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader;

public class OptiFineDevTweaker implements ITweaker {
    @Override
    public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {

    }

    @Override
    public void injectIntoClassLoader(LaunchClassLoader classLoader) {
        classLoader.registerTransformer("io.github.zekerzhayard.optifinedevloader.OptiFineDevClassTransformer");
    }

    @Override
    public String getLaunchTarget() {
        return "net.minecraft.client.main.Main";
    }

    @Override
    public String[] getLaunchArguments() {
        return new String[0];
    }
}

OptiFineDevTransformer.java

package io.github.zekerzhayard.optifinedevloader;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

public class OptiFineDevClassTransformer implements IClassTransformer {
    private IClassTransformer optifineClassTransformer;
    private Method fixMemberAccess;

    public OptiFineDevClassTransformer() {
        try {
            this.optifineClassTransformer = (IClassTransformer) Class.forName("optifine.OptiFineClassTransformer").newInstance();
            this.fixMemberAccess = Class.forName("optifine.AccessFixer").getMethod("fixMemberAccess", ClassNode.class, ClassNode.class);
        } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    @Override
    public byte[] transform(String name, String transformedName, byte[] basicClass) {
        if (this.optifineClassTransformer != null && this.fixMemberAccess != null && name.startsWith("net.minecraft.")) {
            ClassNode oldClassNode = new ClassNode(), newClassNode = new ClassNode();
            new ClassReader(basicClass).accept(oldClassNode, ClassReader.EXPAND_FRAMES);
            new ClassReader(this.optifineClassTransformer.transform(name.replace(".", "/"), transformedName, basicClass)).accept(newClassNode, ClassReader.EXPAND_FRAMES);
            try {
                this.fixMemberAccess.invoke(null, oldClassNode, newClassNode);
            } catch (IllegalAccessException | InvocationTargetException e) {
                throw new RuntimeException(e);
            }
            ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
            newClassNode.accept(classWriter);
            basicClass = classWriter.toByteArray();
        }
        return basicClass;
    }
}

查到的资料
我本以为这是个「月经问题」,结果我基本没查到相关解决方案,只查到这一个项目:


但是,会报下面的错,OptiFine 没有被加载:

[13:23:31] [main/INFO] [LaunchWrapper]: Calling tweak class ofdev.launchwrapper.OptifineDevTweakerWrapper
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: OptiFine ClassTransformer
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: java.lang.IllegalArgumentException: URI is not hierarchical
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.io.File.<init>(File.java:418)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at optifine.OptiFineClassTransformer.<init>(OptiFineClassTransformer.java:43)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.Class.newInstance(Class.java:442)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at ofdev.launchwrapper.OptifineDevTransformerWrapper.<init>(OptifineDevTransformerWrapper.java:74)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.Class.newInstance(Class.java:442)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.LaunchClassLoader.registerTransformer(LaunchClassLoader.java:88)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at ofdev.launchwrapper.OptifineDevTweakerWrapper.injectIntoClassLoader(OptifineDevTweakerWrapper.java:39)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:115)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.reflect.Method.invoke(Method.java:498)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at GradleStart.main(GradleStart.java:25)
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: *** Can not find the OptiFine JAR in the classpath ***
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: *** OptiFine will not be loaded! ***
[13:23:39] [main/INFO] [STDOUT]: [ofdev.launchwrapper.OptifineDevTransformerWrapper:<init>:88]: Ignore the above, OptiFine should run anyway
[13:23:39] [main/INFO] [LaunchWrapper]: Calling tweak class optifine.OptiFineForgeTweaker
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineForgeTweaker:dbg:56]: OptiFineForgeTweaker: acceptOptions
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineForgeTweaker:dbg:56]: OptiFineForgeTweaker: injectIntoClassLoader
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: OptiFine ClassTransformer
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: java.lang.IllegalArgumentException: URI is not hierarchical
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.io.File.<init>(File.java:418)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at optifine.OptiFineClassTransformer.<init>(OptiFineClassTransformer.java:43)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.Class.newInstance(Class.java:442)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.LaunchClassLoader.registerTransformer(LaunchClassLoader.java:88)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at optifine.OptiFineForgeTweaker.injectIntoClassLoader(OptiFineForgeTweaker.java:38)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:115)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at java.lang.reflect.Method.invoke(Method.java:498)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[13:23:39] [main/INFO] [STDERR]: [optifine.OptiFineClassTransformer:<init>:55]: 	at GradleStart.main(GradleStart.java:25)
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: *** Can not find the OptiFine JAR in the classpath ***
[13:23:39] [main/INFO] [STDOUT]: [optifine.OptiFineClassTransformer:dbg:242]: *** OptiFine will not be loaded! ***

在 OptiFine 的 Discord 频道里面只看到 Barteks2x 在推广自己的这个项目,但是似乎大家都没遇到过我这个问题


FledgeXu


建议不要在开发环境中使用 OptiFine 会有很多兼容性的问题。



。。。
因为我主要是想解决这个项目与 OptiFine 的兼容性:

但是以往都是写完、编译、往生产环境里跑。跑起来之后两眼一抹黑,根本不知道发生了啥,所以才来问问有没有什么解决方案。
因为我担心这个论坛不解决 Forge 1.8.9 的问题,所以我用 1.12.2 ,但是这两个版本装 OptiFine 都会有相同的问题


FledgeXu


optifine.OptiFineClassTransformer.<init>(OptiFineClassTransformer.java:43)这行的代码是什么?



82~UA__A~2__YGRTZPQ_7_E.jpg


FledgeXu


恭喜Merge​:tada:


system


该主题在最后一个回复创建后7天后自动关闭。不再允许新的回复。