Jump to content

Recommended Posts

Posted

I am learning to make mods.

 

Is it possible to develop a mod that is compatible with 1.7.10, using later versions of forge? I noticed that botania does not hardcode the minecraft version number into its gradle.build file, instead importing it from a config file. I haven't dug around in their git repo, so I'm not sure how this works, or to what end.

 

If so, are there some resources available for modders who are concerned with backwards compatibility?

 

I'm sure someone will ask so I'll just go ahead and explain: I have no particular attachment to any version of minecraft and, as a programmer, I would like to work using the latest versions of the tools available. However, I started wanting to write mods while playing around with Botania and Pam's Harvestcraft in "the 1.7.10 modpack". This is a server that some friends and I are playing on together, and I thought it would be cool to be able to add some simple blocks and items (proper tatami mats, for example).

 

Thank you!

Posted
3 minutes ago, Zeigfreid said:

Is it possible to develop a mod that is compatible with 1.7.10

No this is impossible. In 1.8 a lot of things changed method names, models, etc. Its basically impossible for mods to be backwards compatible between minecraft versions like 1.10 to 1.11 but 1.11.0 to 1.11.1 would be possible.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

No, there is no mod compatibility at all between major Minecraft versions.

 

(Apart from odd cases like 1.9->1.0 which were mostly compatible - but don't count on that ever happening again).

 

Also worth noting that compatibility layers have been attempted in the past, most notably McJty's compatlayer - which worked pretty well between 1.10 and 1.11, but it's worth noting that he decided 1.12 was too different to be feasible to support and therefore gave up on it for 1.12.

Edited by desht
Posted
5 minutes ago, Animefan8888 said:

No this is impossible. In 1.8 a lot of things changed method names, models, etc. Its basically impossible for mods to be backwards compatible between minecraft versions like 1.10 to 1.11 but 1.11.0 to 1.11.1 would be possible.

Well its actually 100% possibly if you're willing define backwards compatible as rewriting the mod for every version.

If your mod is very simple (just adds blocks & items etc.), you could also use/make a system (API) that handles all the registration & stuff while not externally changing from version to version (this still means you/someone else has to rewriting the mod for every version).

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

OK right, if I make a wrapper to isolate my mod code from the forge APIs etc... that would achieve the result I desire.

 

What about things like the formats of the various json files? That's something I would not be able to encapsulate with a wrapper, if the formats have changed I would need to either... generate the json files from some common format, or write everything twice.

 

What would be a good guide to look at for porting from 1.7 to 1.8 ? (just to get a sense of the concerns involved)

 

What I will probably do is just learn 1.12.2, but I thank you, Cadiboo, for your advice! 

 

Quote

this still means you/someone else has to rewriting the mod for every version

It could mean that, but couldn't it also mean that you/someone just has to write a new wrapper for each supported forge version?

Edited by Zeigfreid
Posted
12 minutes ago, Zeigfreid said:

What about things like the formats of the various json files? That's something I would not be able to encapsulate with a wrapper, if the formats have changed I would need to either... generate the json files from some common format, or write everything twice.

I did say "very simple mod", your wrapper could inject some autogenerated models (I'M NOT RECOMMENDING OR SUPPORTING OR ENCOURAGING OR ENDORSING DOING THAT!)

 

14 minutes ago, Zeigfreid said:

What would be a good guide to look at for porting from 1.7 to 1.8 ? (just to get a sense of the concerns involved)

Depends what your trying to port, I just ported a 1.7.10 rendering based mod to 1.12.2 (it took me almost a year to learn the stuff required, but the mod was pretty high level). If I remember correctly, aside from the rendering changes 1.7->1.8 wasn't that big of a change, so you could probably go straight from 1.7 to 1.12.2. The best guide is learn to mod in 1.12.2, then take that experience and use it to port the old mod.

 

17 minutes ago, Zeigfreid said:

It could mean that, but couldn't it also mean that you/someone just has to write a new wrapper for each supported forge version?

Forge code doesn't change too much except when a new version comes out (they save up forge changes for new MC versions), but yeah me/someone has to write a new wrapper for every supported forge version (which should be every forge version)

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

I am actually kind of already porting a mod from 1.10 to 1.12 ^o^// I started working on this tutorial a few days ago, but I had downloaded the latest version of forge (1.12). This resulted in bugs involving the registry changes, which I had to fix, which promoted learning. Even though I now know that an updated version exists I'm going to do the rest of the 1.10 tutorial, porting it to 1.12 as I go. Adversity helps me learn!

 

Anyway, thanks again for your help! I'll be back with less annoying, more practical questions soon.

Posted

1.10 -> 1.12 is relatively straightforward.  There will be some method name changes, which are generally fairly easy to work out using your IDE and examining the decompiled Minecraft source.  One big change is that null ItemStacks should never be used from 1.11 onwards, instead use ItemStack.EMPTY and ItemStack#isEmpty().  Missing null ItemStack usages is a common source of NPE's in ported mods, and they can be tricky to track down in some cases.  Other than that, recipe registration changed in 1.12 (recipes are now defined in JSON files for the most part, and while the old way can be made to work, it should be considered deprecated). And there are the registry changes, which it sounds like you're aware of.

 

Posted

@Cadiboo @desht @Zeigfreid You are forgetting about obfuscation of Minecraft classes. In one version the Item class could be called a while in another it could be called b. You can't fix that by creating a wrapper.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
7 hours ago, Animefan8888 said:

@Cadiboo @desht @Zeigfreid You are forgetting about obfuscation of Minecraft classes. In one version the Item class could be called a while in another it could be called b. You can't fix that by creating a wrapper.

What I meant by a wrapper was an API built on top of Forge that handles all the registration, using an input system that doesn’t change per version. Why would you ever deal with unobfuscated Minecraft classes directly?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
1 hour ago, Cadiboo said:

Why would you ever deal with unobfuscated Minecraft classes directly?

When your mod is compiled it doesnt just stay as extends Item or new ItemStack it is translated into the obfuscated names. Which is why using an IDEs built in compiler doesnt work, you have to use gradle.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
2 hours ago, Animefan8888 said:

When your mod is compiled it doesnt just stay as extends Item or new ItemStack it is translated into the obfuscated names. Which is why using an IDEs built in compiler doesnt work, you have to use gradle.

Sorry, I thought this was related to the wrapper, obviously mods break between versions because of that

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
4 hours ago, Animefan8888 said:

When your mod is compiled it doesnt just stay as extends Item or new ItemStack it is translated into the obfuscated names. Which is why using an IDEs built in compiler doesnt work, you have to use gradle.

This is incorrect. Method and field names are reobfuscated from MCP to SRG names when you compile, but MCP and SRG class names are the same. Forge deobfuscates Minecraft from Notch to SRG names at runtime.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)

The API approach mentioned above is logically sound, but practically it is more work than just doing the porting directly. Firstly, this all assumes that you will make  a fair number of mods to be worth considering such generalizing.

 

But if you do make lots of mods it is likely that each of your mods touches fairly different aspects of the game. Like one might add dimensions, another entities, another items and so forth. Sure there might be some cross-useful stuff, but generally modders end up making either a bunch of targeted mods or one comprehensive mod. So then making an abstraction layer beyond Forge itself doesn't make sense -- you'll be trying to generalize something that you only use a couple times and going through a number of hoops to accomplish even that.

 

I also struggled for a while trying to figure out the best way to support porting multiple mods, because frankly it is a lot of work. At one point I thought that even branching my code would be useful -- like start a mod in 1.7.10 then branch for each additional version up to 1.12.2 or whatever. However, I found that the code changes so much between versions that even that was a waste of time!

 

Honestly, with modding you have both the underlying Minecraft vanilla code as well as the Forge code both undergoing significant overhauls for each version. Heck even the upcoming 1.13 is going to be a huge rewrite!

 

The best thing in the end is just to organize your code in a useful and familiar way and then just put in the work for the porting.

 

One last tip: you need to pick your battles. For example, some things like Entities haven't really changed much through the various versions. But things like blocks have changed a lot with properties, blockstates, JSON models, and registry events all changing and now they are going to be "flattened"! So if you have a mod that focuses on Entities I would highly recommend trying to port it to as many versions as possible. But if you have a mod that focuses on Blocks I would recommend just concentrating on one or two suitable versions to support.

Edited by jabelar
  • Like 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Actually I think we skipped the important thing, it’s pretty much no trouble to port a mod between versions if your code is easily readable and understandable. 

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
20 hours ago, Animefan8888 said:

@Cadiboo @desht @Zeigfreid You are forgetting about obfuscation of Minecraft classes. In one version the Item class could be called a while in another it could be called b. You can't fix that by creating a wrapper.

And yet McJty's compatlayer allowed binary compatibility between mods for 1.10 and 1.11.  So it is possible, but probably more work than is worth it in the long run (as I mentioned, McJty dropped compatlayer for 1.12).

 

Best bet is just to keep your code as clean as possible, and put in the porting work when the time comes.  And pay attention to any PSA's & tutorials about what's changing ahead of time.

Posted
13 hours ago, Animefan8888 said:

When your mod is compiled it doesnt just stay as extends Item or new ItemStack it is translated into the obfuscated names. Which is why using an IDEs built in compiler doesnt work, you have to use gradle.

Actually you may have a point, I think (I could be wrong) that 1.13 Forge is not going to do runtime deobfuscation so no more SRG names?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)
3 hours ago, desht said:

