You are browsing as a guest. Sign up (or log in) to start making projects!

Minecraft Chaos Theory Mod

  • 5 Devlogs
  • 10 Total hours

I'm making a mod to truly randomize the game. Right now I am working on making the ultimate random mob. I am working on randomizing visualization and behavior, and I want to explore procedural texture and image generation.

Open comments for this post

2h 14m 45s logged

MOB TEXTURE RANDOMIZATION

(phase 1)

What’s new

I have successfully been able to randomize the mob texture of my custom entity to select out of a list of random textures I made myself.
While I initially had the idea to create one large “mega texture”, and randomly choose where in the large file to look for each spawned mob’s texture, this isn’t easily possible with the fabric’s (and minecraft source code’s) mob rendering system. I wanted to see if I could at least randomize the texture files and pivot from there.

Technical Stuff

I speant a while reading through the source code of the panda mob to understand how to do this. Pandas in the vanilla game have a small chance of spawning with a “brown panda” texture, and after I read through the code I understood a method.

Minecraft Source Code Secrets

First it’s important to understand how minecraft handles entities. The game has a server and client (yes, even on singleplayer) always running in a world. Rendering is all handled on the client, while mob data is handled on the server. Pandas are assigned their “isBrown” property in the Panda class in the server.
In the client, there are two important files: the pandaRenderer, which handles rendering, and pandaRenderState, which handles entity information. The pandaRenderer extends mobRenderer, which has a method called “extract renderState” which takes the server-side entity class and renderState class as arguments, allowing variables from the server-side class to be synced with the renderState class(i.e. state.isBrown = entity.isBrown), which can be used by the entityRenderer. The entityRenderer also has a method that returns a texture path, so that for each panda that has a True isBrown value, a path to the brown panda texture can be returned.

The result

Once I understood how the game handles texture rendering, I added a String in the constructor for my custom mob, the chaosEntity, which is randomly assigned the path of one of the texture files. This is read by the renderer class to render the mob’s texture.

Why the other thing failed

I initially wanted to randomly offset the location in the texture png that the game looks for each body part of the entity. For example, in a 600x600 png image, one mob’s head might be taken from the pixels at coordinates starting at (0, 10) on the png, while another’s might start at (520, 50). However, this coordinate offset is defined in the entityModel class, which is registered into the game’s rendering system when the client is initialized. This means when the game starts, the model can only be registered once and not edited. I tried a lot of ways to change the model after initialization, but every time got a crash because of how the game handles models. As far as I can tell right now, there is no way to adjust the model of an entity after it has spawned without writing my own rendering system from scratch.

Future Steps

While this is a working example (finally) of each spawned mob in the world having a random texture, I don’t have the energy to make enough png textures for it to be interesting. I’m experimenting with procedural image generation to try and randomly generate mob texture files for every chaosEntity, and then use those files for that mob’s texture. Wish me luck!

0
0
4
Open comments for this post

4h 1m 30s logged

The mobs flash now :o –MINECRAFT MODDING YAY

I’ve continued trying to add more randomization to Minecraft, starting with mob textures. In my last devlog, I got it to randomize the texture of my custom mob everytime the game started.

brief recap

I’ve been trying to make it so every mob that spawns has a random texture, and I’ve tried using networking to communicate between the server and client, as well as exploring the renderer classes that pandas use (since they also have different appearances) and trying to imitate that functionality.

technical stuff for nerds

I’ve successfully been able to set up payload communication between the server and client(rendering is on the client), but even when the client receives the message, there isn’t an easy way to re-register the entity model each time a new entity spawns. I looked at how the game handles the different randomized panda textures from source files, but the game uses different texture files to do this, whereas I use one giant texture file and randomly offset where in the file the model renderer starts pulling from. Because pulling from the texture file and declaring which texture file to use happen in different parts of the code, I can’t do my method the same way the game handles pandas (I tried 😭🙏)
This is a smaller thing, but since last time I’ve also addd working animated arms to my mob. arms are cool. I like my arms. Coding would be harder without them.

**the restt …

As of right now, I tried randomizing between different texture files as a test to see what I can do. It randomizes the mob textures but does it every game tick instead of once when it spawns.(╥﹏╥) I am posting this devlog as a sort of “checkpoint” on all the stuff I’ve tried so far and where I am right now.

This genuinely feels like square one 🥀

0
0
5
Open comments for this post

1h 24m 51s logged

Randomized Minecraft mob textures!!

For my mod I want to make my mob fully random every time one spawns. Right now I’m making the visual appearance of the mob randomized.

Basically I have a 600x600px png with different colors and patterns, and when rendering the mob I make the code pick a random point on the large png to use for the texture net.

Every time I close and rerun the project, the mob looks a little different! Here are some combinations below. Next I wanna make it randomize every time one spawns.

0
0
3
Open comments for this post

44m 47s logged

I got a basic custom entity working for my mod. It just uses the default attributes as in the fabric docs right now, and I’m gonna start experimenting with randomizing things like behavior, animation and texture mapping.

I want the mob to be truly unpredictable and random. We’ll see where this goes!

0
0
2
Open comments for this post

1h 4m 45s logged

I’ve started working on my randomness minecraft mod.

The concept is that every feature I add is completely randomized when the game starts. For example, a mob I add would have randomized behavior and attributes, or a block I add might have randomized generation behavior. My end goal is to add procedural dimension generation (basically infinite random dimensions, kind of like the infinity april fools update from a few years back), and I’m adding other features to work my way up.

I’m using the fabric modding API. So far, I’ve started work for setting up and adding an entity. I want the entity to have randomized behavior, but am running into errors. I’m following along the fabric docs for adding an entity and will modify it once it works.

1
0
11

Followers

Loading…