Jump to content

Recommended Posts

Posted (edited)

So I was looking into modding with C#, and I came across this. Nothing helpful. Just a guy claiming "Minecraft IS Java" and "There is no way around this", which simply isn't true. I'm wondering if there are any good ways to do this. If not, are there any smaller projects trying to do this that I could contribute to? Just to be clear, I'm not looking for mods to contribute to, I'm looking for projects allowing mods to be created in C#.

 

Edit

Another thing I want to make clear: I'm not looking for somebody to tell me that MC is written in Java, or how MC works. I know all about it. Which is why I know that this kind of thing is possible if someone is willing to put in the work. I'm not looking for a lecture about everything I already know.

Edited by Brendanp01
Posted
37 minutes ago, diesieben07 said:

There are no such projects that I am aware of.

You would have to somehow use JNI and write java wrappers that then call out to the C# code - and even then I'm not sure if it is even possible to use JNI with C#. If not, you'd have to have yet another layer written in C++ to handle the JNI part.

 

And yes, the response was right, Minecraft is written in Java so any mods need to be, firstly, written in Java. If that Java code then does random crazy stuff and calls out to other language runtimes, sure, you can in theory do that. However the entrypoint of the mod still needs to be written in Java (or more specifically in something that compiles to JVM class files) so that Minecraft and the Forge mod loader knows what to do wiht it.

Like I said, I'm not looking for someone to tell me how MC works. Pretty much everything you said is true, but also a bit obvious to anyone who isn't a beginner. The reason I did that edit was because I knew that someone would end up telling me what I already know. However, I will look into what you said in the first paragraph.

Posted

Well, unfortunately, because of <thing you already know>, it isn't possible because <thing you already know.> As such what you want to do would require <doing things you don't want to do>.

  • Like 1

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 (edited)
49 minutes ago, Draco18s said:

Well, unfortunately, because of <thing you already know>, it isn't possible because <thing you already know.> As such what you want to do would require <doing things you don't want to do>.

Not possible? We already can compile Java to .NET assemblies using IKVM. Don't tell me it's not possible to compile C# to Java bytecode. Don't tell me there's no way to create a bridge between .NET and Java. This exact thing I'm looking for has been done before, you can see it here. However, it's no longer kept up. I'm asking for answers, not people telling me something isn't possible when it's been done before. Apparently, the last sentence of your "signature" is true, "No help will be given".

 

Edit

There is a reason I asked for projects to contribute to. If your skull is too thick to figure that out, I honestly feel bad. Since you obviously couldn't figure it out, let me explain: I asked for projects to contribute to so that I could contribute to a project. Seems obvious, but I guess not. I simply don't care enough about this to start a project like this from scratch.

Edited by Brendanp01
Posted (edited)
2 minutes ago, diesieben07 said:

That is not what IKVM is. IKVM is a JVM written in Java, i.e. it runs java class files on .NET by being a JVM itself.

 

Of course its possible. Just requires a lot of work. Of course its possible write Minecraft mods in Brainfuck if you wanted to, you just need to put the work in to write the adapters.

 

 

Yes, you are correct, sorry.

Edited by Brendanp01
Posted (edited)
5 minutes ago, mandar1jn said:

I feel bad for you not being able to understand that THERE ARE NO PROJECTS TO CONTRIBUTE TO!! And that you will have to start from scratch to do this. Just use java. Way easier. 

This. I mean, unless you are trying to use C# for fun or education, just use Java. All the wrappers and who knows what else will just cause more problems and make things run slower if they work at all.

Edited by Nuke3d
Posted
2 minutes ago, mandar1jn said:

I feel bad for you not being able to understand that THERE ARE NO PROJECTS TO CONTRIBUTE TO!! And that you will have to start from scratch to do this. Just use java. Way easier. 

One person on this entire page said anything about projects I could contribute to. And he didn't say there are none, he said he isn't aware of any. I thought at this point it was clear, I want answers. If you're just going to say something like "not possible" without looking into it at all, don't say anything.

Posted
2 minutes ago, Nuke3d said:

This. I mean, unless you are trying to use C# for fun or education, just use Java. All the wrappers and who knows what else will just cause more problems and make things run slower if they work at all.

Yes, I'm aware. I'm not trying to do anything crazy. Just want to try out modding. Of the programming languages that I know how to use, Java is probably my least favorite. I know C# is similar to Java. However, I prefer the .NET platform, and I like the fact that I can use F# along with C#.

Posted
3 minutes ago, Brendanp01 said:

