Jump to content

Recommended Posts

Posted

As of lately, I have decided to make a coremod for minecraft 1.11. I'm using forge version 13.19.1.2189 with the mcp mappings snapshot from 11.2.2017.

I have I daresay pretty successfully made a coremod, most of the things stayed the same as they were in 1.7.10 and I was already familiar with Java bytecode and ASM.

So I implemented IFMLLoadingPlugin and pointed it to my transformer class. I added the 'FMLCorePlugin' attribute to the jar's manifest in the Gradle script. When I build the final artifact and load it in a normal runtime environment it works as expected. That's because Forge/FML knows where to find my plugin.

Since running a configuration in a dev env (using IntelliJ IDEA, personally) just puts all the files in a big classpath blob, there is no manifest for Forge/FML to read the location of my plugin from.My question is, whether there is some magic command line option for the instance that tells Forge/FML that there is an IFMLLoadingPlugin that needs loading.
In 1.7.10, something along the lines of -Dfml.coremods.load=<class> could be used, but I tried that and Mojang's

Main.java told me it would ignore the argument because it apparently doesn't know what to do with it:
 

[main/INFO]: Running with arguments: [..., --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, -Dfml.coremods.load=<pkg>.<modid>.asm.<ModId>Plugin, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

 

[main/INFO]: [net.minecraft.client.main.Main:main:59]: Completely ignored arguments: [-Dfml.coremods.load, <pkg>.<modid>.asm.<ModId>Plugin]

 

I tried it in a few different variations, like -Dfml.coremod.load= or -Dfml.coreMods.load= etc.

I looked through the source code, and I found that there is a --tweakerClass option, but it expects an ITweaker, and not an IFMLLoadingPlugin, which is what I have (crashes if one uses the wrong type, tested that much).

I can test the mod in a regular instance, but building the archive, copying it over and restarting minecraft is tedious and doesn't easily allow for debugging.

If there are other command line options, I would be delighted to get to know about those as well, or even better where one can find them.

 

Thanks for taking your time reading this.

 

(There are really few resources on coremodding in general)

Posted

Don't make a coremod.

Alternative options, to be used in order:

 - Use APIs

 - Use Events

 - Use Reflection

 - Ask on the forums, you probably missed how to do one of the above

 - Make a Forge Pull Request on GitHub

 - Still don't make a coremod

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I guess I should have expected such a reply...

I don't need help with the decision of whether or not making a coremod is the right thing. I have already decided on that.

 - There are no APIs for this purpose. This is defined by how Minecraft at the core defines its methods (ie. a method taking ItemStack as a param in Item.java instead of a method in ItemStack.java; this would not really work because making modders extend ItemStack is just plain old stupid, but sometimes you have to change the behaviour of a method defined in Item.java that is ItemStack-sensitive.)

 - Although there is an event that could potentially be used to achieve this, the behaviour would not be fully equivalent to what I had in mind and how it works right now, and it would be unnecessarily inefficient.

 - Reflection cannot modify methods' bytecode, we use ASM or other instrumentation APIs to do that.

 - I shall think not, there is the event thing, also catching all itemstack creation events and replacing with a wrapper itemstack should work, but a coremod is a cleaner solution imho.

 - The hooks I am implementing are far too specific to be included in forge. There is no reason for these hooks to exist, I don't think, so unless the guys at forge want to add a hook to literally every method there is, I don't think this is a viable option.

 - It is very unlikely that any other coremod would instrument on the methods I am modifying, and my change is very unaggressive (scanning for a return statement, only inserting a hook before it to modify the value already on the stack, aborting if the method is drastically changed from what the code expects... There are a lot of good bytecode manipulation techniques and rules of thumb out there). And, if you still don't think that making a coremod is a good idea in my case, let's say it's for educational purposes. You can't deny that making a coremod is a good idea for the sole purpose of learning how coremodding works.

 

I am fully aware though that in most cases making a coremod is not a good idea, and understand why you would want to stop me from doing so. I still want to make a coremod, and I only want to know how to do this one singular thing. Please.

Posted (edited)

Why would they not be supported by Forge when it is essentially Forge who adds them?

 

Pls understand me I could do the thing without a coremod but I want to make a coremod. The chanches of anyone evr using this in their game is like low to non-existent.

 

I just want to know how to load coremods in a dev-env. I think Forge should be able to do that?

Edited by HashtagShell
Posted

Do not create coremods. There is no reason to. Especially in actively developed versions. And especially if you admit that you can do it without a coremod.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It is a rendering issue with embeddium/oculus
    • So, I have a minecraft world hosted with essential on forge 1.20.1, there's 149 mods, and the forge version is 47.3.0, and it's been like that for a good 2-3 weeks, and all of a sudden, it stopped loading, and I have 0 clue as to why, and this world means A LOT to me, so if anyone out there is able to help, I would GLADLY appreciate it. here's the link if ya wanna help:   [04Dec2024 22:42:24.552] [Worker-ResourceReload-3/ERROR][net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener/]: Couldn't parse data file slabsexpanded:snow_blockblocktoslab from slabsexpanded:recipes/snow_blockblocktoslab.json com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected name at line 16 column 4 path $.result.item at net.minecraft.util.GsonHelper.m_13780_(GsonHelper.java:526) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.util.GsonHelper.m_263475_(GsonHelper.java:531) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.util.GsonHelper.m_13776_(GsonHelper.java:581) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_278771_(SimpleJsonResourceReloadListener.java:41) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_5944_(SimpleJsonResourceReloadListener.java:29) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.m_5944_(SimpleJsonResourceReloadListener.java:17) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at net.minecraft.server.packs.resources.SimplePreparableReloadListener.m_10786_(SimplePreparableReloadListener.java:11) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 16 column 4 path $.result.item at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1657) ~[gson-2.10.jar%23107!/:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:514) ~[gson-2.10.jar%23107!/:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:422) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:779) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725) ~[gson-2.10.jar%23107!/:?] at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:1007) ~[gson-2.10.jar%23107!/:?] at net.minecraft.util.GsonHelper.m_13780_(GsonHelper.java:524) ~[client-1.20.1-20230612.114412-srg.jar%23490!/:?]
    • Hello! I have been having a problem with Forgematica, Embeddium, Oculus, and create. I wanted to download litematica so I could see which blocks are in my creative mode build, so that I could collect them all in survival. However, litematica is a fabric mod. I found a port called forgematica, which I added (along with it's dependency) to my mods folder. I loaded into a new world, and built a structure. Then, I added a part from the create mod, and the game crashed instantly, with exit code -1. Thanks for any help! Crash Report and mods list: https://pastebin.com/rtzh6LAi
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.