BTS #1

Hello everyone, welcome to the first post of behind the scenes. I left this post to the 2nd of April for obvious reasons.

Crafting Emulator v2

I’ve been working on a new version of our crafting emulator. Built from scratch. The original crafting emulator was a tool that emulates (or at least tried to emulate) the feel and functionality of the crafting table by allowing you to place ingredients on a 3×3 grid and have a result item that you could obtain.

The image above shows the interface you’d interact with when crafting an item. The only difference is that you could only craft custom recipes we had made. It works mostly as intended with a weird hitch that plagues this and some other GUIs (Graphical User Interfaces). The hitch being sometimes the server would not allow you to place or pick up items. Odd behaviour right?

The Problem

A lot of plugins I see on spigot claim to have the functionality of ‘custom recipes’, but this boils mostly down to custom recipes using vanilla items. As soon as you want to make a recipe using a custom item, by giving it metadata or additional tags, you can’t. Minecraft has never needed to check for all these factors when checking for a compatible recipe. By placing items into the default crafting table, Minecraft will only compare material types and nothing more. This is a big problem if you want to compare based on material type and other tags or metadata that the item has.

The Solution

Crafting emulator v2 does away with the custom GUI and uses the original crafting table. It’s more intuitive for even newbies as you don’t require any prior knowledge to shift-left click on the table to access the special GUI and combining all crafting into one menu that anyone who has played Minecraft is familiar with.

To prevent Minecraft from doing its usual recipe checking by material type, crafting emulator v2 removes that responsibility from Minecraft and emulates all of its recipes. Below are some small clips of it in action. Remember, these are all emulated, the server now handles crafting instead of the game.

Shapeless Recipes

Shapeless recipes are recipes that only require a set of ingredients but don’t care about where they are placed on the crafting grid.

Shaped Recipe

Shaped recipes are recipes that are adamant about how the ingredients are placed on the crafting grid.

In addition to supporting shapeless and shaped recipes, crafting emulator v2 also supports multiple item amounts of a type in the same slot. As shown below, a hypothetical recipe where an anvil is made ludicrously expensive by requiring 128 iron ingots (32 in each of the 4 slots). The recipe only shows the anvil in the result slot when all 128 ingots are present along with its iron blocks.

Crafting emulator v2 functions just like the default Minecraft crafting (with an added bonus). It’s just as fast at finding recipes if not faster, supports multiple items per slot, and will allow custom recipes using custom items without recipe clashing. At the time of writing, only vanilla shaped and shapeless recipes are supported. The next set of tests involve attempting to implement custom recipes using custom items. We may expand the emulator to emulate other vanilla recipes like furnaces, brewing stands, and maybe stone cutting.

Before going on this adventure of building crafting emulator v2, I ran a quick scan of every type of recipe in Minecraft.

Type: minecraft:campfire_cooking - 9
Type: minecraft:crafting_special_firework_star_fade - 1
Type: minecraft:crafting_shaped - 491
Type: minecraft:smithing - 9
Type: minecraft:crafting_special_repairitem - 1
Type: minecraft:crafting_special_bannerduplicate - 1
Type: minecraft:crafting_special_firework_rocket - 1
Type: minecraft:crafting_special_shielddecoration - 1
Type: minecraft:crafting_shapeless - 143
Type: minecraft:smelting - 53
Type: minecraft:crafting_special_tippedarrow - 1
Type: minecraft:crafting_special_armordye - 1
Type: minecraft:crafting_special_mapcloning - 1
Type: minecraft:stonecutting - 121
Type: minecraft:blasting - 11
Type: minecraft:crafting_special_shulkerboxcoloring - 1
Type: minecraft:crafting_special_mapextending - 1
Type: minecraft:crafting_special_suspiciousstew - 1
Type: minecraft:smoking - 9
Type: minecraft:crafting_special_firework_star - 1
Type: minecraft:crafting_special_bookcloning - 1

As of Minecraft 1.16.4, there are over 491 shaped recipes and 143 shapeless recipes. Out of the 859 recipes, 634 of them have been successfully emulated. How did I manage to get the server to find the correct recipe so fast? Well, that’s a trade secret 🙂 I’ll just say through some clever logic tricks.

Crafting emulator v2 is due to come out with Core 0.6.0, the summer update.

Final notes

Some other things I’ve been doing are finishing up the AbyssGUI framework (our lightweight internal GUI framework). Behold glorious RGB backgrounds!

I’ve also looked into seeing if I could make combat feel a bit more responsive. When you’re hit by a mob or a player, the server gives you god mode for about 1 second (1 second is 20 ticks). After this time has expired you can be hit again. I never liked this limitation as it felt like the server couldn’t handle registering the player’s many hits. Below is a small clip of an experiment. It pictures me reducing this god mode from 20 ticks down to 0. I am able to hit the zombie so quickly that it dies in a few seconds.

I would not actually remove this god mode timer altogether as it would prove a serious problem if you could get KO’d in a matter of milliseconds by people with fast jitter clicking. At most I’d halve it. Keeping it at 10. It already feels a lot better.

There is not a lot of BTS news from other people this month. There has been a lot of lore discussion around Athendria, Yuki (one of our developers) is working on the new questing system for Athendria, and Nyx (one of our operators) is planning to do some network upgrades coming this summer.

That’s all for BTS this month, thank you for reading!