Yes, I'm aware. I'm not trying to do anything crazy. Just want to try out modding. Of the programming languages that I know how to use, Java is probably my least favorite. I know C# is similar to Java. However, I prefer the .NET platform, and I like the fact that I can use F# along with C#.

I would recommend you start out modding in Java, and then once you feel you have decent command of that, if you still want to try doing it in C# go for it. You'll likely have the tools to make it happen on your own at that point too, and could start assembling your own group around the project. Good luck whatever you choose!

  • Like 1
Posted
1 minute ago, Nuke3d said:

I would recommend you start out modding in Java, and then once you feel you have decent command of that, if you still want to try doing it in C# go for it. You'll likely have the tools to make it happen on your own at that point too, and could start assembling your own group around the project. Good luck whatever you choose!

Thank you! You're the most helpful anyone has been here.

Posted
54 minutes ago, Brendanp01 said:

There is a reason I asked for projects to contribute to. If your skull is too thick to figure that out, I honestly feel bad. Since you obviously couldn't figure it out, let me explain: I asked for projects to contribute to so that I could contribute to a project. Seems obvious, but I guess not. I simply don't care enough about this to start a project like this from scratch.

The reason no projects exist is because there's no pre-written API. Because there is no pre-written API, it is not possible for you to contribute to an existing project. As such you would have to write the API yourself. In Java.

1 hour ago, Draco18s said:

Well, unfortunately, because of <thing you already know>, it isn't possible because <thing you already know.> As such what you want to do would require <doing things you don't want to do>.

 

image.png.5d5c0d93b0a395c836a500e520a602a3.png

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 (edited)
11 minutes ago, Draco18s said:

The reason no projects exist is because there's no pre-written API. Because there is no pre-written API, it is not possible for you to contribute to an existing project. As such you would have to write the API yourself. In Java.

 

image.png.5d5c0d93b0a395c836a500e520a602a3.png

thing I already know = MC is written in Java

I asked if there were people who have already done this. I didn't ask what programming language MC is written, how modding with Forge works, or for you to tell me that there are none. If you don't know of any, don't say anything. If you do, great! Let me know. Icame here for help and so far you haven't said anything helpful.

Edited by Brendanp01
typo
Posted
27 minutes ago, diesieben07 said:

No, you asked if there is a good way to do it.

To which the answer is: Most definitely not.

I asked if there was a good way to do it or if there are any projects to contribute to that try to do it.

Posted

I'm not here to argue. If you have a useful answer that will help me do what I want to do, then good. If not, I don't want to hear it. However, if you say something stupid I'm not just going to ignore it.

Posted
13 minutes ago, Brendanp01 said:

If you have a useful answer that will help me do what I want to do, then good.

You've gotten that answer. "You cannot."

13 minutes ago, Brendanp01 said:

If not, I don't want to hear it. However, if you say something stupid I'm not just going to ignore it.

Something something flies and honey.

  • Confused 1

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
2 minutes ago, Draco18s said:

You've gotten that answer. "You cannot."

Something something flies and honey.

Well, that's not true. I already gave you a link of an old project that did it. "You cannot", does not help me do what I want to do. It's not useful, since it isn't true.

Posted

Let me clarify:

You cannot.

In general, yes it can be done, but you aren't interested in building those APIs and as those APIs don't already exist, the thing you want to do cannot be done.

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

Okay, I'm done arguing with idiotic people. I'll say it one more time, if you know what you're talking about, unlike some people (Draco18s), then tell me.

Posted (edited)
6 hours ago, Brendanp01 said:

Okay, I'm done arguing with idiotic people. I'll say it one more time, if you know what you're talking about, unlike some people (Draco18s), then tell me.

Look, when I decided to get into modding C# was the only language I knew. I saw forge and minecraft, were programmed in Java, but I didn't want to learn Java because I loved C#. I looked everywhere for ways to do it and couldn't find none. it's a non-sensical task: you'd need to write wrappers for all the classes that minecraft and forge provides, and then you would need to keep updating it everytime a new mapping or forge/minecraft version came out. it's a lot of work, for very little benefit, the modding communnity isn't big enough for this to be a reasonable project.

you could look into how to write c# that compiles to jar's, sure.. but you still would need access to classes that exist in Java code.

What I can tell you is that it is not worth it. We, programmers, can't fall in love for a language and try do to everything with it, it's a very common programming sin. You need to recognize the best language for the job, and accept it. And if you just ahte the language so much you can't even think of writing in it, then maybe not doing the project is just a better option

 

The best I could recommend you, if you really don't want to write Java, is to take a look at Kotlin or Scala, they are better versions of Java basically.

