For Minecraft version 1.21, Heavy Inventories version 4+
Documentation is unfinished.
Heavy Inventories Banner
GitHub CurseForge CurseForge Minecraft

Heavy Inventories is a groundbreaking Minecraft addon designed to introduce a rich and immersive gameplay mechanic centered around item weight. Inspired by the weight system from Bethesda's The Elder Scrolls series, Heavy Inventories brings a new level of challenge and realism to your Minecraft experience. This book serves as both the official documentation for Heavy Inventories and a comprehensive research paper detailing the logic and methodology behind the creation of the Heavy Inventories Weight Engine.

The Need for a Weight System

Minecraft, a game known for its limitless creativity and exploration, traditionally lacks a weight system for inventory management. Players can carry an almost infinite number of items, which, while convenient, detracts from the game's realism and strategic depth. The introduction of a weight system addresses this gap, compelling players to make more thoughtful decisions about what to carry, enhancing the game's challenge and immersion.

Features and Functionality

Heavy Inventories is not just a simple weight addon; it is a feature-rich, seamless integration into the Minecraft ecosystem. At its core, the mod uses advanced machine learning algorithms to determine the weight of every item registered in the game. This dynamic and intelligent approach ensures that the weight values are balanced and realistic, adapting to the vast array of items and their variations within the game.

The Heavy Inventories Weight Engine

The heart of Heavy Inventories lies in its Weight Engine, a sophisticated system that generates, reads, and writes JSON files to store weight data for all items. This engine utilizes machine learning models to calculate valid weights, making it a robust and adaptable solution. The Weight Engine's ability to process and update item weights in real-time ensures that the gameplay remains consistent and fair, even as new items are introduced or existing items are modified.

Inspiration and Design Philosophy

Heavy Inventories draws significant inspiration from the weight systems used in The Elder Scrolls series, renowned for their balance and impact on gameplay. The design philosophy behind Heavy Inventories is to provide a similar sense of realism and strategic challenge. By implementing a weight system, players are encouraged to consider the consequences of their inventory choices, fostering a deeper engagement with the game world.

Structure

This book is divided into two main parts:

Documentation:

This section provides detailed instructions on how to install, configure, and use Heavy Inventories. It covers everything from initial setup to advanced customization options, ensuring that users of all skill levels can fully utilize the addon.

Research Paper:

This section delves into the technical aspects of the Heavy Inventories Weight Engine. It explores the machine learning models used, the algorithms for weight calculation, and the methods for data storage and retrieval. Additionally, it discusses the challenges faced during development and the solutions implemented to overcome them.

Research based articles will be labeled as such.

Conclusion

Heavy Inventories represents a significant enhancement to the Minecraft experience, introducing a realistic and challenging weight system that changes the way players interact with their inventories. By combining advanced machine learning techniques with thoughtful game design, Heavy Inventories offers a unique and engaging gameplay mechanic. Whether you are a casual player looking for a new challenge or a modder interested in the technical intricacies, this book provides all the information you need to get the most out of Heavy Inventories.

Class Structure

Launch classes

Class NameTypeFunction
HeavyInventories.javaInterfaceContains base logic for all classes to use.
ModBootstrap.javaClassDifferentiates the modded environment between client and server.
ModClient.javaClassThe client sided logic of the mod.
ModServer.javaClassThe server sided logic of the mod.
ModBase.javaClassThe common sided logic of the mod. Both ModClient and Mod Server inherit from this class.

The ModBootstrap class is seen by NeoForge as the main class file since it contains the @Mod annotation. The sole function of this class is to delegate whether the mod is in a client environment or server environment and uses a switch to load either the Client or Server. It is done this way so there is no interpolating conflicts between sides.

package superscary.heavyinventories;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLEnvironment;

@Mod(HeavyInventories.MODID)
public class ModBootstrap {

    public ModBootstrap (IEventBus modEventBus, ModContainer modContainer) {
        switch (FMLEnvironment.dist) {
            case CLIENT -> new ModClient(modEventBus, modContainer);
            case DEDICATED_SERVER -> new ModServer(modEventBus, modContainer);
        }
    }

}

