Skip to content

Instantly share code, notes, and snippets.

View mworzala's full-sized avatar
👾

Matt Worzala mworzala

👾
View GitHub Profile
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);
public class MapAlterCommand {
private final Argument<MapData> mapArg;
private final Argument<String> nameArg = Argument.GreedyString("name")
.description("The new name for the map");
private final Argument<Material> displayItemArg = Argument.Material("item")
.description("The new display item for the map");
private final Argument<String> subvariantArg;
private final Argument<MapSize> sizeArg = Argument.Enum("size", MapSize.class)
.description("The new world border size for the map");
package net.hollowcube.mapmaker.backpack;
import net.kyori.adventure.key.Key;
import net.minestom.server.item.ItemComponent;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
package net.hollowcube.mapmaker.map.command.utility;
import com.google.inject.Inject;
import net.hollowcube.command.CommandContext;
import net.hollowcube.command.dsl.CommandDsl;
import net.hollowcube.mapmaker.map.block.vanilla.DripleafBlock;
import net.hollowcube.mapmaker.perm.PermManager;
import net.hollowcube.mapmaker.perm.PlatformPerm;
import net.minestom.server.entity.Player;
import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextDecoration;
import net.minestom.server.utils.StringUtils;
import java.util.*;
public class ComponentWrapper {
package net.hollowcube.mapmaker.map.gui;
import net.hollowcube.canvas.Switch;
import net.hollowcube.canvas.Text;
import net.hollowcube.canvas.View;
import net.hollowcube.canvas.annotation.Action;
import net.hollowcube.canvas.annotation.ContextObject;
import net.hollowcube.canvas.annotation.Outlet;
import net.hollowcube.canvas.internal.Context;
import net.hollowcube.common.util.FutureUtil;
public class BigDripleafPlacementRule extends FacingHorizontalPlacementRule {
private static final String PROP_FACING = "facing";
public BigDripleafPlacementRule(@NotNull Block block) {
super(block, true);
}
@Override
public @NotNull Block blockUpdate(@NotNull UpdateState updateState) {
var currentBlock = updateState.currentBlock();
package net.hollowcube.mapmaker.util;
import net.minestom.server.instance.Chunk;
import net.minestom.server.instance.IChunkLoader;
import net.minestom.server.instance.Instance;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.CompletableFuture;