Jump to content

Best practice? Branching versus copying to start new mod


jabelar
 Share

Recommended Posts

So I have a handful of mods I like to publish and I also like to publish them for a few versions of Minecraft. I also have created a "starter" mod that is already set up with a lot of the tricks and utility classes in the way I like to organize my mod.

 

Until now, when I wanted to start a new mod I wouldn't do any git branching but would rather do file copy of my starter mod and make it a new repository. For different versions of the mod I would do the same (file copy and new repository).

 

This works pretty well but doesn't take advantage of ability to merge and cherry pick fixes and features across mods and across versions of mods. If I want to update something in one of my mods I have to cut and paste.

 

So I feel that there is some benefit in doing proper branching and release management. In other words, I think what I should do is instead of copying my starter mod I should create a branch for each mod and then create a branch from that for each version of Minecraft. 

 

Is that recommended?

 

My hesitation is that I just tried doing that and found that the amount of modification between versions of Minecraft is often quite large. Like if 1.13 comes along with "the flattening" I'll probably have so much recoding to do that I'm not sure managing it as a branch gives me much advantage. In the past things like the addition of blockstates, or changes to capabilities, are similarly pretty big changes. And frankly managing branches and merges can be a bit of a hassle.

 

So any opinions on this? Is it better to simply hand-craft a repository for each mod/version or do you guys find proper code branching and release management the way to go?

 

