diff options
author | Linnea Gräf <nea@nea.moe> | 2025-03-22 11:27:03 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-03-22 11:40:33 +0100 |
commit | 588f8bbb8217daa05b2c3e756601a3bcf60113ed (patch) | |
tree | fe13538e34577f9bd2e6c44acd916b5819de8c3a /src/main/kotlin/util/mc/asFakeServer.kt | |
parent | aa327dcfd0bb09b42ca28dbfd9361ca9340351d6 (diff) | |
download | Firmament-588f8bbb8217daa05b2c3e756601a3bcf60113ed.tar.gz Firmament-588f8bbb8217daa05b2c3e756601a3bcf60113ed.tar.bz2 Firmament-588f8bbb8217daa05b2c3e756601a3bcf60113ed.zip |
refactor: Split waypoint classes
Diffstat (limited to 'src/main/kotlin/util/mc/asFakeServer.kt')
-rw-r--r-- | src/main/kotlin/util/mc/asFakeServer.kt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/kotlin/util/mc/asFakeServer.kt b/src/main/kotlin/util/mc/asFakeServer.kt new file mode 100644 index 0000000..d3811bd --- /dev/null +++ b/src/main/kotlin/util/mc/asFakeServer.kt @@ -0,0 +1,37 @@ +package moe.nea.firmament.util.mc + +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource +import net.minecraft.server.command.CommandOutput +import net.minecraft.server.command.ServerCommandSource +import net.minecraft.text.Text + +fun FabricClientCommandSource.asFakeServer(): ServerCommandSource { + val source = this + return ServerCommandSource( + object : CommandOutput { + override fun sendMessage(message: Text?) { + source.player.sendMessage(message, false) + } + + override fun shouldReceiveFeedback(): Boolean { + return true + } + + override fun shouldTrackOutput(): Boolean { + return true + } + + override fun shouldBroadcastConsoleToOps(): Boolean { + return true + } + }, + source.position, + source.rotation, + null, + 0, + "FakeServerCommandSource", + Text.literal("FakeServerCommandSource"), + null, + source.player + ) +} |