And yet McJty's compatlayer allowed binary compatibility between mods for 1.10 and 1.11.  So it is possible, but probably more work than is worth it in the long run (as I mentioned, McJty dropped compatlayer for 1.12).

 

Yes, it is definitely possible but as my long "essay" above notes it is rarely worth it. 1.10 to 1.11 was a rare transition with very little big things changing between them. Most versions are much more drastic.

 

But imagine going from a version before blockstates was introduced to afterwards -- you'd need to like replicate the whole system of one of the two approaches in order to make them compatible. Or imagine going from a version before capabilities to one afterwards, and so forth.

 

So like I said before -- you can do it but only if you "pick your battles". If your mod focuses on a specific thing like entities and that doesn't change much between versions then it might be worth a compatibility layer. 

Edited by jabelar
  • Like 2

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

1.7 > 1.12 i think is too much complex, but for 1.11 > 1.12 besides McJty, SquidDev did temporarialy a compat injection for ComputerCraft while dan200 didnt opened the source code.

You can talk with him on Computer Mods server (if you want i can send the inivitation link via DM).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • log: [19:06:44] [main/INFO]:ModLauncher running: args [--username, Kubersuper, --version, forge-47.3.12, --gameDir, C:\Users\kubaz\curseforge\minecraft\Instances\boom boom theres goes your tower watchi, --assetsDir, C:\Users\kubaz\curseforge\minecraft\Install\assets, --assetIndex, 5, --uuid, 5845841d7d744ce6817f17be1a940650, --accessToken, ????????, --clientId, 2c2b0a-d835f5-9c8096-10e7135-c9036b, --xuid, 2535469494192349, --userType, msa, --versionType, release, --width, 1024, --height, 768, , , , , --launchTarget, forgeclient, --fml.forgeVersion, 47.3.12, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412][19:06:44] [main/INFO]:ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Eclipse Adoptium; OS Windows 11 arch amd64 version 10.0[19:06:44] [main/INFO]:Loading ImmediateWindowProvider fmlearlywindow[19:06:45] [main/INFO]:Trying GL version 4.6[19:06:45] [main/INFO]:If this message is the only thing at the bottom of your log before a crash, you probably have a driver issue.Possible solutions:A) Make sure Minecraft is set to prefer high performance graphics in the OS and/or driver control panelB) Check for driver updates on the graphics brand's websiteC) Try reinstalling your graphics driversD) If still not working after trying all of the above, ask for further help on the Forge forums or DiscordYou can safely ignore this message if the game starts up successfully.
    • the modpack keep crashing idk why,cause it never said anything about any mods causing it. crash log:https://drive.google.com/file/d/1iYKlUgvHUob8DjyRc3gqP_Viv_kSHO6L/view?usp=sharing mod list:https://drive.google.com/file/d/1MvMT-z9Jg2BITQ4uLshJ1uOh7q9EMBfC/view?usp=sharing but the server(anternos) works just fine
    • Hello, I am trying to make 2 recipes for a ruby. The first one is turning a block into a ruby and the other one is 9 nuggets into a ruby. But I keep on getting a error java.lang.IllegalStateException: Duplicate recipe rubymod:ruby   Any help would be great on how to fix it
    • Hello everyone, i'm new with programing Mods, and will need a lot of your help if possible,  Im trying to make a new GUI interface responsible to control the Droprate of game, it will control de loot drop and loot table for mobs and even blocks, but i try to make a simple Gui Screen, and wenever i try to use it, the game crash's with the error message in the subject, here is the code im using to:  IDE: IntelliJ Comunity - latest version Forge: 47.3.0 Minecraft version: 1.20.1 mapping_channel: parchment mapping_version=2023.09.03-1.20.1 Crash report link: https://pastebin.com/6dV8k1Fw   Code im using is:    package createchronical.droprateconfig; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import java.util.HashMap; import java.util.Map; public class ConfigScreen extends Screen { private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation("droprateconfig", "textures/gui/config_background.png"); // Mapa de mobs e itens com seus respectivos drop rates private final Map<String, Integer> dropRates = new HashMap<>(); public ConfigScreen() { super(Component.literal("Configurações de Drop Rate")); // Inicializa com valores de drop rate padrão dropRates.put("Zombie", 10); // Exemplo de mob dropRates.put("Creeper", 5); // Exemplo de mob dropRates.put("Iron Ore", 50); // Exemplo de item dropRates.put("Diamond", 2); // Exemplo de item } @Override protected void init() { // Cria um botão para cada mob/item e adiciona na tela int yOffset = this.height / 2 - 100; // Posicionamento inicial for (Map.Entry<String, Integer> entry : dropRates.entrySet()) { String itemName = entry.getKey(); int dropRate = entry.getValue(); // Cria um botão para cada mob/item this.addRenderableWidget(Button.builder( Component.literal(itemName + ": " + dropRate + "%"), button -> onDropRateButtonPressed(itemName) ).bounds(this.width / 2 - 100, yOffset, 200, 20).build()); yOffset += 25; // Incrementa a posição Y para o próximo botão } // Adiciona o botão de "Salvar Configurações" this.addRenderableWidget(Button.builder(Component.literal("Salvar Configurações"), button -> onSavePressed()) .bounds(this.width / 2 - 100, yOffset, 200, 20) .build()); } private void onDropRateButtonPressed(String itemName) { // Lógica para alterar o drop rate do item/mob selecionado // Aqui, vamos apenas incrementar o valor como exemplo int currentRate = dropRates.get(itemName); dropRates.put(itemName, currentRate + 5); // Aumenta o drop rate em 5% } private void onSavePressed() { // Lógica para salvar as configurações (temporariamente apenas na memória) // Vamos apenas imprimir para verificar dropRates.forEach((item, rate) -> { System.out.println("Item: " + item + " | Novo Drop Rate: " + rate + "%"); }); // Fecha a tela após salvar Screen pGuiScreen = null; assert this.minecraft != null; this.minecraft.setScreen(pGuiScreen); } @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { this.renderBackground(guiGraphics); guiGraphics.blit(BACKGROUND_TEXTURE, this.width / 2 - 128, this.height / 2 - 128, 0, 0, 256, 256, 256, 256); super.render(guiGraphics, mouseX, mouseY, partialTicks); } }  
  • Topics

×
×
  • Create New...

Important Information

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