Data Flow

ModBootstrap is the first to be called by the mod launcher, which it then differentiates between a modded client or server. The client and server java files inherit from the abstract class ModBase which creates the common logic needed to create data files.

   flowchart LR;
       ModBootstrap.java--> |Client| ModClient.java;
       ModBootstrap.java--> |Server| ModServer.java;
       ModClient.java-->Client_Logic[Client Logic];
       ModServer.java<-->ModBase.java;
       ModServer.java-->Server_Logic[Server Logic];
       ModClient.java<-->ModBase.java;
       ModBase.java-->Common_Logic[Common Logic];

ModBase.java

This class is inherited by both client and server. It is responsible for the logic needed on both sides. This class also registers all Codecs and DataAttachments as well as calling the ModFinder on postLoad.

ModClient.java

This class inherits from ModBase.java. It is responsible for registering the logic needed on the client side. This class registers all render handlers and client events.

ModServer.java

This class inherits from ModBase.java. It is responsible for registering the logic needed on the server side.

Features

Heavy Inventories aims to create a seamless experience in gameplay.

Tools

Tools wielded by entities or players have modified attributes that significantly influence their performance. These modifications affect how hard the tools hit, how quickly they can be used, and the speed at which they can be swung. Additionally, the ease of equipping these tools is also impacted, adding a layer of strategic depth to gameplay.

FeatureDescription
Swinging SpeedAffected swinging speed
Attack SpeedAffected attack speed
Equip SpeedAffected equip speed

Overall

  • Modified walking speed based on Inventory Weight
  • Modified jumping height based on Inventory Weight

Weight Generation

  • Automatic weight file generation
  • Machine Learning based creation
  • Customizable weights

Setup

Understanding Weight Files

Weight files are created at the end of the loader initialization to maximize compatibility with user installed mods. Mods that do not add items to the game will be skipped, reducing the number of files created and saving storage space.

Generated weight files can be found in the weights folder found in the root directory of the Minecraft installation.

    flowchart LR;
        modid --> Generator;
        itemList --> Generator
        Generator --> ItemWeight;
        ItemWeight --> DataWriter;
        DataWriter --> json[weights/modid.json]
The modid is dependent upon each mod and it cannot be changed.

The File

The resulting output is compiled into a .json file and is sorted by the modid. The data put into the file is sorted alphabetically for legibility.

[
  {
    "acacia_boat": {
      "readable_name": "Acacia Boat",
      "weight": 1.3
    }
  }
]

The items registry name is used as the key when obtaining the weight, the readable_name exists solely during manual input to search for items, and the weight value is the main value Heavy Inventories searches for.

Data Manipulation

Sided Configurations

Client

Rendering

Common

Server

Item Weights

Item weights are stored as java records. Each record is built at the end of the Loading Phase to capture all known items through the ModFinder.java class.

/**
 * Item weight definitions
 * @param modid String of the mod registering the item
 * @param registryName String form of the item registry name, ex. "cobblestone"
 * @param readableName String form of the item name, ex "Cobblestone"
 * @param weight the {@link Double} value that is returned after generation
 */
public record ItemWeight(String modid, String registryName, String readableName, double weight) {
    
}
TypeNamePurpose
StringmodidThe modid of the mod that owns the item.
StringregistryNameThe registry name of the item.
StringreadableNameThe localized name of the item, server based.
DoubleweightThe weight of the item as a double.

The values from each ItemWeight record are what are initially written to the [modid].json file.

Item Weight Effects

An items weight is used to not only affect the Player's weight, but also the interactions the item has in a Level. Denser items (ItemEntities) will sink in water, fall faster than lighter items, etc.

Player Weights

Player Weight Effects

Machine Learning

Heavy Inventories Machine Learning Banner

Heavy Inventories runs based off of generated data, there are no hard coded weights. To do this, a machine learning algorithm is implemented to create the best possible/plausible weight.

The Aim

Conventional Methods

Understanding the Machine Learning Logic

How Does it Work

The Recipe Finder

Color Ratios

Figure Material

How is This Data Used?

Heavy Inventories API