Skip to content

Instantly share code, notes, and snippets.

View mworzala's full-sized avatar
👾

Matt Worzala mworzala

👾
View GitHub Profile

Minestom 1.21.3 (and 1.21.2)

Finally we merge the 1.21.2/3 branch which has been usable since the version came out but missing the last few changes for over a month! Thanks to all who tested the in-progress branch :)

Permissions

The Minestom permission system has been removed in its entirety. The system was not very flexible or compatible with existing standards (ie LuckPerms, basic rank enum). We made the decision to remove the system and force libraries to provide their own API for testing and modifying permissions as opposed to attempting to create an overly generic API to accommodate all use cases.

See #2302.

Networking Rework

@mworzala
mworzala / Vector$idl.java
Created November 17, 2024 17:31
idlc vector compilation
// GENERATED FROM IDL FILE. DO NOT MODIFY.
package net.hollowcube.mapmaker.scripting.api.math;
import net.hollowcube.luau.LuaState;
final class Vector$idl {
private static int __eq$vector(LuaState state) {
var result = Vector.__eq(state);
state.pushBoolean(result);
return 1;
export type Vec2 = {
x: number,
y: number,
}
-- METADATA
declare function javaClass(name: string)
package net.hollowcube.mapmaker.map.entity.impl.living;
import net.hollowcube.mapmaker.map.MapWorld;
import net.hollowcube.mapmaker.map.entity.MapEntity;
import net.kyori.adventure.nbt.CompoundBinaryTag;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.metadata.other.ArmorStandMeta;
import net.minestom.server.sound.SoundEvent;
import org.jetbrains.annotations.NotNull;
local player = script.Parent
local world = player.World
BRIDGE_MIN = vec(16, 45, -51)
BRIDGE_MAX = vec(27, 45, -47)
PLAYER_BB_OFFSETS = {
vec(-0.3, 0, -0.3),
vec(0.3, 0, -0.3),
vec(-0.3, 0, 0.3),

Minestom 1.21

As usual we have some breaking changes along with a Minecraft release. In this case the changes are centered around the new dynamic Enchantment registry, and some further tweaks to dynamic registries as we refine support for those.

Dynamic Registry Changes

The (I think) most notable change to existing logic is a change to how dynamic registry values are named. Historically they keep their namespace ID inside themselves (eg Biome#namespace). These methods are now gone, instead, the ID is set while registering the object.

// Old
DimensionType helloWorld = DimensionType.builder("hello:world").build();
package net.hollowcube.mapmaker.map.block.placement;
import net.hollowcube.mapmaker.map.block.BlockTags;
import net.minestom.server.coordinate.Point;
import net.minestom.server.coordinate.Pos;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.instance.block.Block;
import net.minestom.server.instance.block.BlockFace;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
package net.hollowcube.mapmaker.map.entity.impl;
import net.hollowcube.mapmaker.map.entity.MapEntity;
import net.hollowcube.mapmaker.map.util.NbtUtil;
import net.kyori.adventure.nbt.*;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.metadata.display.AbstractDisplayMeta;
import net.minestom.server.entity.metadata.display.BlockDisplayMeta;

Minestom 1.20.6

The 1.20.6 update for Minestom comes (as usual) with some breaking changes both from the protocol and api improvements for the library. The major changes are as follows:

  1. Hephaistos removed in favor of Adventure NBT.
  2. Item components
  3. Pathfinding
  4. Dynamic registry improvements

Note about inventory rework

The Inventory Rework PR was previously part of the 1.20.5 branch. It is in the middle of a rework, and is not quite ready for this version. We are still planning to include it in a later version (most likely 1.21.1). If you already updated and have to revert, sorry for the trouble!

import java.lang.foreign.*;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Throwable {
try (Arena arena = Arena.ofShared()) {
SymbolLookup vmSymbols = SymbolLookup.libraryLookup(Path.of("libLuau.VM.dylib"), arena);
SymbolLookup compilerSymbols = SymbolLookup.libraryLookup(Path.of("libLuau.Compiler.dylib"), arena);