Various technical Minecraft projects and Minecraft related thoughts and news

Jaffle Minecraft modding platform

I’ve finally got my modding platform for command mods in MC working. It’s now available on github as a download.  I have released it under the MIT License so be sure to copy the copyright information and license if you use any part of the code in your own project. If you put your own project in a separate datapack, you won’t need to include any of the original license information in it.

How it works

The basic concept is pretty simple. Jaffle creates an armor stand with a scoreboard variable that increments every clock tick and resets every second. A specific function in each mod is called within each clock tick in a one second period. A function in each mod is also called every single clock tick. This allows mods to execute every second or every clock tick and also reduces performance penalty by spreading the processing load across a one second interval.

To clarify the terminology used for Jaffle, a ‘mod’ can refer to either a set of functions in a single namespace, ie a module, or it can refer to the conceptual mod composed of functions which change the way MC works. Normally all the function files for a single mod will be kept in the same functions folder within the namespace for that mod.

Jaffle can be configured with all the mods in the same datapack as Jaffle itself, however if you put the mods in a separate datapack it means you won’t need the original license file in your datapack.

The platform uses ‘glue’ modules which have their own namespace. These are named jaf_modX, where X is the mod number. The platform currently allows up to 10, but you can probably figure out how to change Jaffle to allow even more mods.

The glue modules then call the relevant functions in your own modules. That way the original Jaffle functions don’t need to be changed. The developer just needs to add their own glue module and mod functions. You can mix and match different mods together. It’s also ok to change the mod number in the glue module for compatibility.

A module called jaf_pack contains a couple of functions used by Jaffle to display an introduction to the mod pack when the pack is first started up in the MC world. These functions should be updated by the developer.

There are a couple of example modules included with Jaffle: joa_fx and joa_pim. joa_fx just provides an effect that causes any entity with the JOA_FX_Num scoreboard variable set to 1 to spin around, give off colorful particles and rise up in the air for a couple of seconds. joa_pim protects valuable items by preventing them from despawning and making them invulnerable to damage. It also stops items from falling into the void.

These modules show how Jaffle can be used to simplify command mod development in MC.

There is a python script, manual_parser.py, in the Jaffle datapack folder (called jaffle-master in the direct download). This can be used to generate a release version of the mod pack (more on this in a later post) or can be used to check if there are repeated tags or scoreboard variables between modules. The developer needs to maintain a list of their scoreboard variables and tags to make use of this, hence the name ‘manual’_parser. I’m working on an automatic parser that will one day automatically identify tags and scoreboard variables, even when inside quotes.

How To Use it

Due to the way Github works, the downloaded zip file can’t be placed directly in the datapacks folder of the world. Instead, extract the jaffle-master folder and place that folder in the datapacks folder.

Be aware that this folder will disappear if your MC world is deleted, therefore I strongly recommend backing up your design to a more permanent location. Github is a good idea if you understand or can learn how to use Git and don’t mind paying the monthly fee or having your backup publicly visible. It allows copies to very quickly be dropped into your MC worlds.

To create a new mod pack, just replace the contents of the files in the jaf_pack namespace to display the information you wish to be displayed.

To create a new mod, create your own namespace and put your files in them, keeping in mind that some will be called just once, others once per second and others every clock tick.

create the jaf_modX namespace, replacing X with the next available single digit number. Jaffle will try to call specific functions within this namespace. These include setup, tick0 … tick19, everytick and intro. These files should call the relevant files in your mod. You could just put your code in there, but then your mod wouldn’t have its own namespace.

Use the example modules in the Jaffle download to understand how the mod platform should be configured.

 

New Video – Riding Dolphins in MC!!

I put up a new video – just a short one, showing a few commands that let you ride dolphins in MC. I hope this doesn’t offend any dolphin lovers. It’s all just for fun.

(btw: to avoid animal cruelty in MC, always use a stone or better axe when killing livestock and use a critical hit,ie jump and strike. It gives a one hit kill for cows and pigs.)

[Edit – I changed the commands a bit to make them work better together. I removed some custom names because they were causing entities to interact (stick together) in the wrong way!]

The commands are:

Summon a dolphin carrying a minecart:
execute at @p run summon minecraft:dolphin ~ ~ ~ {Passengers:[{id:"minecraft:minecart"}]}

Summon a dolphin carrying a boat (doesn’t work because you can’t ride a boat under water):
execute at @p run summon minecraft:dolphin ~ ~ ~ {Passengers:[{id:"minecraft:boat"}]}

Summon a dolphin carrying a NoAI pig (also doesn’t work because dolphins can’t take mobs as passengers – I think they pop off when the dolphin goes underwater.).
execute at @p run summon minecraft:dolphin ~ ~ ~ {CustomName:"\"Pig Bearer\"",Passengers:[{id:"minecraft:pig",NoAI:1}]}

