Minecraft mods

Welcome !

In this page you will be able to get the links and source code from my Minecraft mods.
Please see down there the list of them :

The Gists are the list of repositories for the mod. It means you can choose which modloader and Minecraft version you want to see the source code of.

ItemTanks

ItemTanks is a server-side mod that allows you to store huge amount of items within a single one. It is used with commands.

The source code is available on GitHub, please see this Gist to get all the repositories links to all versions and modloaders.

Downloads



Documentation

Before you read the command's documentation, there is a thing you should know. Like the BetterOSC's rods, the tanks works with a UUID. What it means is that the actual item stores nothing else than an ID : the actual item and amount is stored directly in the world's files. It has for effect to make any dupe attempts pointless : you'll just get two tanks communicating with each other ; and you will be able to tp items between the two, not to withdraw both tanks.

Creating a tank

You first need to hold the item you want to tank up, then execute the following command : /tank create [maxAmount] The maxAmount argument defines how much item can be put in the tank at the maximum. If not enough items are available, it puts the maximum it can. If it is not given, it puts all the items it can.

Adding items

To add items to a tank, you first need to hold it. Then, you can run one of the following commands : /tank add all
/tank add <amount>
The first one adds the all the available and compilent items to the tank, the second one adds amount to the tank. Again, if not enough items are available, it puts all the items it can.

Pulling items out

Removing items is very similar to adding ones. You can use : /tank withdraw all
/tank withdraw <amount>
The all and amount argument has the same properties as for adding items.

Other useful commands

You can use /tank details to get the stored item sent in the chat as a hoverable, so you can get advanced specs. You can use /tank updateDisplay which will reload from the tank's list the item and the amount stored. If you get an error while running this second command, is means the tank's data doesn't exist anymore. The data could have been deleted manually, someone could have duped the tank and emptied it or the admin gave it to themselves and emptied it.

Command's aliases

Here are all the aliases for the commands :

Documentation for server owners

Admins have access to the /tank admin command and it's arguments. It is actually only used for : /tank admin adminGiveTank <tankUUID> The tankUUID argument supports auto-complete : you can just choose one of the UUID and get a copy of the tank. As mentioned earlier, this will give you a duped tank and the two will be communicating.


Command Crafter

The mod is also known as CraftByCommands.

Command Crafter is a powerful server-side mod. It allows server admins to add custom recipes considering they want it to work with commands to their servers.

What makes it so powerful is the fact that: it is compatible with ItemTanks by being able to pull from tanks, that it can take huge amounts of items and, most importantly, it features a mod interface allowing to add custom item builders see the documentation for modders section for how to do it.

Downloads



Documentation

We have two main commands in the mods.

Check a recipe

To see a recipe's required resources, you can do one of : /seeRecipe <recipe>
/resourcesFor <recipe>
/sr <recipe>
The recipe argument will be suggested with all recipes available. It will then send you all items and quantities you need to craft the item, plus the result and the amount given. All items are sent as hoverable, so you can directly check enchants, durability, or other if specified. Due to how admins can set required or forbidden attributes on ingredients, you could give a damaged item where it displayed an intact one for instance.

Craft an item

Similar to checking resources, you have multiple options : /craft <recipe>
/c <recipe>
The recipe argument will be suggested. You will then be withdrawn from your items, and the result items will be given to you. If you don't have enough resources, it will just say it and tell you to check the recipe.

Documentation for server owners

Admins don't have access to specific commands or other things. Everything goes through the config files: The mod will try to load every file corresponding to serverRoot/config/commandcrafter/recipes/*.json as a recipe. Here is how to create recipe files :

  1. Define an id : this is what users will type to craft your recipe. It should be unique.
  2. Define a result. There are two types of results, characterized by the id property:
    • ones with custom:builder : It uses custom builders defined by other mods (detailed later). What you need to know is that when using it, you only defined id and extra. This last one is an entire JSON object, passed directly to the custom builder.
    • ones with namespace:item : It is detected by the id not being custom. It is then unboxed directly into an ItemStack, using ItemStack.CODEC. For more intel on how to use it, please refer to the corresponding documentation It can depend on your modloader.
  3. Define the array ingredients : everything you need to craft the item. This is the same as the result, but there is no custom. The item itself will be unboxed with ItemTanks.CODEC.
  4. Finally, you can define matching rules on ingredients. To proceed, just add a match object the object of the ingredient you wish to control. The object itself can define two arrays :
    • forbidden is which item properties the ingredient candidate can't have to be eligible
    • required is which item properties the ingredient candidate must have to be eligible