Or do what I did, learned Java, it isn't even that bad. but having to do C programming really lowered my bars

 

and also, maybe think a little bit before saying a Forum Moderator that has been contributing to the modding community for 8+ years, doesn't know what he's talking about. you're the newbie here, tyring to do something that is, honestly, idiotic

Edited by kiou.23
  • Thanks 1
Posted
5 hours ago, Brendanp01 said:

Okay, I'm done arguing with idiotic people. I'll say it one more time, if you know what you're talking about, unlike some people (Draco18s), then tell me.

*sigh* <people who know what they're talking about> have already spoken up and told you what you needed to know. You didn't like what they had to say and now you're just being rude. You had some very insightful responses from people. Bottom line, it really isn't done because it really isn't feasible or worth the time. Minecraft is written in Java. I get that that may not be your favorite language, but if you want to do MC in C#, there are no known projects that will let you do this, so you'll have to do it yourself. You do not have the Java chops to do it yet and since there are no projects that will allow you to do it, your only choice is to learn to mod MC in Java until you are experienced enough to handle both the Java and C#(and possibly C++) stuff yourself. You do not sound experienced enough in any of those languages to pull it off. I've been around programmers my entire life (I'm almost 50) and experienced programmers...well, you can just tell when they are talking about what they're good at. Maybe I'm wrong(wouldn't be the first time) but my advice to you is to listen to the "elders" of the forum.

 

It sounds like you do not want to do this anyway, so, *shrug* I guess that's that.

 

And please don't take any of this as insult. It's not. It's just truth. Sometimes truth cuts deep. Life is like that.

  • Like 1
  • Thanks 1
Posted

Minecraft is written in Java.

Mods need to be written in a language that compiles to the JVM.

Any arguments over this is just stupid.