(Of course even if I do each mod separately I still use git to manage the development along the way, so I'm not debating the overall use of git.)

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

Link to comment
Share on other sites

4 minutes ago, jabelar said:

So I feel that there is some benefit in doing proper branching and release management. In other words, I think what I should do is instead of copying my starter mod I should create a branch for each mod and then create a branch from that for each version of Minecraft. 

 

Is that recommended?

Ew, no. Don't do that.

Branches are for things like maintaining the source for the same mod across multiple versions of Minecraft, not for unrelated projects.

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.

Link to comment
Share on other sites

4 minutes ago, Draco18s said:

Ew, no. Don't do that.

Branches are for things like maintaining the source for the same mod across multiple versions of Minecraft, not for unrelated projects.

Well the reason I even contemplated it is that my starter mod contains all my mechanisms I like -- all registrations and things are all set up, etc. Of course copying the files gives me all that too.

 

But even for different versions, do you recommend using branches or copy? I found that the amount of change is so large that the commonality is barely worth it. Once you change all the registration mechanisms (like the move to registry events), change achievements to advancements, IEEP to capabilities, go through and fix all the SRG name changes, get rid of hacks that are now handled by proper new Forge mechanisms, and so forth, seems like I have to touch almost everything anyway.

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

Link to comment
Share on other sites

Clone the project.

If you want your starter mod to be its own project and treat it like a library, then treat it like a library: make your other mods depend on it.

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.

Link to comment
Share on other sites

6 minutes ago, Draco18s said:

Clone the project.

If you want your starter mod to be its own project and treat it like a library, then treat it like a library: make your other mods depend on it.

Library idea is good for my utility classes, I will look at setting it up that way. But mostly my starter mod is more like a template -- already has all the classes and packages organized the way I like so for a new mod I can just get right into coding the new stuff. So probably just copying makes the most sense.

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

Link to comment
Share on other sites

Clone/Fork the repository, (re)name it to your new project, and don't worry about it.

(Forking will leave a reference back to the original, if that's important to you--either for wanting the link or being aware and doing it manually because you don't want the link)

Edited by Draco18s

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.

Link to comment
Share on other sites

This does not sound like a good way to handle totally separate mods.  I do do that for different version of the same mod (Doomlike Dungeons has branches for different Minecraft versions, several of which may have the same mod version).  But separate mods should be separate.

 

IMO, if you really want to have some kind of starter base it should be a separate thing from any of the mods (while I do sometime move small bits of code around, I would never have thought to make mods as you are describing).  But then.  None of what I've copied was big enough to warrant a library IMO, and I try to avoid extra utility mods since when downloading other people mods I don't like having tons of extra dependencies, but that could be a solution.

 

Draco's idea makes a certain amount of sense to me, but GitHub doesn't seem to offer forking for your own project (or they've hidden it) -- I don't think they intended it to be used that way.  Perhaps you could do it locally on the command line though.  I'd just keep that base separate for any kid of project -- but then, I'm just a self-taught programmer with no formal training on standard ways of doing things and probably a few weird habbits (the way I use branches is also a little different from the most common use).

Developer of Doomlike Dungeons.

Link to comment
Share on other sites

Or you can copy and paste the files on your computer and declare it a new repository.

  • 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.

Link to comment
Share on other sites

Check out how rwtema handles Extra-Utilities

 

Personally I've attempted to use SourceTree and Perforce P4Merge to help with migrating changes between versions of a mod I made on 1.12, 1.11, and 1.10. But due to both method and field name changes, vanilla and forge changes it's always very messy. McJty uses his custom library to deal with the version differences. The best you can do is isolate the unique things your mod provides as best you can and put the version dependent things elsewhere.

Edited by Aeronica
Link to comment
Share on other sites

I know what you mean in terms of a "starter mod"; I've gotten into the habit of using one common base for my mods and just starting each new project with that base. In my latest project (which I've lost... but that's another story), I ended up just making the starter into a library anyway. As a kind of "core library" that the other mods can rely on, with block/item bases and registrations set up how I like them.

But I agree with the other comments here: don't use version control to split up projects. It's meant for revisions, reversions, and a commit history, which doesn't make much sense for inter-project work (for instance, you should never want to revert a new project back to  a commit before the base). That also means you don't need all the projects' histories in your tree, either. So I'd say just keep it at one repo per project, branching for various features and fixes, and then (if you don't want to make the starter into a library) copying the starter files manually for new projects and initializing them as a new repo.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I made a huge forge 1.7.10 mod pack but whenever I try to create a singleplayer world I get the error saying "A fatal error has occurred, this connection is terminated." Does anyone know what the issue could be?  Here is my fml-client-latest.log from when it crashes: https://paste.ubuntu.com/p/3rKSJSqnrX/ and here is the list of mods: https://imgur.com/a/AZifMbg    
    • Im trying to host a minecraft server using the curseforge serverpack from FTB Direwolf20 and when I try to start the server I run into an error The Error: Starting server A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)         at java.lang.reflect.Method.invoke(Unknown Source)         at cpw.mods.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43)         at cpw.mods.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level         at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)         at net.minecraft.launchwrapper.Launch.main(Launch.java:28)         ... 6 more Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level         at java.net.URLClassLoader$1.run(Unknown Source)         at java.net.URLClassLoader$1.run(Unknown Source)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         ... 8 more   I'have tried deleting and downloading the newset version of java wich didnt work and now im using an older version which is the 1.7.0_80 Here is what my Server folder looks like: https://ibb.co/jkbfRY7 Here is what the ServerStart.bat file looks like: @if NOT "%FTB_VERBOSE%"=="yes" ( @echo off ) call settings.bat if NOT EXIST minecraft_server.1.7.10.jar ( goto install ) if NOT EXIST libraries\%LAUNCHWRAPPER% ( goto install ) goto skipinstall :install echo running install script! call FTBInstall.bat :skipinstall REM Check if java in path REM TODO: use %JAVACMD% where java > NUL 2>&1 if %ERRORLEVEL% NEQ 0 ( echo No java binary in path. Can't run server, exiting... pause exit /B ) REM Test JVM REM e.g. 32-bit JVM does not have server\jvm.dll library java -server -version > java-test.log 2>&1 if %ERRORLEVEL% NEQ 0 ( echo Detected following JVM error: echo ======================================= more java-test.log echo ======================================= echo JVM test failed. Can't run server, Exiting... pause exit /B ) if not exist eula.txt ( echo Missing eula.txt. Startup will fail and eula.txt will be created echo Make sure to read eula.txt before playing! goto startserver ) find "eula=false" eula.txt 1 > NUL 2>&1 if %ERRORLEVEL% EQU 0 ( echo Make sure to read eula.txt before playing! Exiting. pause exit /B ) del /f /q autostart.stamp > nul 2>1 :startserver echo Starting server java -server -Xms512M -Xmx2048M -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1558.jar nogui :server_loop if exist autostart.stamp ( del /f /q autostart.stamp > nul 2>1 echo If you want to completely stop the server process now, press Ctrl+C before the time is up! for /l %%i in (5,-1,1) do ( echo Restarting server in %%i choice /t 1 /d y > nul ) echo Starting server now java -server -Xms512M -Xmx2048M -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1558.jar nogui echo Server process finished goto :server_loop ) echo Exiting... pause  
    • Made a modpack (Well Rounded Blockheads, in case the modlist on curseforge helps) and server to host it, worked fine until last night. The issue that pops up after some days being up/working is when you leave a world (singleplayer) or shutdown a server, the process hangs and jumps to 8.5gb ram used, eats up CPU usage (50-60% in taskman on a 3800x) and just sits there. If done on a single player world, the game doesnt fully crash, (e.g. if you alt+f4 buttons like save and quit, options stay in the window, are still clickable but they do nothing) Saving seems to still happen, as location/inventory updates if I restart server or client and play the world again.   If I start the currently afflicted server but dont login the server closes properly, its only once I log back in the problem occurs. Its a priv server and I dont have anyone else to test atm so Idk if its a prob with my player or players/area in general. Only recent changes in game are the additions of a pnuematicraft pressure chamber, an enchanting table, and bookshelves from builders crafts and additions.... I've been trying to get help on this all day, so ANY assistance goes a long way, even if its a way to debug this myself >~< Debug/Latest logs
    • Thanks warjort. I was afraid, that this is because they are entities. Now I know where to dig. But what about water, for example? I have checked via debug code, that there is no entity there (appropriate method return null). What is wrong with liquids?
  • Topics

×
×
  • Create New...

Important Information

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