This is one that wasn’t in the vid: use a snowball between the pig and dolphin, give the pig water breathing and a saddle. It still doesn’t work, as I recall because you can’t ride the pig under water anyway.
execute at @p run summon minecraft:dolphin ~ ~ ~ {CustomName:"\"Pig Bearer\"",Passengers:[{id:"minecraft:item",Age:-32768,PickupDelay:32767,Item:{id:"minecraft:snowball",Count:1b},Passengers:[{id:"minecraft:pig",NoAI:1,ActiveEffects:[{Id:13b,Duration:1000000,ShowParticles:0}],Saddle:1}]}]}

Summon a dolphin carrying a skeleton horse via a snowball:
execute at @p run summon minecraft:dolphin ~ ~ ~ {CustomName:"\"Bone Bearer\"",Passengers:[{id:"minecraft:item",Age:-32768,PickupDelay:32767,Item:{id:"minecraft:snowball",Count:1b},Passengers:[{id:"minecraft:skeleton_horse",NoAI:1,Tame:1,Invulnerable:1b,SaddleItem:{id:"minecraft:saddle",Count:1b}}]}]}

The following commands are for my best solution:

Summon “Clarence”, the fake dolphin:
execute at @p run summon minecraft:dolphin ~ ~ ~ {CustomName:"\"Clarence\"",NoAI:1,Invulnerable:1}

Summon the invisible dolphin with the invisible skeleton horse:
skeleton horse passenger.
execute at @p run summon minecraft:dolphin ~ ~ ~ {CustomName:"\"RideableDolphin\"",ActiveEffects:[{Id:14b,Duration:1000000,ShowParticles:0}],Passengers:[{id:"minecraft:item",Age:-32768,PickupDelay:32767,Item:{id:"minecraft:snowball",Count:1b},Passengers:[{id:"minecraft:skeleton_horse",NoAI:1,ActiveEffects:[{Id:14b,Duration:1000000,ShowParticles:0}],Tame:1,Invulnerable:1b,SaddleItem:{id:"minecraft:saddle",Count:1b}}]}]}

These are the two commands that run in a command block chain

tp Clarence to the invisible dolphin (run in repeating command block):
tp @e[name=Clarence] @e[name=RideableDolphin,limit=1]

shift Clarence a bit higher so that it looks like it is just under the player (run in chained command block):
execute at @e[name=Clarence] run execute as @e[name=Clarence] run tp ~ ~1.3 ~

Hmm. Maybe I should wait before starting a Custom Terrain playthrough

I was browsing the 1.13 changes on minecraft.gamepedia.com because quite a few of the commands have changed. I came across this:

Customized world type
  • Removed

Yikes! and I spent hours making a video on it! I saw that customised terrain wasn’t in the snapshot and I had previously just assumed they hadn’t put it in yet.

Then I read:

Planned changes

  • World generation will become data-driven, using json files, allowing for custom structures.

Whew! But this statement seems a bit vague to me. Hopefully it means there will be new functionality  to allow customised terrain again via datapack customisation.

Anyway, I’m going to hold off on doing a serious playthrough on custom terrain until this is all sorted out.

Meanwhile I’ve started working on a python program that parses function mods to enhance non-interference between mods, obfuscate tags and score variables, and allow additional text formatting with whitespace characters. Once it’s done, (if 1.13 doesn’t implement all my improvements for me!) I’ll put it online so anyone can use it.

Has it been that long??

Did I really not post to this site since last August??

I guess I have been busy, what with:

  • Moving house
  • Some contract work that came up earlier this year
  • Dealing with some minor but troublesome health conditions
  • Working on the new house.

Anyway that’s mostly over. I have more contract work coming so I might be too busy soon, so I’d better post now before it gets too busy again.

I really wanted to post some video of me playing MC with my command pack and a custom preset, but couldn’t get around to it due to the above and because one of my health problems is a throat condition that made it hard to talk for long periods. I still want to do that though, but I also want to make sure my custom preset doesn’t prevent the new aquatic biomes from appearing.

I have, however, just purchased PixArk, available now on Steam. I’m looking forward to trying it out. It should be fun, especially multiplayer with another player.

Item Sorter Structure, updated for MC 1.12!

I’ve finally been able to update my item sorter structure for MC 1.12 and load it onto the Minestruck server. (minestruck.site11.com) The link is here:

http://minestruck.site11.com/view.php?id=88

Honestly  there’s not much particularly fun about this sorter structure. It’s meant to be used in custom maps out of sight of the player. Items go into the hopper at the top and come out the bottom in one of two chests depending on whether the item is the selected item (diamond by default). Signs on the structure let the user know how to use/customise it.

Make sure it is turned on before using, otherwise it might get clogged up inside.

I tried to make it efficient by adding commands that switch it off automatically when not in use.

Originally I made this structure for MC 1.11, but the command syntax has changed a bit since then (quotes are required for item names and list entry syntax requirements have also changed slightly)