Here are some examples (annotated): { "id": "normal:milk_bucket", // 1 "result": { // 2 "id": "minecraft:bucket", // "normal" item "count": 1 // inserted directly into the ItemStack }, "ingredients": [ // 3 { "id": "minecraft:milk_bucket", "count": 1 } ] } Same example, but this time we give more complexe data to the ItemStack : { "id": "normal:milk_bucket", // 1 "result": { // 2 "id": "minecraft:milk_bucket", "count": 1, "components": { "minecraft:custom_name": { "text": "", "extra": [ { "text": "M", "color": "#424242", "italic": false }, { "text": "i", "color": "#818181", "italic": false }, { "text": "l", "color": "#C0C0C0", "italic": false }, { "text": "k", "color": "white", "italic": false } ] } } }, "ingredients": [ // 3 { "id": "minecraft:milk_bucket", "count": 1 } ] } Finally, here is an example with both custom namespace and a match clause: { "id": "osc:fixed_stab", // 1 "result": { // 2 "id": "custom:stab_fixed", "extra": {} }, "ingredients": [ // 3 { "id": "minecraft:tnt", "count": 500 }, { "id": "minecraft:fishing_rod", "match": { // 4 "forbidden": [ "components.minecraft:custom_data.oc_type" ] } } ] }

Documentation for modders

Time to speak about how to create a builder for this custom id. You will also learn how to define recipes that will automatically copy themselves the first time your mod is loaded. In this section, all imports in Java code comes either from java itself, from the Fabric mappings, or from CommandCrafter itself.

The custom builder

The custom:id means the mod will look for a custom builder called id within all builders registered. It will pass them to all builders registered, in order of registration, and take the first one that returns a non-null value. So, if your builder gets passed an unknown id, it should return null. You should only create and register one builder. The mod will pass it the id, and within your builder you can do something like a switch (id) to return the correct built item. Your method should be defined as so : public static ItemStack myBuilder(Recipe.ResultContainer resultContainer, ServerPlayerEntity crafter) { // your code... return null; // this tells the mod we don't know this id } To actually register the function to the mod, do : Registry.registerExecutor("yourmod", YourMod::myBuilder);

Using the Recipe.ResultContainer, you will have access to resultContainer.getId();, and most important resultContainer.getExtra(); : the raw JsonObejct extracted from the recipe file. You are free to manipulate this one as you want to get your datas out.

Automatic default recipes

For this one, you will first need to create your own sub-folder in the recipe folder. Path RECIPE_FOLDER = DefaultRecipesHandler.RECIPE_FOLDER.resolve("mymod"); Then, list all names of the files you want to copy in a List<String>. In our example, they'll be stored in [resouceRoot]/files/recipes/ (in IntelliJ IDEA, the resources folder next to java is the resource root). You will be able to change this value.

When you want to copy, start by checking if RECIPE_FOLDER exists : if so, return; (you don't want to re-write the recipes). Otherwise :

  1. Create RECIPE_FOLDER
  2. Enter a try
  3. Loop in your recipes with DEFAULT_RECIPES.forEach(fileName -> {}); (DEFAULT_RECIPE is your list from earlier):
    1. Resolve the final path: Path ouptut = RECIPE_FOLDER.resolve(fileName);
    2. In another try, create the parent folder of output. Then, catch (IOException), log it and return; : catching this separate from the rest is important because it disables us from copying the actual files.
    3. Using yet another try: try (InputStream source = ModRecipeHandler.class.getClassLoader().getResourceAsStream("files/recipes/" + fileName)) {} Here you can change files/recipes/ to anything you want in your resource root.
    4. In the previously-made try, check if the file exists, then copy it using : Files.copy(source, output); We are going to catch (IOException e) this try, not because it stops us but because it improves logging: you know for sure it happened either while getting your resource or copying your file.
  4. Close your very first try and catch any IOException.

If you'd like a real exemple, you can check out this class from the BetterOSC mod. It was the template I used while creating this guide.

BetterOSC

This mod exists because I was tired of other orbital cannon mods : they did not feature everything I needed or wanted, they were not accurate on some important parts of the cannon (like the fact that an obsidian roof would stop the blast)...

This mod is here to fill this mission. And, the fact I find important about it is that I am open to suggestion, or even feature requests. You can do all of them in the comment section of the distributors, or directly on the issue section of the GitHub repository corresponding to your favorite modloader and Minecraft version (use the Gist to get there).

Download



List of payloads

Please find here the list of all payloads available in the lastest version of the mod. If you wish me to add other payloads, please check out this page Request in GitHub. You will need an account.

Obtention

There are two ways of getting the payloads : using command (op required) or using the CommandCrafter mod. We'll go in the details here.

Using CommandCrafter, the mod should detect it automatically and copy over the recipes (refer to CommandCrafter's documentation about custom recipes for more information). Then, you will be able to craft all payloads with the default recipes and /c (from CommandCrafter). If you wish to remove / modify the recipes, they will be in the betterosc subfolder of CommandCrafter's root recipe folder. Again, refer to CommandCrafter's documentation on how to modify those.

The commands are always present, even when using CommandCrafter, but they are only available for opped players. /orbitalCannon give <payload> [arguments]
/orbitalCannon spawn <payload> [coordinate]

CompassManhuntHelper

This is sort of an addon for the CompassManhunt mod by produckzz.

The objective of the mod is to make the game easier to handle. It comes with automatic game end detection, chat options, host system, and more.

We are not affiliated of any kind with produckzz or his projects.

Downloads



Documentation for players

When you join a server as a player, you will first be glanced with these information :

If the game is already running, you will automatically be a spectator. Else, you will be in the authorized space.

Preparation

When you join a game you will play, there is a few things you can do. If the host allowed it, you can choose your team : /mh team <hunter|runner|spectator> At any moment, the tab tells you the teams Then, you just have to wait for your host to start the game !

The game

Once started, the headstart plays: if activated, the runners have x many seconds to run from the spawn. Once the timer has ended, the hunters are freed.

Runners only have one life each. The hunters have how many lives they want. They will respawn at their spawn point or the world spawn if none.

The game finishes and everybody gets TPed to world spawn once a team wins.

Win conditions

The runners win by killing the Ender Dragon. Warning: the win condition is filled if anyone gets the free the end achievement.

The hunters win once no runners are left alive. Any death counts : killed by a player or by the environment.

About the chat

Your host can allow you to message (/w) everyone, only your team or no one. The /me command is removed.

Another big feature is the team chat. As a player you have access to the following command: /mh teamChat [mode] Once activated, speaking in the general chat will send your message as a team message. Not mentioning a mode will give you your actual mode. You will have to reconfigure this on every new game. But, it depends on what the host configured: it could be forbidden (you will only speak in the global chat), allowed (configure it with the command) or forced. When you did not turn on the config, you can still team msg with /teammsg or /tm. When the team chat is forbidden, the /tm command won't work.

Documentation for hosts

The server's admins might have given you the host permission. How do you know ? There are two ways. When you log in and the game has not been claimed yet, it will tell you Hello host <YourName> !. Or, if you have access to the /mh host command, you are a host too.

Setup

As the login message will tell you, you will be able the claim the game if no other hosts have done so. It is as easy as to type in chat : /mh host claim Your current position when you type the command will be used as the world spawn. Make sure it is on solid ground. All players are then in adventure, and only you are in creative mode.

Time to config your game ! The first thing you'll want to do is the teams. Two options here : let players choose their teams (/mh team), or force them. To config this, you can use: /mh host config allowChooseTeam <true|false> Then, to manually assign a team (also works when choose teams is available, if a player can't do it alone): /mh host team <player> <team> Tip: let the players choose their teams, then disable the config and finish manually ! It usually means a faster and more efficient way than to wait for all players to stop trolling.

The second config you'll need to know is the headstart: /mh host config headstart <seconds> Giving it a value of 0 disables it ; the mod handles it correctly.

Finally, chat settings : Direct message (/w) can be set to forbidden, team or everyone. You can configure direct messages for players and spectators (scope). Team chat can be set to forbidden, allowed or forced. /mh host config directMessageMode <scope> <mode>
/mh host config teamChatMode <mode>

Running the game

Once you have configured everything, you can prepare the game. /mh host prepare It will TP everyone to the location you claimed the game, in spectator. Worldborder will extend.

Cancelling your host: the last time you can cancel your host is after your prepared the game. Once started, you won't be able to cancel it. /mh host cancel

Documentation for admins

Admins have very few dedicated commands.