- 172
- 5
- 14
Решил я поизучать миксины, делал все по гайду: Ресурс 'Миксины для Чайников! Практика.' все скопировал из репозитория в гайде
вот я создаю миксин "в пример возьмём мод Scape and Run: Parasites"
запускаю в dev среде все работает отлично
компилирую мод и запускаю в стороннем лаунчере NoClassDefFoundError "подробнее в краш логе"
моды импортирую вот так:
в build gradle поменял только название json миксина и маппинги
"так как dev моды которые я использую деобфусцированы на других маппингах и да я знаю что их можно перекомпилировать, но мне лень"
и по идее это не на что не влияет
скорее всего если я пару дней почитаю вики миксинов то все пойму но:я ленивая жирная жо... я в ближайшем будущем не собираюсь использовать их в своём проекте
надеюсь хоть в этот раз нормально все расписал
вот я создаю миксин "в пример возьмём мод Scape and Run: Parasites"
MixinEntityParasiteBase:
package com.artur114.srp_nia.mixin;
import com.dhanantry.scapeandrunparasites.entity.ai.misc.EntityParasiteBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.world.World;
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;
@Mixin({EntityParasiteBase.class})
public abstract class MixinEntityParasiteBase extends EntityMob {
public MixinEntityParasiteBase(World worldIn) {
super(worldIn);
}
@Inject(method = "attackEntityAsMobMinimum", at = @At("HEAD"), cancellable = true, remap = false, require = 1)
public void attackEntityAsMobMinimum(EntityLivingBase target, CallbackInfoReturnable<Boolean> cir) {
System.out.println("NO");
cir.setReturnValue(false);
}
}
компилирую мод и запускаю в стороннем лаунчере NoClassDefFoundError "подробнее в краш логе"
моды импортирую вот так:
implementation fileTree(dir: "libs", includes: ['*.jar'])
в build gradle поменял только название json миксина и маппинги
"так как dev моды которые я использую деобфусцированы на других маппингах и да я знаю что их можно перекомпилировать, но мне лень"
и по идее это не на что не влияет
скорее всего если я пару дней почитаю вики миксинов то все пойму но:
build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url = "https://plugins.gradle.org/m2" }
maven { url = "https://repo.spongepowered.org/maven" }
maven { url = "https://maven.minecraftforge.net/" }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: "org.spongepowered.mixin"
version = "1.0.0"
group = "com.artur114.srp_nia"
archivesBaseName = "srp_nia"
sourceCompatibility = targetCompatibility = 1.8
compileJava.options.encoding = compileTestJava.options.encoding = "UTF-8"
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// Channel: Version:
// snapshot YYYYMMDD Snapshot are built nightly.
// stable # Stables are built at the discretion of the MCP team.
// official MCVersion Official field/method names from Mojang mapping files
//
// You must be aware of the Mojang license when using the 'official' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20171003-1.12'
accessTransformer = file('src/main/resources/META-INF/tc_at.cfg')
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be changed as needed.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
// Нужно для работы миксинов в DEV среде
// Program arguments to setup and run MIXINS
args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.srp_nia.json'
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be changed as needed.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
// Нужно для работы миксинов в DEV среде
// Program arguments to setup and run MIXINS
args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.srp_nia.json'
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
maven { url = "https://repo.spongepowered.org/maven" }
}
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
//minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2855"
implementation fileTree(dir: "libs", includes: ['*.jar'])
implementation "org.spongepowered:mixin:0.8.3-SNAPSHOT"
annotationProcessor 'org.spongepowered:mixin:0.8.3-SNAPSHOT:processor'
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Implementation-Title" : project.name,
"Implementation-Version" : project.version,
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs": "mixins.srp_nia.json",
"FMLCorePluginContainsFMLMod": "true", // Не забываем указать эти два флага,
"ForceLoadAsMod": "true", // чтобы Forge нормально загрузил и мод, и миксины
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
mixin {
add sourceSets.main, "mixins.srp_nia.refmap.json"
}
// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
mixins.srp_nia:
{
"required": true,
"compatibilityLevel": "JAVA_8",
"package": "com.artur114.srp_nia.mixin",
"plugin": "com.artur114.srp_nia.mixin.MixinPlugin",
"target": "@env(DEFAULT)",
"refmap": "mixins.srp_nia.refmap.json",
"mixins": ["MixinEntityParasiteBase"],
"client": [],
"server": [],
"verbose": false
}
Main:
package com.artur114.srp_nia;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = Main.MOD_ID, useMetadata = true)
public class Main {
public static final String MOD_ID = "srp_nia";
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent event) {
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
}
@Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) {
}
}
- Краш-лог
-
---- Minecraft Crash Report ----
WARNING: coremods are present:
Contact their authors BEFORE contacting forge
// Uh... Did I do that?
Time: 4/29/24 11:26 PM
Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: com/dhanantry/scapeandrunparasites/entity/ai/misc/EntityParasiteBase
at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)
at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:612)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.NoClassDefFoundError: com/dhanantry/scapeandrunparasites/entity/ai/misc/EntityParasiteBase
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethod(Class.java:2128)
at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:93)
at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82)
... 37 more
Caused by: java.lang.ClassNotFoundException: com.dhanantry.scapeandrunparasites.entity.ai.misc.EntityParasiteBase
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 42 more
Caused by: java.lang.NullPointerException
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 206878560 bytes (197 MB) / 402653184 bytes (384 MB) up to 5335154688 bytes (5088 MB)
JVM Flags: 7 total; -Xmx5063M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.42 Powered by Forge 14.23.5.2859 10 mods loaded, 10 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
| State | ID | Version | Source | Signature |
|:----- |:----------------- |:------------ |:-------------------------------------------------- |:---------------------------------------- |
| LC | minecraft | 1.12.2 | minecraft.jar | None |
| LC | mcp | 9.42 | minecraft.jar | None |
| LC | FML | 8.0.99.99 | forge-1.12.2-14.23.5.2859.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LC | forge | 14.23.5.2859 | forge-1.12.2-14.23.5.2859.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LC | codechickenlib | 3.2.3.358 | CodeChickenLib-1.12.2-3.2.3.358-universal.jar | f1850c39b2516232a2108a7bd84d1cb5df93b261 |
| LC | redstoneflux | 2.1.1 | RedstoneFlux-1.12-2.1.1.1-universal.jar | None |
| LC | brandonscore | 2.4.20 | BrandonsCore-1.12.2-2.4.20.162-universal.jar | None |
| LC | draconicevolution | 2.3.28 | Draconic-Evolution-1.12.2-2.3.28.354-universal.jar | None |
| LC | srp_nia | ${version} | srp_nia-1.0.0.jar | None |
| LE | srparasites | 1.9.18 | SRParasites-1.12.2v1.9.18.jar | None |
Loaded coremods (and transformers):
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 552.12' Renderer: 'NVIDIA GeForce MX110/PCIe/SSE2'
Краш-лог:
---- Minecraft Crash Report ----
WARNING: coremods are present:
Contact their authors BEFORE contacting forge
// Uh... Did I do that?
Time: 4/29/24 11:26 PM
Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: com/dhanantry/scapeandrunparasites/entity/ai/misc/EntityParasiteBase
at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)
at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:612)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.NoClassDefFoundError: com/dhanantry/scapeandrunparasites/entity/ai/misc/EntityParasiteBase
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethod(Class.java:2128)
at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:93)
at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82)
... 37 more
Caused by: java.lang.ClassNotFoundException: com.dhanantry.scapeandrunparasites.entity.ai.misc.EntityParasiteBase
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 42 more
Caused by: java.lang.NullPointerException
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 206878560 bytes (197 MB) / 402653184 bytes (384 MB) up to 5335154688 bytes (5088 MB)
JVM Flags: 7 total; -Xmx5063M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.42 Powered by Forge 14.23.5.2859 10 mods loaded, 10 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
| State | ID | Version | Source | Signature |
|:----- |:----------------- |:------------ |:-------------------------------------------------- |:---------------------------------------- |
| LC | minecraft | 1.12.2 | minecraft.jar | None |
| LC | mcp | 9.42 | minecraft.jar | None |
| LC | FML | 8.0.99.99 | forge-1.12.2-14.23.5.2859.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LC | forge | 14.23.5.2859 | forge-1.12.2-14.23.5.2859.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LC | codechickenlib | 3.2.3.358 | CodeChickenLib-1.12.2-3.2.3.358-universal.jar | f1850c39b2516232a2108a7bd84d1cb5df93b261 |
| LC | redstoneflux | 2.1.1 | RedstoneFlux-1.12-2.1.1.1-universal.jar | None |
| LC | brandonscore | 2.4.20 | BrandonsCore-1.12.2-2.4.20.162-universal.jar | None |
| LC | draconicevolution | 2.3.28 | Draconic-Evolution-1.12.2-2.3.28.354-universal.jar | None |
| LC | srp_nia | ${version} | srp_nia-1.0.0.jar | None |
| LE | srparasites | 1.9.18 | SRParasites-1.12.2v1.9.18.jar | None |
Loaded coremods (and transformers):
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 552.12' Renderer: 'NVIDIA GeForce MX110/PCIe/SSE2'
Последнее редактирование: