#Minecraft runtime mod ? not sure what this would be called

1 messages ยท Page 1 of 1 (latest)

frozen hatch
#

Normally, in almost all cases, you write your Minecraft mod, build it, put the .jar in your mods folder, run Minecraft with Forge, and the mod just works as intended.

But I was wondering: what if you made a mod that works more like a Roblox executor? Basically, the mod itself would act as an "executor," providing some kind of in-game console or text box where you could write scripts (in Java, or Kotlin if enabled), run them at runtime, and then re-run modified versions without ever having to close and restart Minecraft.

pseudo epochBOT
#

<@&987246652869971988> please have a look, thanks.

frozen hatch
#

was wondering if this is even possible before trying since I am quite new and would suck for me to try for couple hours to jus realize it just doesn't work that way

elder sluice
#

make sure it's not against ToS btw

frozen hatch
#

did check for that doesn't appear to be

elder sluice
#

often only "the official way" is allowed

grizzled osprey
frozen hatch
# grizzled osprey What are you trying to do ? What do you want to do that ?

well to be fair just trying to learn, thought itd be a cool project, I already made couple minecraft mods, mainly for fun but always was a pain to have to restart the launcher after editing anything, so I was thinking there could be a way to have a "main" mod that loads once, and then lets me write and reload smaller scripts or modules at runtime, without having to rebuild the entire jar and restart Minecraft every time I make a change.

grizzled osprey
frozen hatch
#

I myself had a hard time setting up my first environement and everything

#

with this

#

youd just need to install the jar

#

drop it in your mods folder

#

launch the game

#

and start coding

#

straight out fo the box

grizzled osprey
#

You won't be able to do what you can do with roblox tho

frozen hatch
#

I did not expect it to work like roblox does, not at all, that was just the "concept" if I may say

grizzled osprey
#

repacing code at runtime isn't an easy thing

frozen hatch
#

so its doable ?

#

if its not easy

grizzled osprey
grizzled osprey
frozen hatch
#

official way would be to make your mod, run it in your IDE, realize something is broken or what not, close the minecraft instance, change it on the porgram, run it again and so on

pseudo epochBOT
#
TJ-Bot
Is it possible to replace a java class at runtime in latest version of java?

Yes, it is possible to replace a Java class at runtime in the latest version of Java using frameworks like JRebel or HotSwap. These tools allow developers to make changes to their code and see the results immediately without needing to restart the application. This can be useful for debugging and testing purposes, as it speeds up the development process by eliminating the need for frequent restarts. However, it is important to note that not all changes can be hot-swapped, and there are limitations on what can be modified at runtime. Additionally, care should be taken when using these tools in production environments, as they may introduce unexpected behaviors or security risks. Overall, while it is possible to replace a Java class at runtime in the latest version of Java, developers should use caution and consider the implications before implementing this approach in their projects.

frozen hatch
frozen hatch
grizzled osprey
elder sluice
#

u cant easily hotswap in a foreign process

viscid caveBOT
#
public abstract void redefineClasses(
  ClassDefinition... definitions
) throws ClassNotFoundException, UnmodifiableClassException

Redefine the supplied set of classes using the supplied class files.

This method is used to replace the definition of a class without reference to the existing class file bytes, as one might do when recompiling from source for fix-and-continue debugging. Where the existing class file bytes are to be transformed (for example in bytecode instrumentation) retransformClasses should be used.

This method operates on a set in order to allow interdependent changes to more than one class at the same time (a redefinition of class A can require a redefinition of class B).

<br />

grizzled osprey
#

@frozen hatch

elder sluice
#

its easy if its in ur own ide

frozen hatch
#

ill keep yall informed on the progress if you want

grizzled osprey
frozen hatch
#

oh dang any tips mate ?

elder stratus
#

there are languages amenable to being "hotloaded" and I just used one of them

#

no tips, it was a long time ago - but i'd be down to recreate that

frozen hatch
#

I mean if you ever do or if you still have a copy of what you did Id really appreciate to take a look for inspiration

elder stratus
#

i'll just tell you what i did: I embeded https://clojure.org/ into the jar and started an https://nrepl.org/nrepl/index.html - then whatever bare bones stuff was needed to load it as a mod and connected from https://cursive-ide.com/ , which is an intellij plugin (free for students and open source)

#

theres some clojure to learn but it really is quite trivial for that

frozen hatch
grim flare
elder stratus
#

i think they just want it for developing

#

which is doable

frozen hatch
#

yeah personal use mostly

elder stratus
#

but also i know of people who have "production nrepls" and hotload code live on air

#

its not literally magic, but that whole world is built for live development

#

so it works pretty well

frozen hatch
#

btw do threads close after a certain point ? I might start working on this tomorrow would suck if the infos yall told me would disappear ๐Ÿ˜” ๐Ÿ™

elder stratus
#

they auto close

#

but you can reopen with a message

frozen hatch
#

ight

#

alright appreciate it mate thanks for your time