chore: renamed to Gimbal, because I cannot spell apparently

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2024-04-29 15:08:02 +02:00
parent 1c7138bb58
commit c14cdffeed
Signed by: moonleay
GPG key ID: 82667543CCD715FB
50 changed files with 322 additions and 279 deletions

View file

@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
Gimble Gimbal
Copyright (C) 2024 moonleay Copyright (C) 2024 moonleay
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
Gimble Copyright (C) 2024 moonleay Gimbal Copyright (C) 2024 moonleay
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.

View file

@ -1,4 +1,4 @@
# The Gimble project # The Gimbal project
This project aims to improve the experience of creating structures in Minecraft. This project aims to improve the experience of creating structures in Minecraft.
## Features ## Features

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -30,7 +30,7 @@ plugins {
} }
val mavenVersion = System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" } val mavenVersion = System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
?: "0.1.0-dev" //""0.0.0-SNAPSHOT" ?: "0.1.1-dev" //""0.0.0-SNAPSHOT"
val modId: String by project val modId: String by project
val modName: String by project val modName: String by project

View file

@ -1,5 +1,5 @@
# #
# Gimble # Gimbal
# Copyright (C) 2024 moonleay # Copyright (C) 2024 moonleay
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -24,13 +24,13 @@ fabric.api.version=0.77.0+1.19.2
yarn.version=1.19.2+build.28 yarn.version=1.19.2+build.28
idea-ext.version=1.1.6 idea-ext.version=1.1.6
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
modId=gimble modId=gimbal
kotlinx.serialization.version=1.6.2 kotlinx.serialization.version=1.6.2
fabric.kotlin.version=1.10.18+kotlin.1.9.22 fabric.kotlin.version=1.10.18+kotlin.1.9.22
mavenGroup=net.moonleay mavenGroup=net.moonleay
kotlin.code.style=official kotlin.code.style=official
minecraft.version=1.19.2 minecraft.version=1.19.2
modName=Gimble modName=Gimbal
#fabric.loader.version=0.15.10 #fabric.loader.version=0.15.10
mavenArtifact=gimble mavenArtifact=gimbal
fabric.loader.version=0.14.0 fabric.loader.version=0.14.0

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,22 +16,22 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble package net.moonleay.gimbal
import net.fabricmc.api.ModInitializer import net.fabricmc.api.ModInitializer
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
import net.moonleay.gimble.networking.GimbleServer import net.moonleay.gimbal.networking.GimbalServer
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
internal object Main : ModInitializer { internal object Main : ModInitializer {
private val LOGGER = LogManager.getLogger(BuildConstants.modName) private val LOGGER = LogManager.getLogger(BuildConstants.modName)
override fun onInitialize() { override fun onInitialize() {
LOGGER.info("Initializing Gimble on the common side...") LOGGER.info("Initializing Gimbal on the common side...")
LOGGER.info("Registering packets...") LOGGER.info("Registering packets...")
GimbleServer.registerPacketHandler() GimbalServer.registerPacketHandler()
LOGGER.info("Packets have been registered.") LOGGER.info("Packets have been registered.")
LOGGER.info("Gimble has been initialized on the common side.") LOGGER.info("Gimbal has been initialized on the common side.")
LOGGER.info("${BuildConstants.modName} (${BuildConstants.modId}) v.${BuildConstants.modVersion} by moonleay") LOGGER.info("${BuildConstants.modName} (${BuildConstants.modId}) v.${BuildConstants.modVersion} by moonleay")
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client package net.moonleay.gimbal.client
import net.fabricmc.api.ClientModInitializer import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
import net.moonleay.gimble.client.keybindings.KeybindingManager import net.moonleay.gimbal.client.keybindings.KeybindingManager
import net.moonleay.gimble.client.keybindings.KeybindingRegistrar import net.moonleay.gimbal.client.keybindings.KeybindingRegistrar
import net.moonleay.gimble.networking.GimbleClient import net.moonleay.gimbal.networking.GimbalClient
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
internal object ClientMain : ClientModInitializer { internal object ClientMain : ClientModInitializer {
@ -31,13 +31,13 @@ internal object ClientMain : ClientModInitializer {
override fun onInitializeClient() { override fun onInitializeClient() {
LOGGER.info("Initializing Gimble on the client side...") LOGGER.info("Initializing Gimbal on the client side...")
KeybindingRegistrar.registerKeybindings() KeybindingRegistrar.registerKeybindings()
registerEvents() registerEvents()
LOGGER.info("Registering packets...") LOGGER.info("Registering packets...")
GimbleClient.registerPacketHandlers() GimbalClient.registerPacketHandlers()
LOGGER.info("Packets have been registered.") LOGGER.info("Packets have been registered.")
LOGGER.info("Gimble has been initialized on the client side.") LOGGER.info("Gimbal has been initialized on the client side.")
} }
private fun registerEvents() { private fun registerEvents() {

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,23 +16,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.editor package net.moonleay.gimbal.client.editor
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.text.Text import net.minecraft.text.Text
import net.moonleay.gimble.client.util.ChatUtil import net.moonleay.gimbal.client.util.ChatUtil
import net.moonleay.gimble.editor.ServerEditorManager import net.moonleay.gimbal.editor.ServerEditorManager
import net.moonleay.gimble.editor.state.EditorState import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimble.editor.state.GimblePolicyType import net.moonleay.gimbal.editor.state.GimbalPolicyType
import net.moonleay.gimble.editor.state.mode.Capability import net.moonleay.gimbal.editor.state.mode.Capability
import net.moonleay.gimble.editor.state.mode.Mode import net.moonleay.gimbal.editor.state.mode.Mode
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
import net.moonleay.gimble.editor.util.EditorUtil import net.moonleay.gimbal.editor.util.EditorUtil
import net.moonleay.gimble.editor.util.GimblePolicy import net.moonleay.gimbal.editor.util.GimbalPolicy
import net.moonleay.gimble.networking.GimbleClient import net.moonleay.gimbal.networking.GimbalClient
object ClientEditor { object ClientEditor {
private var POLICY = GimblePolicyType.NOT_PRESENT private var POLICY = GimbalPolicyType.NOT_PRESENT
private var CURRENT_MODE = Mode.NORMAL private var CURRENT_MODE = Mode.NORMAL
private var TEMP_DISABLED_MODE = Mode.UNKNOWN private var TEMP_DISABLED_MODE = Mode.UNKNOWN
@ -44,35 +44,51 @@ object ClientEditor {
fun onConnectedToNewWorld() { fun onConnectedToNewWorld() {
POLICY = GimblePolicyType.NOT_PRESENT POLICY = GimbalPolicyType.NOT_PRESENT
GimbleClient.checkIfServerHasGimble(EditorState(CURRENT_MODE, CURRENT_MODE_MODIFIER)) GimbalClient.checkIfServerHasGimble(
EditorState(
CURRENT_MODE,
CURRENT_MODE_MODIFIER
)
)
if (TEMP_DISABLED_MODE == Mode.UNKNOWN) { if (TEMP_DISABLED_MODE == Mode.UNKNOWN) {
TEMP_DISABLED_MODE = CURRENT_MODE TEMP_DISABLED_MODE =
CURRENT_MODE
} }
CURRENT_MODE = Mode.INSERT CURRENT_MODE = Mode.INSERT
DISABLED_MODIFIERS_STORAGE.addAll(CURRENT_MODE_MODIFIER) DISABLED_MODIFIERS_STORAGE.addAll(
CURRENT_MODE_MODIFIER
)
CURRENT_MODE_MODIFIER.clear() CURRENT_MODE_MODIFIER.clear()
} }
fun onAllowedCheck(data: GimblePolicy) { fun onAllowedCheck(data: GimbalPolicy) {
POLICY = data.policy POLICY = data.policy
if (data.policy == GimblePolicyType.ALLOWED) { if (data.policy == GimbalPolicyType.ALLOWED) {
if (TEMP_DISABLED_MODE != Mode.UNKNOWN) { if (TEMP_DISABLED_MODE != Mode.UNKNOWN) {
CURRENT_MODE = TEMP_DISABLED_MODE CURRENT_MODE =
TEMP_DISABLED_MODE
TEMP_DISABLED_MODE = Mode.UNKNOWN TEMP_DISABLED_MODE = Mode.UNKNOWN
} }
CURRENT_MODE_MODIFIER.addAll(DISABLED_MODIFIERS_STORAGE) CURRENT_MODE_MODIFIER.addAll(
DISABLED_MODIFIERS_STORAGE
)
DISABLED_MODIFIERS_STORAGE.clear() DISABLED_MODIFIERS_STORAGE.clear()
this.onUpdated() onUpdated()
} }
} }
fun isAllowed(): Boolean { fun isAllowed(): Boolean {
return POLICY == GimblePolicyType.ALLOWED return POLICY == GimbalPolicyType.ALLOWED
} }
fun shouldClient(capability: Capability): Boolean { fun shouldClient(capability: Capability): Boolean {
return EditorUtil.shouldPlayer(capability, EditorState(CURRENT_MODE, CURRENT_MODE_MODIFIER)) return EditorUtil.shouldPlayer(
capability, EditorState(
CURRENT_MODE,
CURRENT_MODE_MODIFIER
)
)
} }
fun isInNonDefaultMode(): Boolean { fun isInNonDefaultMode(): Boolean {
@ -83,8 +99,11 @@ object ClientEditor {
* Send an updated player state to the server * Send an updated player state to the server
* */ * */
private fun updateServerState() { private fun updateServerState() {
val state = EditorState(CURRENT_MODE, CURRENT_MODE_MODIFIER) val state = EditorState(
GimbleClient.sendEditorState(state) CURRENT_MODE,
CURRENT_MODE_MODIFIER
)
GimbalClient.sendEditorState(state)
ServerEditorManager.updateEditorState(MinecraftClient.getInstance().player!!.uuid, state) ServerEditorManager.updateEditorState(MinecraftClient.getInstance().player!!.uuid, state)
} }
@ -101,7 +120,7 @@ object ClientEditor {
return return
CURRENT_MODE = mode CURRENT_MODE = mode
this.onUpdated() onUpdated()
} }
/* /*
@ -128,14 +147,14 @@ object ClientEditor {
CURRENT_MODE_MODIFIER.add(mod) CURRENT_MODE_MODIFIER.add(mod)
} }
this.onUpdated() onUpdated()
} }
private fun onUpdated() { private fun onUpdated() {
CURRENT_MODE_MODIFIER.sortBy { CURRENT_MODE_MODIFIER.sortBy {
it.displayName it.displayName
} }
this.checkForIncompatibleModeModifiers() checkForIncompatibleModeModifiers()
} }
/** /**
@ -166,10 +185,13 @@ object ClientEditor {
} }
// Update State // Update State
this.updateServerState() updateServerState()
if(TEMP_DISABLED_MODIFIERS.isNotEmpty()) { if(TEMP_DISABLED_MODIFIERS.isNotEmpty()) {
ChatUtil.showToastToSelf("${CURRENT_MODE.displayName} Mode disabled", getListAsString(TEMP_DISABLED_MODIFIERS), MinecraftClient.getInstance()) ChatUtil.showToastToSelf(
"${CURRENT_MODE.displayName} Mode disabled",
getListAsString(TEMP_DISABLED_MODIFIERS), MinecraftClient.getInstance()
)
} }
} }
@ -189,7 +211,7 @@ object ClientEditor {
* */ * */
fun getModeDisplayText(): Text { fun getModeDisplayText(): Text {
val displayText = StringBuilder(CURRENT_MODE.displayName) val displayText = StringBuilder(CURRENT_MODE.displayName)
if (CURRENT_MODE_MODIFIER.isNotEmpty() && this.isAllowed() && MinecraftClient.getInstance().player?.isCreative == true) { if (CURRENT_MODE_MODIFIER.isNotEmpty() && isAllowed() && MinecraftClient.getInstance().player?.isCreative == true) {
displayText.append(" [") displayText.append(" [")
for (i in CURRENT_MODE_MODIFIER.indices) { for (i in CURRENT_MODE_MODIFIER.indices) {
displayText.append(CURRENT_MODE_MODIFIER[i].displayName) displayText.append(CURRENT_MODE_MODIFIER[i].displayName)
@ -198,7 +220,7 @@ object ClientEditor {
} }
} }
displayText.append("]") displayText.append("]")
} else if (!this.isAllowed() || !MinecraftClient.getInstance().player?.isCreative!!) { } else if (!isAllowed() || !MinecraftClient.getInstance().player?.isCreative!!) {
displayText.clear() displayText.clear()
displayText.append("[GIMBLE DISABLED]") displayText.append("[GIMBLE DISABLED]")
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,20 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings package net.moonleay.gimbal.client.keybindings
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
object KeybindingManager { object KeybindingManager {
private val shortcuts = mutableListOf<GimbleShortcut>() private val shortcuts = mutableListOf<GimbalShortcut>()
/** /**
* Register a shortcut. This will also register the keybinding. * Register a shortcut. This will also register the keybinding.
* */ * */
fun registerShortcut(shortcut: GimbleShortcut) { fun registerShortcut(shortcut: GimbalShortcut) {
shortcuts.add(shortcut) shortcuts.add(shortcut)
KeyBindingRegistryImpl.registerKeyBinding(shortcut.keyBinding) KeyBindingRegistryImpl.registerKeyBinding(shortcut.keyBinding)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,20 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings package net.moonleay.gimbal.client.keybindings
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.minecraft.client.util.InputUtil import net.minecraft.client.util.InputUtil
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
import net.moonleay.gimble.client.keybindings.impl.editormode.EnableInsertModeShortcut import net.moonleay.gimbal.client.keybindings.impl.editormode.EnableInsertModeShortcut
import net.moonleay.gimble.client.keybindings.impl.editormode.EnableReplaceModeShortcut import net.moonleay.gimbal.client.keybindings.impl.editormode.EnableReplaceModeShortcut
import net.moonleay.gimble.client.keybindings.impl.editormodemodifier.ToggleBulldozerModifierShortcut import net.moonleay.gimbal.client.keybindings.impl.editormodemodifier.ToggleBulldozerModifierShortcut
import net.moonleay.gimble.client.keybindings.impl.editormodemodifier.ToggleForcePlaceModifierShortcut import net.moonleay.gimbal.client.keybindings.impl.editormodemodifier.ToggleForcePlaceModifierShortcut
import net.moonleay.gimble.client.keybindings.impl.editormodemodifier.ToggleNoClipModifierShortcut import net.moonleay.gimbal.client.keybindings.impl.editormodemodifier.ToggleNoClipModifierShortcut
import net.moonleay.gimble.client.keybindings.impl.editormodemodifier.ToggleNoUpdatesModifierShortcut import net.moonleay.gimbal.client.keybindings.impl.editormodemodifier.ToggleNoUpdatesModifierShortcut
import net.moonleay.gimble.client.keybindings.impl.gamemode.CreativeModeShortcut import net.moonleay.gimbal.client.keybindings.impl.gamemode.CreativeModeShortcut
import net.moonleay.gimble.client.keybindings.impl.gamemode.SpectatorModeShortcut import net.moonleay.gimbal.client.keybindings.impl.gamemode.SpectatorModeShortcut
import net.moonleay.gimble.client.keybindings.impl.gamemode.SurvivalModeShortcut import net.moonleay.gimbal.client.keybindings.impl.gamemode.SurvivalModeShortcut
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.lwjgl.glfw.GLFW import org.lwjgl.glfw.GLFW
@ -47,28 +47,28 @@ object KeybindingRegistrar {
private fun registerSetEditorModeModifierKeybindings() { private fun registerSetEditorModeModifierKeybindings() {
val toggleBulldozerModifierShortcut = KeyBinding( val toggleBulldozerModifierShortcut = KeyBinding(
"gimble.key.editor.modifier.bulldozer", "gimbal.key.editor.modifier.bulldozer",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.editormodifier" "gimbal.category.editormodifier"
) )
val toggleForcePlaceModifierShortcut = KeyBinding( val toggleForcePlaceModifierShortcut = KeyBinding(
"gimble.key.editor.modifier.forceplace", "gimbal.key.editor.modifier.forceplace",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.editormodifier" "gimbal.category.editormodifier"
) )
val toggleNoUpdatesModifierShortcut = KeyBinding( val toggleNoUpdatesModifierShortcut = KeyBinding(
"gimble.key.editor.modifier.noupdates", "gimbal.key.editor.modifier.noupdates",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.editormodifier" "gimbal.category.editormodifier"
) )
val toggleNoClipModifierShortcut = KeyBinding( val toggleNoClipModifierShortcut = KeyBinding(
"gimble.key.editor.modifier.noclip", "gimbal.key.editor.modifier.noclip",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.editormodifier" "gimbal.category.editormodifier"
) )
KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut)) KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut))
@ -79,22 +79,22 @@ object KeybindingRegistrar {
private fun registerSetEditorModeKeybindings() { private fun registerSetEditorModeKeybindings() {
val insertKeyBinding = KeyBinding( val insertKeyBinding = KeyBinding(
"gimble.key.editor.mode.insert", "gimbal.key.editor.mode.insert",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_I, GLFW.GLFW_KEY_I,
"gimble.category.editormode" "gimbal.category.editormode"
) )
val replaceKeyBinding = KeyBinding( val replaceKeyBinding = KeyBinding(
"gimble.key.editor.mode.replace", "gimbal.key.editor.mode.replace",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_R, GLFW.GLFW_KEY_R,
"gimble.category.editormode" "gimbal.category.editormode"
) )
// val visualKeyBinding = KeyBinding( // val visualKeyBinding = KeyBinding(
// "gimble.key.editor.mode.visual", // "gimbal.key.editor.mode.visual",
// InputUtil.Type.KEYSYM, // InputUtil.Type.KEYSYM,
// GLFW.GLFW_KEY_V, // GLFW.GLFW_KEY_V,
// "gimble.category.editormode" // "gimbal.category.editormode"
// ) // )
KeybindingManager.registerShortcut(EnableInsertModeShortcut(insertKeyBinding)) KeybindingManager.registerShortcut(EnableInsertModeShortcut(insertKeyBinding))
KeybindingManager.registerShortcut(EnableReplaceModeShortcut(replaceKeyBinding)) KeybindingManager.registerShortcut(EnableReplaceModeShortcut(replaceKeyBinding))
@ -103,22 +103,22 @@ object KeybindingRegistrar {
private fun registerSetGameModeKeybindings() { private fun registerSetGameModeKeybindings() {
val survivalKeyBinding = KeyBinding( val survivalKeyBinding = KeyBinding(
"gimble.key.game.mode.survival", "gimbal.key.game.mode.survival",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.gamemode" "gimbal.category.gamemode"
) )
val creativeKeyBinding = KeyBinding( val creativeKeyBinding = KeyBinding(
"gimble.key.game.mode.creative", "gimbal.key.game.mode.creative",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.gamemode" "gimbal.category.gamemode"
) )
val spectatorKeyBinding = KeyBinding( val spectatorKeyBinding = KeyBinding(
"gimble.key.game.mode.spectator", "gimbal.key.game.mode.spectator",
InputUtil.Type.KEYSYM, InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN, GLFW.GLFW_KEY_UNKNOWN,
"gimble.category.gamemode" "gimbal.category.gamemode"
) )
KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding)) KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding))
KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding)) KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding))

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl package net.moonleay.gimbal.client.keybindings.impl
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
abstract class GimbleShortcut(val keyBinding: KeyBinding) { abstract class GimbalShortcut(val keyBinding: KeyBinding) {
abstract fun onPressed(client: MinecraftClient) abstract fun onPressed(client: MinecraftClient)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,16 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormode package net.moonleay.gimbal.client.keybindings.impl.editormode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.Mode import net.moonleay.gimbal.editor.state.mode.Mode
class EnableInsertModeShortcut(key: KeyBinding): GimbleShortcut(key) { class EnableInsertModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.setMode(Mode.INSERT) ClientEditor.setMode(Mode.INSERT)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,16 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormode package net.moonleay.gimbal.client.keybindings.impl.editormode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.Mode import net.moonleay.gimbal.editor.state.mode.Mode
class EnableReplaceModeShortcut(key: KeyBinding): GimbleShortcut(key) { class EnableReplaceModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.setMode(Mode.REPLACE) ClientEditor.setMode(Mode.REPLACE)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,16 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormode package net.moonleay.gimbal.client.keybindings.impl.editormode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.Mode import net.moonleay.gimbal.editor.state.mode.Mode
class EnableVisualModeShortcut(key: KeyBinding): GimbleShortcut(key) { class EnableVisualModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.setMode(Mode.VISUAL) ClientEditor.setMode(Mode.VISUAL)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormodemodifier package net.moonleay.gimbal.client.keybindings.impl.editormodemodifier
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
class ToggleBulldozerModifierShortcut(key: KeyBinding): GimbleShortcut(key) { class ToggleBulldozerModifierShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.toggleModifier(ModeModifier.BULLDOZER) ClientEditor.toggleModifier(ModeModifier.BULLDOZER)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormodemodifier package net.moonleay.gimbal.client.keybindings.impl.editormodemodifier
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
class ToggleForcePlaceModifierShortcut(key: KeyBinding): GimbleShortcut(key) { class ToggleForcePlaceModifierShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.toggleModifier(ModeModifier.FORCE_PLACE) ClientEditor.toggleModifier(ModeModifier.FORCE_PLACE)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormodemodifier package net.moonleay.gimbal.client.keybindings.impl.editormodemodifier
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
class ToggleNoClipModifierShortcut(key: KeyBinding): GimbleShortcut(key) { class ToggleNoClipModifierShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.toggleModifier(ModeModifier.NO_CLIP) ClientEditor.toggleModifier(ModeModifier.NO_CLIP)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.editormodemodifier package net.moonleay.gimbal.client.keybindings.impl.editormodemodifier
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
class ToggleNoUpdatesModifierShortcut(key: KeyBinding): GimbleShortcut(key) { class ToggleNoUpdatesModifierShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ClientEditor.toggleModifier(ModeModifier.NO_UPDATES) ClientEditor.toggleModifier(ModeModifier.NO_UPDATES)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.gamemode package net.moonleay.gimbal.client.keybindings.impl.gamemode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.client.util.ChatUtil import net.moonleay.gimbal.client.util.ChatUtil
class CreativeModeShortcut(key: KeyBinding): GimbleShortcut(key) { class CreativeModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ChatUtil.sendCommand("/gamemode creative", client, false) ChatUtil.sendCommand("/gamemode creative", client, false)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.gamemode package net.moonleay.gimbal.client.keybindings.impl.gamemode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.client.util.ChatUtil import net.moonleay.gimbal.client.util.ChatUtil
class SpectatorModeShortcut(key: KeyBinding): GimbleShortcut(key) { class SpectatorModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ChatUtil.sendCommand("/gamemode spectator", client, false) ChatUtil.sendCommand("/gamemode spectator", client, false)
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.keybindings.impl.gamemode package net.moonleay.gimbal.client.keybindings.impl.gamemode
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.option.KeyBinding import net.minecraft.client.option.KeyBinding
import net.moonleay.gimble.client.keybindings.impl.GimbleShortcut import net.moonleay.gimbal.client.keybindings.impl.GimbalShortcut
import net.moonleay.gimble.client.util.ChatUtil import net.moonleay.gimbal.client.util.ChatUtil
class SurvivalModeShortcut(key: KeyBinding) : GimbleShortcut(key) { class SurvivalModeShortcut(key: KeyBinding) : GimbalShortcut(key) {
override fun onPressed(client: MinecraftClient) { override fun onPressed(client: MinecraftClient) {
ChatUtil.sendCommand("/gamemode survival", client, false) ChatUtil.sendCommand("/gamemode survival", client, false)

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.client.util package net.moonleay.gimbal.client.util
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.toast.SystemToast import net.minecraft.client.toast.SystemToast

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.datagen package net.moonleay.gimbal.datagen
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
internal class DataGenerator : DataGeneratorEntrypoint { internal class DataGenerator : DataGeneratorEntrypoint {
@ -28,6 +28,6 @@ internal class DataGenerator : DataGeneratorEntrypoint {
override fun onInitializeDataGenerator(fabricDataGenerator: FabricDataGenerator) { override fun onInitializeDataGenerator(fabricDataGenerator: FabricDataGenerator) {
LOGGER.info("Starting Data Generation") LOGGER.info("Starting Data Generation")
fabricDataGenerator.addProvider(En_us_GimbleLanguageProvider(fabricDataGenerator)) fabricDataGenerator.addProvider(En_us_GimbalLanguageProvider(fabricDataGenerator))
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,35 +16,35 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.datagen package net.moonleay.gimbal.datagen
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider
class En_us_GimbleLanguageProvider(dataGenerator: FabricDataGenerator?) : class En_us_GimbalLanguageProvider(dataGenerator: FabricDataGenerator?) :
FabricLanguageProvider(dataGenerator, "en_us") { FabricLanguageProvider(dataGenerator, "en_us") {
override fun generateTranslations(translationBuilder: TranslationBuilder?) { override fun generateTranslations(translationBuilder: TranslationBuilder?) {
if (translationBuilder == null) return if (translationBuilder == null) return
// Editor modes // Editor modes
translationBuilder.add("gimble.category.editormode", "Editor Modes") translationBuilder.add("gimbal.category.editormode", "Editor Modes")
translationBuilder.add("gimble.key.editor.mode.insert", "Enter Insert Mode") translationBuilder.add("gimbal.key.editor.mode.insert", "Enter Insert Mode")
translationBuilder.add("gimble.key.editor.mode.replace", "Enter Replace Mode") translationBuilder.add("gimbal.key.editor.mode.replace", "Enter Replace Mode")
translationBuilder.add("gimble.key.editor.mode.visual", "Enter Visual Mode") translationBuilder.add("gimbal.key.editor.mode.visual", "Enter Visual Mode")
// Editor mode modifiers // Editor mode modifiers
translationBuilder.add("gimble.category.editormodifier", "Editor Mode Modifiers") translationBuilder.add("gimbal.category.editormodifier", "Editor Mode Modifiers")
translationBuilder.add("gimble.key.editor.modifier.bulldozer", "Toggle Bulldozer Modifier") translationBuilder.add("gimbal.key.editor.modifier.bulldozer", "Toggle Bulldozer Modifier")
translationBuilder.add("gimble.key.editor.modifier.forceplace", "Toggle Force Place Modifier") translationBuilder.add("gimbal.key.editor.modifier.forceplace", "Toggle Force Place Modifier")
translationBuilder.add("gimble.key.editor.modifier.noupdates", "Toggle No Updates Modifier") translationBuilder.add("gimbal.key.editor.modifier.noupdates", "Toggle No Updates Modifier")
translationBuilder.add("gimble.key.editor.modifier.noclip", "Toggle No Clip Modifier") translationBuilder.add("gimbal.key.editor.modifier.noclip", "Toggle No Clip Modifier")
// Game mode // Game mode
translationBuilder.add("gimble.category.gamemode", "Game Mode") translationBuilder.add("gimbal.category.gamemode", "Game Mode")
translationBuilder.add("gimble.key.game.mode.survival", "Enable Survival Mode") translationBuilder.add("gimbal.key.game.mode.survival", "Enable Survival Mode")
translationBuilder.add("gimble.key.game.mode.creative", "Enable Creative Mode") translationBuilder.add("gimbal.key.game.mode.creative", "Enable Creative Mode")
translationBuilder.add("gimble.key.game.mode.spectator", "Enable Spectator Mode") translationBuilder.add("gimbal.key.game.mode.spectator", "Enable Spectator Mode")
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor package net.moonleay.gimbal.editor
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
import net.moonleay.gimble.editor.state.EditorState import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimble.editor.state.mode.Capability import net.moonleay.gimbal.editor.state.mode.Capability
import net.moonleay.gimble.editor.util.EditorUtil import net.moonleay.gimbal.editor.util.EditorUtil
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import java.util.* import java.util.*

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.state package net.moonleay.gimbal.editor.state
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import net.moonleay.gimble.editor.state.mode.Mode import net.moonleay.gimbal.editor.state.mode.Mode
import net.moonleay.gimble.editor.state.mode.ModeModifier import net.moonleay.gimbal.editor.state.mode.ModeModifier
@Serializable @Serializable
data class EditorState( data class EditorState(

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.state package net.moonleay.gimbal.editor.state
enum class GimblePolicyType { enum class GimbalPolicyType {
ALLOWED, ALLOWED,
DENIED, DENIED,
NOT_PRESENT NOT_PRESENT

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.state.mode package net.moonleay.gimbal.editor.state.mode
enum class Capability { enum class Capability {
INSERT, INSERT,

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.state.mode package net.moonleay.gimbal.editor.state.mode
enum class Mode(val displayName: String, val color: Int, val incompatibleModifiers: List<ModeModifier>){ enum class Mode(val displayName: String, val color: Int, val incompatibleModifiers: List<ModeModifier>){
UNKNOWN("UNKNOWN", 0x000000, listOf()), // Unknown mode. This mode cannot be entered UNKNOWN("UNKNOWN", 0x000000, listOf()), // Unknown mode. This mode cannot be entered

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.state.mode package net.moonleay.gimbal.editor.state.mode
enum class ModeModifier(val displayName: String) { enum class ModeModifier(val displayName: String) {
// NONE("None"), // No Modifiers - default behavior // NONE("None"), // No Modifiers - default behavior

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.util package net.moonleay.gimbal.editor.util
import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimbal.editor.state.mode.Capability
import net.moonleay.gimbal.editor.state.mode.Mode
import net.moonleay.gimbal.editor.state.mode.ModeModifier
import net.moonleay.gimble.editor.state.EditorState
import net.moonleay.gimble.editor.state.mode.Capability
import net.moonleay.gimble.editor.state.mode.Mode
import net.moonleay.gimble.editor.state.mode.ModeModifier
object EditorUtil { object EditorUtil {

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.editor.util package net.moonleay.gimbal.editor.util
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import net.moonleay.gimble.editor.state.GimblePolicyType import net.moonleay.gimbal.editor.state.GimbalPolicyType
@Serializable @Serializable
data class GimblePolicy( data class GimbalPolicy(
val policy: GimblePolicyType, val policy: GimbalPolicyType,
) )

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.moonleay.gimble.editor.ServerEditorManager; import net.moonleay.gimbal.editor.ServerEditorManager;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,17 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(DownloadingTerrainScreen.class) @Mixin(DownloadingTerrainScreen.class)
public class GimblePolicyCheckMixin { public class GimbalPolicyCheckMixin {
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;close()V", ordinal = -1)) @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;close()V", ordinal = -1))

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.moonleay.gimble.editor.ServerEditorManager; import net.moonleay.gimbal.editor.ServerEditorManager;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.entity.EntityPose; import net.minecraft.entity.EntityPose;
@ -25,8 +25,8 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.moonleay.gimble.editor.ServerEditorManager; import net.moonleay.gimbal.editor.ServerEditorManager;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.GameOptions; import net.minecraft.client.option.GameOptions;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import net.moonleay.gimble.editor.state.mode.Mode; import net.moonleay.gimbal.editor.state.mode.Mode;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.mixin; package net.moonleay.gimbal.mixin;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@ -29,8 +29,8 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.moonleay.gimble.client.editor.ClientEditor; import net.moonleay.gimbal.client.editor.ClientEditor;
import net.moonleay.gimble.editor.state.mode.Capability; import net.moonleay.gimbal.editor.state.mode.Capability;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.networking package net.moonleay.gimbal.networking
import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.cbor.Cbor import kotlinx.serialization.cbor.Cbor
@ -25,11 +25,11 @@ import kotlinx.serialization.encodeToByteArray
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs import net.fabricmc.fabric.api.networking.v1.PacketByteBufs
import net.minecraft.network.PacketByteBuf import net.minecraft.network.PacketByteBuf
import net.moonleay.gimble.client.editor.ClientEditor import net.moonleay.gimbal.client.editor.ClientEditor
import net.moonleay.gimble.editor.state.EditorState import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimble.editor.util.GimblePolicy import net.moonleay.gimbal.editor.util.GimbalPolicy
object GimbleClient { object GimbalClient {
fun registerPacketHandlers() { fun registerPacketHandlers() {
ClientPlayNetworking.registerGlobalReceiver(PacketIDs.TRANSFER_GIMBLE_POLICY_ID) { _, _, buf, _ -> ClientPlayNetworking.registerGlobalReceiver(PacketIDs.TRANSFER_GIMBLE_POLICY_ID) { _, _, buf, _ ->
@ -37,8 +37,9 @@ object GimbleClient {
} }
} }
@OptIn(ExperimentalSerializationApi::class)
private fun onAllowedCheck(buf: PacketByteBuf) { private fun onAllowedCheck(buf: PacketByteBuf) {
val policy = Cbor.decodeFromByteArray<GimblePolicy>(buf.readByteArray()) val policy = Cbor.decodeFromByteArray<GimbalPolicy>(buf.readByteArray())
ClientEditor.onAllowedCheck(policy) // Update the client's policy ClientEditor.onAllowedCheck(policy) // Update the client's policy
} }
@ -52,6 +53,7 @@ object GimbleClient {
ClientPlayNetworking.send(PacketIDs.UPDATE_EDITOR_STATE_ID, buf) ClientPlayNetworking.send(PacketIDs.UPDATE_EDITOR_STATE_ID, buf)
} }
@OptIn(ExperimentalSerializationApi::class)
fun checkIfServerHasGimble(state: EditorState) { fun checkIfServerHasGimble(state: EditorState) {
val buf = PacketByteBufs.create() val buf = PacketByteBufs.create()
buf.writeByteArray(Cbor.encodeToByteArray(state)) buf.writeByteArray(Cbor.encodeToByteArray(state))

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.networking package net.moonleay.gimbal.networking
import kotlinx.serialization.cbor.Cbor import kotlinx.serialization.cbor.Cbor
import kotlinx.serialization.decodeFromByteArray import kotlinx.serialization.decodeFromByteArray
@ -25,12 +25,12 @@ import net.fabricmc.fabric.api.networking.v1.PacketByteBufs
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking
import net.minecraft.network.PacketByteBuf import net.minecraft.network.PacketByteBuf
import net.minecraft.server.network.ServerPlayerEntity import net.minecraft.server.network.ServerPlayerEntity
import net.moonleay.gimble.editor.ServerEditorManager import net.moonleay.gimbal.editor.ServerEditorManager
import net.moonleay.gimble.editor.state.EditorState import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimble.editor.state.GimblePolicyType import net.moonleay.gimbal.editor.state.GimbalPolicyType
import net.moonleay.gimble.editor.util.GimblePolicy import net.moonleay.gimbal.editor.util.GimbalPolicy
object GimbleServer { object GimbalServer {
fun registerPacketHandler() { fun registerPacketHandler() {
ServerPlayNetworking ServerPlayNetworking
@ -56,7 +56,7 @@ object GimbleServer {
ServerEditorManager.updateEditorState(player.uuid, state) ServerEditorManager.updateEditorState(player.uuid, state)
val buffer = PacketByteBufs.create() val buffer = PacketByteBufs.create()
buffer.writeByteArray(Cbor.encodeToByteArray(GimblePolicy(GimblePolicyType.ALLOWED))) buffer.writeByteArray(Cbor.encodeToByteArray(GimbalPolicy(GimbalPolicyType.ALLOWED)))
ServerPlayNetworking.send(player, PacketIDs.TRANSFER_GIMBLE_POLICY_ID, buffer) ServerPlayNetworking.send(player, PacketIDs.TRANSFER_GIMBLE_POLICY_ID, buffer)
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Gimble * Gimbal
* Copyright (C) 2024 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.gimble.networking package net.moonleay.gimbal.networking
import net.minecraft.util.Identifier import net.minecraft.util.Identifier
import net.moonleay.gimble.build.BuildConstants import net.moonleay.gimbal.build.BuildConstants
object PacketIDs { object PacketIDs {
val UPDATE_EDITOR_STATE_ID = Identifier(BuildConstants.modId, "update_editor_state") val UPDATE_EDITOR_STATE_ID = Identifier(BuildConstants.modId, "update_editor_state")

View file

Before

Width:  |  Height:  |  Size: 1,015 KiB

After

Width:  |  Height:  |  Size: 1,015 KiB

View file

@ -11,8 +11,8 @@
"contact": { "contact": {
"email": "contact@moonleay.net", "email": "contact@moonleay.net",
"homepage": "https://moonleay.net", "homepage": "https://moonleay.net",
"sources": "https://codeberg.org/moonleay/Gimble", "sources": "https://codeberg.org/moonleay/Gimbal",
"issues": "https://codeberg.org/moonleay/Gimble/issues" "issues": "https://codeberg.org/moonleay/Gimbal/issues"
}, },
"license": "GPL-3.0", "license": "GPL-3.0",
"environment": "*", "environment": "*",
@ -20,19 +20,19 @@
"client": [ "client": [
{ {
"adapter": "kotlin", "adapter": "kotlin",
"value": "net.moonleay.gimble.client.ClientMain" "value": "net.moonleay.gimbal.client.ClientMain"
} }
], ],
"main": [ "main": [
{ {
"adapter": "kotlin", "adapter": "kotlin",
"value": "net.moonleay.gimble.Main" "value": "net.moonleay.gimbal.Main"
} }
], ],
"fabric-datagen": [ "fabric-datagen": [
{ {
"adapter": "kotlin", "adapter": "kotlin",
"value": "net.moonleay.gimble.datagen.DataGenerator" "value": "net.moonleay.gimbal.datagen.DataGenerator"
} }
] ]
}, },

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "net.moonleay.gimble.mixin", "package": "net.moonleay.gimbal.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
"ForcePlaceMixin", "ForcePlaceMixin",
@ -11,7 +11,7 @@
"client": [ "client": [
"BulldozerMixin", "BulldozerMixin",
"BulldozerMixin2", "BulldozerMixin2",
"GimblePolicyCheckMixin", "GimbalPolicyCheckMixin",
"HudMixin", "HudMixin",
"NoClipCameraFixMixin", "NoClipCameraFixMixin",
"NormalModeMixin", "NormalModeMixin",

View file

@ -0,0 +1,25 @@
/*
* Gimbal
* Copyright (C) 2024 moonleay
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.moonleay.gimbal.build
internal object BuildConstants {
const val modId = "${modId}"
const val modName = "${modName}"
const val modVersion = "${modVersion}"
}

View file

@ -1,7 +0,0 @@
package net.moonleay.gimble.build
internal object BuildConstants {
const val modId = "${modId}"
const val modName = "${modName}"
const val modVersion = "${modVersion}"
}