Skip to content

Instantly share code, notes, and snippets.

Minecraft commands benchmarks

Each test ranks a list of possible commands from best (most efficient) to worst (least efficient). Lower percentages are better. You can only compare the percentages between the commands in the same test.

These tests were done in a superflat world with no entities except for the player. The only commands running are the ones from the test.

1 Running commands for every player

1.1 All players

  • MinecraftServer::tickServer
    • ServerFunctionManager::tick
      • Run command functions
        • Trigger inventory_changed (loot, give, clear commands)
        • Trigger recipe_unlocked (recipe command)
        • Trigger effects_changed (effect command)
        • Trigger changed_dimension (teleport command)
    • ServerLevel::tick (per dimension)
      • ServerLevel::tickTime (overworld only)
  • Increment game time

Custom data pack structures in 1.18.2

This guide will showcase how to create a data pack that adds a custom structure to the world. There is also a data pack download of this complete example.

Always leave the world and rejoin to apply the new changes!

⚠️ This guide has moved ⚠️

Updates for both 1.18.2 and 1.19 can be found at https://misode.github.io/guides/adding-custom-structures/

Pack.mcmeta

Critical

  • MC-215946 Game fatally crashed while exploring chunks (PalettedContainer)
  • MC-197860 Deleting a custom dimension in a datapack deletes Nether and End
  • MC-202036 Adding a biome to a datapack shifts biome IDs in existing chunks

Missing features

  • MC-197128 If a custom biome uses multiple configured structure features of the same type, only one of them can generate
  • MC-186626 /weather not working in custom dimensions
  • MC-195717 Custom Dimensions JSON Requires Seed
  • MC-226687 Sea Level is assumed to be Y 63 in numerous parts of Minecraft

Quality of life

Optimizing and code-splitting

I decided to investigate the bundle size for misode.github.io and was quite shocked. After code splitting and tree shaking I managed to get the total JS output size from 5.22MB down to 3.95MB, and the main entrypoint from 4.53MB down to 703KB.

Initial bundle

The initial bundle was 5.22MB, with the main chunk 4.53MB (the red part). The only chunks split up were the different languages localizations. image

Remove unused highlight.js languages

One of the first things I noticed was that highlight.js included a bunch of languages, while I'm only using JSON. This eliminated 1.35MB. image

@misode
misode / full_noise.jsonc
Last active February 16, 2022 23:09
Density functions in 22w07a
{
"type": "min",
"input_1": {
"type": "squeeze",
"input": {
"type": "mul",
"input_1": {
"type": "interpolated",
"input": {
"type": "blend",
@misode
misode / invisible_minecarts.mcfunction
Last active February 9, 2022 04:40
Functions and entity_type tags required for invisible minecarts
data merge entity @s[type=minecart] {CustomDisplayTile:1,DisplayState:{Name:"minecraft:command_block",Properties:{conditional:"true",facing:"down"}},DisplayOffset:4}
data merge entity @s[type=chest_minecart] {CustomDisplayTile:1,DisplayState:{Name:"minecraft:command_block",Properties:{conditional:"true",facing:"up"}},DisplayOffset:4}
data merge entity @s[type=furnace_minecart] {CustomDisplayTile:1,DisplayState:{Name:"minecraft:command_block",Properties:{conditional:"true",facing:"north"}},DisplayOffset:4}
data merge entity @s[type=tnt_minecart] {CustomDisplayTile:1,DisplayState:{Name:"minecraft:command_block",Properties:{conditional:"true",facing:"south"}},DisplayOffset:4}
data merge entity @s[type=hopper_minecart] {CustomDisplayTile:1,DisplayState:{Name:"minecraft:command_block",Properties:{conditional:"true",facing:"west"}},DisplayOffset:4}
tag @s add invisible_minecart