Here’s an earlier demo video:

My first mod – Highway Maker

I have just (re)published my first mod on this website. (I published it previously when my website was hosted by Godaddy using their horrible Website Builder service. Now I’m used to WordPress I won’t be looking back!)

The mod is called Highway Maker. It allows the player to put high speed highways in their Minecraft world while playing a survival game. Unfortunately it only runs on MC 1.11, because I finished it quite some time ago and got distracted when MC 1.12 came out with functions.

Here is the link to the page.

Mods to come

I’ve just put together this site so I haven’t had time to publish the mods and structures I’ve done which are:

  1. an older mod for MC 1.11 which is my first mod. It lets you put down high speed highways in your MC world. It’s a bit clunky but works well enough.
  2. a sorter structure using command blocks. It separates out one specific item from other items in a chest. I think it’s broken in MC 1.12 but I might have fixed it. I can’t remember at the moment!
  3. a mod that protects valuable items in the game, that I originally put in a structure file as a set of command blocks and later put in a function pack.
  4. A mod that I combined with the valuable items protector, in a function pack which makes the player transition between three stages after death – ghost, glass body and real body. This is to give the player a little more motivation to stay alive even though their valuable items will be protected.

Education via Minecraft

First of all, I have to admit, Programming in Minecraft is a hobby of mine and I’ve been ‘into’ various aspects of Minecraft for probably about 4 years now, so I’m probably a bit biased when it comes to this topic.

But I really do think Minecraft has a lot to offer to kids who find it a nice change from the carefully produced and heavily scripted games from the big studios. Here are some ways kids can learn from Minecraft:

1. Working with numbers.

The items required to make a bookshelf are made from resources which must be gathered. How many of each resource are needed?

The game works by gathering resources which can then be used to make items and then sometimes those items can be crafted into other items. The calculations to work out how much of each resource will be needed to craft, for example, a bookshelf can get pretty complex.

Also Minecraft can be used as a way of factoring integers! If you have a certain number of blocks and you figure out a way of placing them to make a solid rectangular prism, you have just found three factors of the number of blocks! (hint-it’s the length of the sides)

(I’m working on a custom map where factoring numbers is built into the game. It’s still a long way from being completed, but hopefully one day…)

2. Creativity and role-play.

Minecraft builds are often attractive models built to resemble real world places.

Solo gameplay in Minecraft gets boring quickly unless you play with a bit of imagination and use some creativity.  If you are a parent, it’s a good idea to check what your child is up to in Minecraft. Are they creating? Are they persisting with developing a single world? The problem with a Mojang account is that they can end up spending there whole time on server mini-games and not appreciating the game as it was meant to be played.

A big part of Minecraft now is custom maps. Players can easily make their own maps. These are custom made worlds which usually have some kind of end goal. Minecraft provides a wide range of extra features for map makers, so maps can be made as simple or advanced as the designer wishes. Creating custom maps is one of the most creative activities I can think of, encompassing programming, storyline development, voice acting, computer art, and any number of media skills.

3. Programming

Command blocks used to be the only way of programming in Minecraft. Now Mojang has introduced functions, programming will be much easier.

Mojang are offering a web based graphical programming tutorial via code.org, but I don’t think it has a lot to offer kidsonce they reach senior primary school.

However Minecraft, as of version 1.12 in the Java version, now comes with a rudimentary programming language via something called functions. Also command blocks, which execute a single command at a time, have been around since version 1.4 and have gradually been improved and made increasingly more capable.

It is actually quite a lot harder to program in Minecraft than using a standard programming language, because many capabilities of structured programming are missing in Minecraft. Capabilities such as looping, branching and even passing parameters must be created by various tricks, often using in-game entities. On the other hand, Minecraft programs can execute many command simultaneously and be programmed with timing at the level of single clock ticks at 20 times per second. It reminds me somewhat of the FPGA programming I used to do when I was in the aerospace industry.

4. Engineering and Science

Many redstone contraptions are equivalent to simple digital electronic circuits.

This needs to be put in context. Minecraft presents the player with a virtual world with consistent rules that are only superficially similar to the real world. The player can use those rules to create an unlimited number of contraptions and inventions. However the rules are not always well documented and can vary between versions. Players often create experiments to check exactly how the rules work. Hence science!

It should be noted that Minecraft makes a poor substitute for the real world in many ways. The rules of Minecraft are too simplistic to present many of the real world challenges of our complex analog universe such as making precise measurements or dealing with subtle interactions between physical laws. Nevertheless, the ease of which a player can slip into science mode without even realise it in a Minecraft world makes it a valuable educational resource.

I’m fairly biased when it comes to Minecraft, but, with a bit of parental encouragement and supervision, I don’t think it needs to be a complete time-waster. We just need to make sure kids get plenty of real-world play as well.