Skip to content

Commit

Permalink
Update dependencies + remove blueprint editors
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Sep 30, 2024
1 parent dfa53c2 commit 82e24c5
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 332 deletions.
10 changes: 1 addition & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//file:noinspection All

plugins {
id "fabric-loom" version "1.6-SNAPSHOT"
id "fabric-loom" version "1.7-SNAPSHOT"
id "org.jetbrains.kotlin.jvm"
id "maven-publish"
}
Expand Down Expand Up @@ -55,16 +55,8 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"
modImplementation "net.fabricmc:fabric-language-kotlin:$fabric_kotlin_version"

include modImplementation ("xyz.nucleoid:fantasy:$fantasy_version")

include modImplementation ("dev.andante:audience:$audience_version")
include modImplementation ("dev.andante:codex:$codex_version")

include modImplementation ("eu.pb4:sgui:$sgui_version")
include modImplementation ("net.mcbrawls:brawls-sgui:$brawls_sgui_version")

modImplementation "com.ptsmods:devlogin:$devlogin_version"

// test
testImplementation sourceSets.main.output
testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:2.21.1"
Expand Down
19 changes: 6 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,20 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_build=7
loader_version=0.15.11
minecraft_version=1.21.1
yarn_build=3
loader_version=0.16.5

# Mod Properties
mod_version=1.8.0
mod_version=1.9.0
maven_group=net.mcbrawls
mod_id=blueprint

# Dependencies
fabric_version=0.100.4+1.21
fabric_version=0.105.0+1.21.1

kotlin_version=1.9.24
fabric_kotlin_version=1.10.20+kotlin.1.9.24

devlogin_version=3.5

fantasy_version=0.6.3+1.21

audience_version=2.5.0
codex_version=1.5.0
brawls_sgui_version=1.1.1

sgui_version=1.5.1+1.20.5
sgui_version=1.6.1+1.21.1
4 changes: 0 additions & 4 deletions src/main/kotlin/net/mcbrawls/blueprint/BlueprintMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking
import net.fabricmc.fabric.api.resource.ResourceManagerHelper
import net.mcbrawls.blueprint.command.BlueprintCommand
import net.mcbrawls.blueprint.editor.BlueprintEditors
import net.mcbrawls.blueprint.network.BlueprintConfigC2SPacket
import net.mcbrawls.blueprint.player.BlueprintPlayerData.Companion.blueprintData
import net.mcbrawls.blueprint.resource.BlueprintManager
Expand All @@ -27,9 +26,6 @@ object BlueprintMod : ModInitializer {
override fun onInitialize() {
logger.info("Initializing $MOD_NAME")

// initialize classes
BlueprintEditors

// register config packet receiver
PayloadTypeRegistry.playC2S().register(BlueprintConfigC2SPacket.PACKET_ID, BlueprintConfigC2SPacket.PACKET_CODEC)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package net.mcbrawls.blueprint.command
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
import dev.andante.codex.encodeQuick
import net.fabricmc.loader.api.FabricLoader
import net.fabricmc.loader.api.ModContainer
Expand All @@ -12,14 +11,10 @@ import net.fabricmc.loader.api.metadata.ModMetadata
import net.mcbrawls.blueprint.BlueprintMod
import net.mcbrawls.blueprint.BlueprintMod.MOD_NAME
import net.mcbrawls.blueprint.asExtremeties
import net.mcbrawls.blueprint.editor.BlueprintEditorEnvironment
import net.mcbrawls.blueprint.editor.BlueprintEditorGui
import net.mcbrawls.blueprint.editor.BlueprintEditors
import net.mcbrawls.blueprint.resource.BlueprintManager
import net.mcbrawls.blueprint.structure.Blueprint
import net.mcbrawls.blueprint.structure.BlueprintBlockEntity
import net.mcbrawls.blueprint.structure.PalettedState
import net.mcbrawls.sgui.openGui
import net.minecraft.block.BlockState
import net.minecraft.command.argument.BlockPosArgumentType
import net.minecraft.command.argument.IdentifierArgumentType
Expand All @@ -33,8 +28,6 @@ import net.minecraft.text.Text
import net.minecraft.util.Formatting
import net.minecraft.util.math.BlockBox
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec2f
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.Vec3i
import java.nio.file.Path

Expand All @@ -44,8 +37,6 @@ object BlueprintCommand {
const val START_POSITION_KEY = "start_position"
const val END_POSITION_KEY = "end_position"

private val NOT_IN_EDITOR_ENVIRONMENT_EXCEPTION_TYPE = SimpleCommandExceptionType { "This command must be run in an editor environment" }
private val ALREADY_IN_EDITOR_ENVIRONMENT_EXCEPTION_TYPE = SimpleCommandExceptionType { "You are already in this editor environment" }
private val INVALID_BLUEPRINT_EXCEPTION_TYPE = DynamicCommandExceptionType { id -> Text.literal("There is no blueprint with id \"$id\"") }

fun register(dispatcher: CommandDispatcher<ServerCommandSource>) {
Expand Down Expand Up @@ -77,31 +68,7 @@ object BlueprintCommand {
.executes(::executePlace)
)
)
).apply {
if (FabricLoader.getInstance().isDevelopmentEnvironment) {
then(
literal("editor")
.then(
literal("open")
.then(
argument(BLUEPRINT_KEY, IdentifierArgumentType.identifier())
.suggests { _, suggestions -> BlueprintManager.suggestBlueprints(suggestions) }
.executes(::executeEditorOpen)
)
)
.then(
literal("close")
.requires(::isEditorEnvironment)
.executes(::executeEditorClose)
)
.then(
literal("toolset")
.requires(::isEditorEnvironment)
.executes(::executeEditorToolset)
)
)
}
}
)
)
}

