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

Ibrahim-Khurram

@Ibrahim-Khurram

Joined June 1st, 2026

  • 6Devlogs
  • 3Projects
  • 0Ships
  • 0Votes
MY TRAITS ARE: AVID CODER 😤 BIKING ENJOYER 🄶 ONION HATER šŸ—£ļø ENGINEERING LARPER šŸ¦…
Open comments for this post

3h 9m 19s logged

Random Noise Generation!!

Ever since I successfully randomized the file an entity uses for its texture, I’v been working on creating random textured during runtime to truly randomize my chaos entity’s visuals.

Noise Generation

I’ve been using the Java BufferedImage class to generate random png’s to use for static. I iterate through each pixel and assign random r, g and b values (in the rgb color system). By default, it looks like static noise, but I’ve been trying custom operations and variables to instill patterns. Here is an example of the code:

		for (int y = 0; y < height; y++) {
			for (int x = 0; x < width; x++) {
				// generating values less than 256
				int a = (int) (100);
				int r = (int) (initial + (y + offsetR));
				int g = (int) (initial + (Math.abs(Math.round(Math.sin(x)))));
				int b = (int) (initial + (Math.abs(Math.round(Math.cos(x)))));
				offsetR += 10;
//* Math.abs(offsetG*Math.sin(rand.nextInt(100)))
				if(initial > 256){
					initial = rand.nextInt(256);
				}
				//pixel
				int p = (a << 24) | (r << 16) | (g << 8) | b;

				img.setRGB(x, y, p);
			}

Below, I have screenshots of different image files and entities I randomly generated using this code during testing.

Technical Issues(I haaatee fabric api why why why)

My initial approach was to call a method with the code above in the chaos entity’s constructor, which would generate a file titled "random" + entityID + ".png" (with entityID being a unique numerical ID assigned to each entity) on runtime, and the entity would use this generated file as its random texture. However, the rendering system can only detect files that were present in the project at compiletime, and these images are generated whenever an entity spawns during runtime. Whenever I would spawn a mob, it would have the ā€œpurple and black missing assetā€ texture until I closed and reran the code.

Temporary Fix

As of now, I generate 20 random noise pngs on initialization (when the program starts), and assign each spawned chaos entity one of these 20 images as its texture. This severely reduces the amount of randomness I was aiming for, and still needs the game to be run and rerun at least once so that there are always 20 random images present.

Moving forward

I really want to try to make the random image system more reliable and stable, and am working on making the patterns more interesting. However, I also want to move on to randomizing behavior soon. Randomizing visuals has destroyed me 😭
Here are some images of randomized files and entities I generated during testing different patternss :))

0
0
9
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
5
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
6
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
4
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
3
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
12

Followers

Loading…