DEV Community

loading...
Cover image for Tenor.devlog[1] - Fabric Mod Setup, and Tenor's state

Tenor.devlog[1] - Fabric Mod Setup, and Tenor's state

nombrekeff profile image Keff ใƒป6 min read

What up friends! ๐Ÿ‘‹

Hope you're doing well!

This is the second installment of my devlog "Journey into Minecraft Modding". Following my journey creating a mod for Minecraft called Tenor, using FabricMC.

In devlog[1] I will cover why I decided to use FabricMC instead of Forge, how to set up a basic mod, and the current and future state of Tenor.

NOTE: I do not endorse hacking, mostly. This post is not intended as a guide to doing so, it's just my journey and experiences, and is intended for learning.

Table of Contents

Why did I go with FabricMC?

Well, long story short, I had loads of trouble with Forge, as it lacked documentation, and could not wrap my head around it, quite messy.

I actually started with Forge as I knew this was usually how mods were done, based on the research I did. But after trying for a while and struggling with simple things like showing a text on the screen. I decided to check FabricMC out, as I heard it was a more welcoming modding platform.

As you will see in the setup part, getting started creating a mod is really straightforward, and quite simple at first. Although, there are some complex topics like mixins, or accessWideners, which I will try to cover in detail in a future devlog.

After implementing most of the things I had trouble with using Forge, I decided to move to Fabric instead.

Though Fabric's docs still lack quite a bit, they're a lot better than forge in my honest opinion. Now, that you kinda know the reasons, let me show you how to set up a dev environment for modding with Fabric.

Install fabric

For this just follow the guides over at FabricMCs docs, they do the job quite well!

Mod Setup

This setup will mainly follow, the guide over at Fabric, for VSCode. You can check it out over at their site here if you prefer.

Prerequisites

Clone Template

The first thing we need is to generate the project, there are various ways to do it but they provide a GitHub template repo, so we can just clone that repo and start with a base created for us already.

For this we just need to:

  1. Use FabricMC/fabric-example-mod template to generate a repository from the template.
  2. Clone locally
  3. Edit gradle.properties:
    • Make sure to set archives_base_name and maven_group to your preferred values.
    • Make sure to update the versions of Minecraft, the mappings, and the loader - all of which can be queried through this website - to match the versions you wish to target.
    • Add any other dependencies you plan to use in build.gradle.

VSCode setup

I will be coding with VSCode so we can then follow the VSCode instructions.

Recomended Extensions

Import Project

Import the project in VScode by:

  • Using the menu: File โ†’ Open
  • In console: code <path>
  • Drag folder into editor.

ย Generate run configs

For us to be able to run the game from inside VSCode and with debugging support enabled we will need to generate the run configs. This is done by running the Gradle vscode task.

This is easy enough, open a terminal and run:

./gradlew vscode
Enter fullscreen mode Exit fullscreen mode

this will automatically generate the necessary launch.json file containing the run configs.

After this we will have access to the run config, to be able to run the game. For this, select the debug menu item on the left taskbar. This will then build the mod and launch the game.

Generating Minecraft Source

If we want to browse and look at the Minecraft source we can use the Gradle genSources task. This can be done by running the following command in our terminal:

./gradlew genSources
Enter fullscreen mode Exit fullscreen mode

Next, we will need to refresh our Java project, this can be done by pressing Shift + Alt + U while having the build.gradle file open.

To search for Minecraft classes we can open the search pane with Ctrl + P, you can prefix your searches with # to search for the Minecraft classes.

Mod Files

After the above steps are done, we should have a project ready. I will explain some of the most important files:

/src/main/resources/fabric.mod.json:

This is the mod's metadata file, you can read more here, but it's like a package.json file.

/src/main/resources/modid.mixins.json:

Metadata for mixins.

/src/main/java/net/fabricmc/example/ExampleMod.java:

This is what Fabric calls entrypoints, it's basically the Main classes of the mod. We can have multiple of them.

/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java:

Mixins explained in later devlogs, but you can read about them here and here.

Tenor, what's the state?

Well, at the moment Tenor is at a point where I am mostly happy with it, in the sense of how it's structured and designed. I'm sure I will change my opinion in the future, after realizing I need to redo a whole system ๐Ÿ˜‚

Tenor currently has a "Core", and a set of modules that amplify Tenor's abilities, all working together. I've done it like this for a couple of reasons:

  • Decoupling tenors core functionality like Events, from specific functionality like rendering a HUD or Pathfinding.
  • Also letting the modules interact with one another, allows for them to use functionality from one module in another module.
  • Allows for easy toggling of specific modules, for example, we can disable the HUD in the settings, and that will not update the module, making it inactive.
  • Easily add new functionality in the future, as I intend to work on this for a long time.

The core handles low-level stuff (Events, Mixins, etc), and each module higher level stuff (HUD).

Sorry if I'm not 100% clear with how the code is structured, but I'm not very good at that. Hopefully, I will improve as the devlog goes on!

Currently Tenor can:

  • Handle commands, from in-game chat
  • Rendering a HUD
    • Overworld Coords
    • Nether Coords
    • Direction
  • Super precarious pathfinding and movement (Flat terrain for now, lol)
    • This will be part of the devlog.
  • Weather hack, prevents wheater rendering.

Aim:

  • Advanced pathfinding
  • More hacks
    • Jesus hacks
    • ESP
    • Tracers
    • Speed hacks
    • Flight hacks
    • Etc...
  • Auto fish
  • Auto farm
  • Auto eat
  • Auto walk forwards
  • And many more...

Wrap up

Well, I hope you got an idea on how to create a Fabric Mod, and what state tenor is at the moment, and going forwards.

I still don't have the repo ready, but hopefully in a week or so I will be making it public, so you can check it out as the log progresses!

In the next devlog I will dive into what I had to do to get to the current state, oh boy was it a bumpy ride! So you can expect that soon.

And as always, thanks for taking the time to read my devlog!

And until next time, cheers! ๐Ÿ‘‹

Discussion (0)

Forem Open with the Forem app