Skip to content

Commit

Permalink
Serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Sep 4, 2024
1 parent fdbbc00 commit 8263dc1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/test/kotlin/net/mcbrawls/blueprint/test/BlueprintTest.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 8263dc1

Please sign in to comment.