From 8263dc1b09945c60237759da1938cbc26b460b5d Mon Sep 17 00:00:00 2001 From: Daniel Orr Date: Wed, 4 Sep 2024 21:37:33 +0100 Subject: [PATCH] Serialization test --- .../net/mcbrawls/blueprint/test/BlueprintTest.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/net/mcbrawls/blueprint/test/BlueprintTest.kt b/src/test/kotlin/net/mcbrawls/blueprint/test/BlueprintTest.kt index bbde79b..96705aa 100644 --- a/src/test/kotlin/net/mcbrawls/blueprint/test/BlueprintTest.kt +++ b/src/test/kotlin/net/mcbrawls/blueprint/test/BlueprintTest.kt @@ -1,16 +1,22 @@ package net.mcbrawls.blueprint.test -import dev.andante.audience.AudienceInitializer.server +import dev.andante.codex.encodeQuick import net.fabricmc.api.ModInitializer import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents import net.mcbrawls.blueprint.BlueprintMod +import net.mcbrawls.blueprint.region.CuboidRegion +import net.mcbrawls.blueprint.region.PointRegion import net.mcbrawls.blueprint.resource.BlueprintManager +import net.mcbrawls.blueprint.structure.Blueprint import net.mcbrawls.blueprint.structure.ProgressProvider +import net.minecraft.nbt.NbtOps import net.minecraft.server.command.CommandManager import net.minecraft.text.Text import net.minecraft.util.Identifier import net.minecraft.util.math.BlockPos +import net.minecraft.util.math.Vec3d +import net.minecraft.util.math.Vec3i object BlueprintTest : ModInitializer { private var displayedProgress: ProgressProvider? = null @@ -20,6 +26,9 @@ object BlueprintTest : ModInitializer { dispatcher.register( CommandManager.literal("blueprint-test") .executes { context -> + val b = Blueprint(emptyList(), emptyList(), emptyMap(), Vec3i.ZERO, mapOf("point" to PointRegion(Vec3d.ZERO), "cuboid" to CuboidRegion(Vec3d.ZERO, Vec3d.ZERO))) + println(Blueprint.CODEC.encodeQuick(NbtOps.INSTANCE, b)) + val pos = context.source.position val blockPos = BlockPos.ofFloored(pos) val (future, progress) = BlueprintManager[Identifier.of(BlueprintMod.MOD_ID, "test")]!!.placeWithProgress(context.source.world, blockPos)