Skip to content

Instantly share code, notes, and snippets.

View mworzala's full-sized avatar
👾

Matt Worzala mworzala

👾
View GitHub Profile
package net.hollowcube.common.util.dfu;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.*;
import net.kyori.adventure.nbt.*;
import org.jetbrains.annotations.Nullable;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

Minestom 1.21.4

Finally we merge the 1.21.4 branch which has been usable since the version came out but slow to merge for a variety of reasons. Thanks to all who tested the in-progress branch :)

NamespaceID Removal

The Minestom NamespaceID class has been removed. Adventure has Key which fills the same purpose, so we now use Key everywhere. Methods including namespace such as Material#fromNamespaceId have been renamed to Material#fromKey.

This will be a big search and replace for most projects, apologies for the extra work but better to do it sooner than later.

Pick Block

package net.hollowcube.mapmaker.map.item.vanilla;
import net.hollowcube.common.util.BlockUtil;
import net.hollowcube.mapmaker.map.item.handler.ItemHandler;
import net.hollowcube.mapmaker.map.util.GenericTempActionBarProvider;
import net.hollowcube.mapmaker.to_be_refactored.ActionBar;
import net.minestom.server.entity.Player;
import net.minestom.server.instance.block.Block;
import net.minestom.server.item.Material;
import net.minestom.server.tag.Tag;

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;