Expand Down Expand Up @@ -187,10 +154,6 @@ object BlueprintCommand {
return 1
}

private fun isEditorEnvironment(source: ServerCommandSource): Boolean {
return source.world is BlueprintEditorEnvironment
}

private fun execute(context: CommandContext<ServerCommandSource>): Int {
// retrieve version
val loader = FabricLoader.getInstance()
Expand All @@ -205,48 +168,4 @@ object BlueprintCommand {
context.source.sendFeedback({ Text.literal("[$MOD_NAME] Version $version").formatted(Formatting.AQUA) }, false)
return 1
}

private fun executeEditorOpen(context: CommandContext<ServerCommandSource>): Int {
val source = context.source
val player = source.playerOrThrow

val blueprintId = IdentifierArgumentType.getIdentifier(context, BLUEPRINT_KEY)
val environmentManager = BlueprintEditors[source.server]
val environment = environmentManager[blueprintId]

if (player.world !== environment) {
player.teleport(environment, Vec3d.ofBottomCenter(BlueprintEditorEnvironment.ROOT_POSITION), Vec2f.ZERO)
source.sendFeedback({ Text.literal("Opened editor environment \"$blueprintId\"") }, false)
} else {
throw ALREADY_IN_EDITOR_ENVIRONMENT_EXCEPTION_TYPE.create()
}

return 1
}

private fun executeEditorClose(context: CommandContext<ServerCommandSource>): Int {
val source = context.source
val server = source.server

val world = source.world
if (world !is BlueprintEditorEnvironment) {
throw NOT_IN_EDITOR_ENVIRONMENT_EXCEPTION_TYPE.create()
}

val blueprintId = world.blueprintId
val editors = BlueprintEditors[server]
val editorEnvironment = editors.getNullable(blueprintId)
?: throw IllegalStateException("Editor environment was somehow null")

editors.remove(editorEnvironment)
source.sendFeedback({ Text.literal("Closed editor environment \"$blueprintId\"") }, false)

return 1
}

private fun executeEditorToolset(context: CommandContext<ServerCommandSource>): Int {
val player = context.source.playerOrThrow
player.openGui(::BlueprintEditorGui)
return 1
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 82e24c5

Please sign in to comment.