matezz
Members-
Posts
61 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
matezz's Achievements
Stone Miner (3/8)
3
Reputation
-
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Oo that could work, I resolved my problem already but for future it'd be brilliant -
Minecraft supplies provider.create(<spriteset>) on registry, I can't create my own spriteset. I'm just asking why I can't cast this mixin to the target class - only after build. It could be a different class, not the ParticleEngine one. If one doesn't work, the rest wouldn't work too.
-
Hi, I'm trying to get the particle providers of my newly registered particles. Because the method in ParticleEngine is private, I used mixin accessor to get the field of `net.minecraft.client.particle.ParticleEngine#providers`: @Mixin(ParticleEngine.class) public interface ParticleEngineMixin { @Accessor Map<ResourceLocation, ParticleProvider<?>> getProviders(); } and to register a new particle and get the provider I use: Minecraft.getInstance().particleEngine.register(particleType, PARTICLE_FACTORIES.get(registryName)); if (((ParticleEngineMixin) Minecraft.getInstance().particleEngine).getProviders().get(registryName) instanceof WNParticleProvider<?> provider) { PARTICLE_PROVIDERS.put(registryName, provider); } And now, when I launch it in the IDE, everything works fine, particles are registered and I have providers. But when I try to launch the mod in Minecraft after build, it throws me an exception: net.minecraftforge.fml.ModLoadingException: xxx Mod (xxx) encountered an error during the common_setup event phase §7java.lang.ClassCastException: class net.minecraft.client.particle.ParticleEngine cannot be cast to class net.matez.xxx.mixin.ParticleEngineMixin (net.minecraft.client.particle.ParticleEngine is in module [email protected] of loader 'TRANSFORMER' @6c5ddccd; net.matez.xxx.mixin.ParticleEngineMixin is in module [email protected]_indev_4 of loader 'TRANSFORMER' @6c5ddccd) at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:124) ~[javafmllanguage-1.18.1-39.0.66.jar%2356!/:?] {} at net.minecraftforge.fml.ModLoader.lambda$postEvent$31(ModLoader.java:298) ~[fmlcore-1.18.1-39.0.66.jar%2355!/:?] {} at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?] {} at net.minecraftforge.fml.ModList.forEachModContainer(ModList.java:232) ~[fmlcore-1.18.1-39.0.66.jar%2355!/:?] {} at net.minecraftforge.fml.ModLoader.postEvent(ModLoader.java:298) ~[fmlcore-1.18.1-39.0.66.jar%2355!/:?] {} at net.minecraft.client.Minecraft.<init>(Minecraft.java:507) ~[client-1.18.1-20211210.034407-srg.jar%2354!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:169) ~[client-1.18.1-20211210.034407-srg.jar%2354!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.18.1-39.0.66.jar%2323!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} Caused by: java.lang.ClassCastException: class net.minecraft.client.particle.ParticleEngine cannot be cast to class net.matez.xxx.mixin.ParticleEngineMixin (net.minecraft.client.particle.ParticleEngine is in module [email protected] of loader 'TRANSFORMER' @6c5ddccd; net.matez.xxx.mixin.ParticleEngineMixin is in module [email protected]_indev_4 of loader 'TRANSFORMER' @6c5ddccd) at net.matez.xxx.common.registry.particles.WNParticles.lambda$registerFactories$0(WNParticles.java:56) ~[xxx-3.1_indev_4.jar%2353!/:3.1_indev_4] {re:classloading} at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[?:?] {} at net.matez.xxx.common.registry.particles.WNParticles.registerFactories(WNParticles.java:53) ~[xxx-3.1_indev_4.jar%2353!/:3.1_indev_4] {re:classloading} at net.matez.xxx.client.registry.setup.WNClientRegistry.registerParticleFactories(WNClientRegistry.java:29) ~[xxx-3.1_indev_4.jar%2353!/:3.1_indev_4] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-5.0.3.jar%232!/:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-5.0.3.jar%232!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%232!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%232!/:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[javafmllanguage-1.18.1-39.0.66.jar%2356!/:?] {} ... 19 more which is actually weird, as all the tutorials say that I can cast my target class with a mixin to access @Accessor. Maybe I'm doing something wrong? Mixin config: refmap enabled, mixin added to "client" in config, mixin version `org.spongepowered:mixingradle:0.7-SNAPSHOT`, forge `1.18.1-39.0.63`, annotationProcessor `org.spongepowered:mixin:0.8.5:processor` I couldn't use AccessTransformers, they didn't work.
-
Yeah I just in the same time discovered, instead TERRAIN_SHEET use PARTICLE_SHEET_OPAQUE. No idea why vanilla used terrain sheet.
-
Hi there, I've tried to register a custom particle, just like the docs say, but instead of a valid texture I get: It uses my block textures, not the particle ones. assets/modid/particles/crystal.json: { "textures": [ "modid:crystal/crystal_0", "modid:crystal/crystal_1", "modid:crystal/crystal_2", "modid:crystal/crystal_3", "modid:crystal/crystal_4", "modid:crystal/crystal_5", "modid:crystal/crystal_6", "modid:crystal/crystal_7" ] } ParticleTypes registered via RegistryEvent.Register<ParticleType<?>> event (SubscribeEvent) ParticleProviders registered via Minecraft.getInstance().particleEngine.register(ParticleType<T>, ParticleEngine.SpriteParticleRegistration<T>) My particle class is a copy of SuspendedParticle with some additions: So probably all should be fine, but it is not. Any ideas why? Thanks.
-
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
How? I did the same thing. Transistive + reobfShadowJar + runClient and same error occurs. Yeah that's how I figured it out later -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Excluded like so: include ('org.reflections:reflections:0.10.2') { transitive = false } Still the same problem. Anyway I will use FML yeah, just wanted to figure it out for future, cause I already had problems adding Apache Async HTTP dependency. -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Alright, makes sense. How can I solve this then? -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Here: https://github.com/zmatez/dependency_mod_problem -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Ah, I didn't read the whole sentence. Yes it is in my jar. org/reflections/... -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
Hmmm, interesting. I can use it. However would be cool if it would be fixed/documented, because I can't really add ANY dependency to my project. Future wise. -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
I tried other libraries too, also didn't work. From Apache, so code should be valid. I need this to scan all classes and find annotated ones. From here: https://stackoverflow.com/a/50955914/15411013 -
1.18.1 How to add external dependency to ForgeGradle.
matezz replied to matezz's topic in Modder Support
I was trying to find in other mods' source code, but everything that worked there didn't work in my project. Now I stand with: buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } maven {url='https://repo.spongepowered.org/repository/maven-public/'} mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } plugins { id 'java-library' id "com.github.johnrengelman.shadow" version "7.1.0" } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' version = '3.1' group = 'net.matez.wildnature' archivesBaseName = 'wildnature' java.toolchain.languageVersion = JavaLanguageVersion.of(17) compileJava.options.encoding = 'UTF-8' println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) 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: 'official', version: '1.18.1' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. runs { client { workingDirectory project.file('run') arg "-mixin.config="+archivesBaseName+".mixins.json" property 'mixin.env.disableRefMap', 'true' // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "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' mods { wildnature { source sourceSets.main } } } server { workingDirectory project.file('run') arg "-mixin.config="+archivesBaseName+".mixins.json" property 'mixin.env.disableRefMap', 'true' property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' mods { wildnature { source sourceSets.main } } } data { workingDirectory project.file('run') arg "-mixin.config="+archivesBaseName+".mixins.json" property 'mixin.env.disableRefMap', 'true' property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' args '--mod', 'wildnature', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { wildnature { source sourceSets.main } } } } } sourceSets.main.resources { srcDir 'src/generated/resources' } configurations { include implementation.extendsFrom(include) } repositories { // Put repositories for dependencies here // ForgeGradle automatically adds the Forge maven and Maven Central for you // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: // flatDir { // dir 'libs' // } } dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft 'net.minecraftforge:forge:1.18.1-39.0.9' annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' include 'org.reflections:reflections:0.10.2' // Real mod deobf dependency examples - these get remapped to your current mappings // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency // Examples using mod jars from ./libs // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } // Example for how to get properties into the manifest for reading at runtime. jar { manifest { attributes([ "Specification-Title" : "wildnature", "Specification-Vendor" : "matez", "Specification-Version" : "1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : "matez", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } jar.finalizedBy('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } shadowJar { archiveFileName = jar.archiveFileName configurations = [project.configurations.include] } reobf { shadowJar {} } jar.dependsOn("shadowJar") And it's okay in my dev environment, means IntelliJ says that this dependency exists. But when I launch runClient, throws error: Caused by: java.lang.NoClassDefFoundError: org/reflections/Reflections and Caused by: java.lang.ClassNotFoundException: org.reflections.Reflections I'm trying to solve it for the whole day and nothing works. -
Hello, how can I add external dependency to my 1.18.1 project? Implementation and other things like compile don't works and I need to do: dependencies { implementation 'org.reflections:reflections:0.10.2' } Tried everything - shadowJar, shade, nothing works, or just I am doing something wrong. And there is no documentation about it anywhere. Thanks
-
1.18 NoClassDefFoundError on gradle implementation
matezz replied to matezz's topic in Modder Support
Bump Still not works, with different dependencies (tried now "reflections") on a fresh MDK installation. Any ideas again? I can't move on with my project without adding external dependencies.