If you wanna write a mod in C# go find a game that is written in C#.

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

    • After some time minecraft crashes with an error. Here is the log https://drive.google.com/file/d/1o-2R6KZaC8sxjtLaw5qj0A-GkG_SuoB5/view?usp=sharing
    • The specific issue is that items in my inventory wont stack properly. For instance, if I punch a tree down to collect wood, the first block I collected goes to my hand. So when I punch the second block of wood to collect it, it drops, but instead of stacking with the piece of wood already in my hand, it goes to the second slot in my hotbar instead. Another example is that I'll get some dirt, and then when I'm placing it down later I'll accidentally place a block where I don't want it. When I harvest it again, it doesn't go back to the stack that it came from on my hotbar, where it should have gone, but rather into my inventory. That means that if my inventory is full, then the dirt wont be picked up even though there should be space available in the stack I'm holding. The forge version I'm using is 40.3.0, for java 1.18.2. I'll leave the mods I'm using here, and I'd appreciate it if anybody can point me in the right direction in regards to figuring out how to fix this. I forgot to mention that I think it only happens on my server but I&#39;m not entirely sure. PLEASE HELP ME! LIST OF THE MODS. aaa_particles Adorn AdvancementPlaques AI-Improvements AkashicTome alexsdelight alexsmobs AmbientSounds amwplushies Animalistic another_furniture AppleSkin Aquaculture aquamirae architectury artifacts Atlas-Lib AutoLeveling AutoRegLib auudio balm betterfpsdist biggerstacks biomancy BiomesOPlenty blockui blueprint Bookshelf born_in_chaos Botania braincell BrassAmberBattleTowers brutalbosses camera CasinoCraft cfm (MrCrayfish’s Furniture Mod) chat_heads citadel cloth-config Clumps CMDCam CNB cobweb collective comforts convenientcurioscontainer cookingforblockheads coroutil CosmeticArmorReworked CozyHome CrabbersDelight crashexploitfixer crashutilities Create CreativeCore creeperoverhaul cristellib crittersandcompanions Croptopia CroptopiaAdditions CullLessLeaves curios curiouslanterns curiouslights Curses' Naturals CustomNPCs CyclopsCore dannys_expansion decocraft Decoration Mod DecorationDelightRefurbished Decorative Blocks Disenchanting DistantHorizons doubledoors DramaticDoors drippyloadingscreen durabilitytooltip dynamic-fps dynamiclights DynamicTrees DynamicTreesBOP DynamicTreesPlus Easy Dungeons EasyAnvils EasyMagic easy_npc eatinganimation ecologics effective_fg elevatorid embeddium emotecraft enchantlimiter EnchantmentDescriptions EnderMail engineersdecor entityculling entity_model_features entity_texture_features epicfight EvilCraft exlinefurniture expandability explosiveenhancement factory-blocks fairylights fancymenu FancyVideo FarmersDelight fast-ip-ping FastSuite ferritecore finsandtails FixMySpawnR Forge Middle Ages fossil FpsReducer2 furnish GamingDeco geckolib goblintraders goldenfood goodall H.e.b habitat harvest-with-ease hexerei hole_filler huge-structure-blocks HunterIllager iammusicplayer Iceberg illuminations immersive_paintings incubation infinitybuttons inventoryhud InventoryProfilesNext invocore ItemBorders itemzoom Jade jei (Just Enough Items) JetAndEliasArmors journeymap JRFTL justzoom kiwiboi Kobolds konkrete kotlinforforge lazydfu LegendaryTooltips libIPN lightspeed lmft lodestone LongNbtKiller LuckPerms Lucky77 MagmaMonsters malum ManyIdeasCore ManyIdeasDoors marbledsarsenal marg mcw-furniture mcw-lights mcw-paths mcw-stairs mcw-trapdoors mcw-windows meetyourfight melody memoryleakfix Mimic minecraft-comes-alive MineTraps minibosses MmmMmmMmmMmm MOAdecor (ART, BATH, COOKERY, GARDEN, HOLIDAYS, LIGHTS, SCIENCE) MobCatcher modonomicon mods_optimizer morehitboxes mowziesmobs MutantMonsters mysticalworld naturalist NaturesAura neapolitan NekosEnchantedBooks neoncraft2 nerb nifty NightConfigFixes nightlights nocube's_villagers_sell_animals NoSeeNoTick notenoughanimations obscure_api oculus oresabovediamonds otyacraftengine Paraglider Patchouli physics-mod Pillagers Gun PizzaCraft placeableitems Placebo player-animation-lib pneumaticcraft-repressurized polymorph PrettyPipes Prism projectbrazier Psychadelic-Chemistry PuzzlesLib realmrpg_imps_and_demons RecipesLibrary reeves-furniture RegionsUnexplored restrictedportals revive-me Scary_Mobs_And_Bosses selene shetiphiancore ShoulderSurfing smoothboot
    • Hi everyone, I'm currently developing a Forge 1.21 mod for Minecraft and I want to display a custom HUD overlay for a minigame. My goal: When the game starts, all players should see an item/block icon (from the base game, not a custom texture) plus its name/text in the HUD – similar to how the bossbar overlay works. The HUD should appear centered above the hotbar (or at a similar prominent spot), and update dynamically (icon and name change as the target item changes). What I've tried: I looked at many online tutorials and several GitHub repos (e.g. SeasonHUD, MiniHUD), but most of them use NeoForge or Forge versions <1.20 that provide the IGuiOverlay API (e.g. implements IGuiOverlay, RegisterGuiOverlaysEvent). In Forge 1.21, it seems that neither IGuiOverlay nor RegisterGuiOverlaysEvent exist anymore – at least, I can't import them and they are missing from the docs and code completion. I tried using RenderLevelStageEvent as a workaround but it is probably not intended for custom HUDs. I am not using NeoForge, and switching the project to NeoForge is currently not an option for me. I tried to look at the original minecraft source code to see how elements like hearts, hotbar etc are drawn on the screen but I am too new to Minecraft modding to understand. What I'm looking for: What is the correct way to add a custom HUD element (icon + text) in Forge 1.21, given that the previous overlay API is missing? Is there a new recommended event, callback, or method in Forge 1.21 for custom HUD overlays, or is everyone just using a workaround? Is there a minimal open-source example repo for Forge 1.21 that demonstrates a working HUD overlay without relying on NeoForge or deprecated Forge APIs? My ideal solution: Centered HUD element with an in-game item/block icon (from the base game's assets, e.g. a diamond or any ItemStack / Item) and its name as text, with a transparent background rectangle. It should be visible to the players when the mini game is running. Easy to update the item (e.g. static variable or other method), so it can change dynamically during the game. Any help, code snippets, or up-to-date references would be really appreciated! If this is simply not possible right now in Forge 1.21, it would also help to know that for sure. Thank you very much in advance!
    • The simple answer is there is not an easy way. You would need to know how to program in Java, as well as at least some familiarity with how Forge works so you could port the differences. You would also need the sourcecode for the original mod, and permission from the author to modify it, if they did not use some sort of open source license. So it's not impossible, but it would take some effort, but doing so would open up a whole new world of possibilities for you!
  • Topics

×
×
  • Create New...

Important Information

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