Skip to content

Instantly share code, notes, and snippets.

View mworzala's full-sized avatar
👾

Matt Worzala mworzala

👾
View GitHub Profile
const minDate = new Date(2025, 6, 9).getTime();
const maxDate = new Date(2025, 6, 19).getTime();
const resources = []
const events = []
for (let i = 0; i < 1000; i++) {
resources.push({id: `${i}`, title: `Item ${i}`});
for (let j = 0; j < 100; j++) {
const start = new Date(Math.random() * (maxDate - minDate) + minDate)
const startString = start.toISOString();
public void handlePickBlock(@NotNull PlayerPickBlockEvent event) {
var player = event.getPlayer();
if (player.getGameMode() != GameMode.CREATIVE) return; // Sanity
var world = MapWorld.forPlayerOptional(player);
if (world == null || !world.canEdit(player)) return; // Sanity
// First try to get the block from the item registry
var block = event.getBlock();
var itemStack = world.itemRegistry().getItemStack(block, event.isIncludeData());
public class BouncePadBlock implements BlockHandler, PressurePlateBlockMixin, DebugCommand.BlockDebug {
private static final Key KEY = Key.key("mapmaker:bounce_pad");
private static final Tag<BouncePadData> DATA_TAG = DFU.View(BouncePadData.CODEC);
public static final ItemHandler ITEM = new BlockItemHandler(BouncePadBlock::new,
Block.CHERRY_PRESSURE_PLATE, "bounce_pad");
private final Set<Player> playersOnPlate = new HashSet<>();
@Override

Minestom 1.21.5

The 1.21.5 branch has now been merged, thanks to all who tested it!

Inventory Rework

Inventory event processing has been reworked somewhat in this version. The InventoryCondition API has been removed entirely in favor of InventoryPreClickEvent.

Click information in InventoryPreClickEvent has been condensed into the new Click union. It is suggested to structure these checks using switch statements, eg:

switch (event.getClick()) {
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)