From fbde9061e93ea76acdf653e008911238636375e2 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Fri, 19 Aug 2022 21:32:40 +0200 Subject: [PATCH] light debug: separate option for infinite torches --- .../de/bixilon/minosoft/config/DebugOptions.kt | 18 ++++++++++++++++++ .../minosoft/config/StaticConfiguration.kt | 2 +- .../connection/play/tick/ConnectionTicker.kt | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/main/java/de/bixilon/minosoft/config/DebugOptions.kt diff --git a/src/main/java/de/bixilon/minosoft/config/DebugOptions.kt b/src/main/java/de/bixilon/minosoft/config/DebugOptions.kt new file mode 100644 index 000000000..9e5afa225 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/config/DebugOptions.kt @@ -0,0 +1,18 @@ +/* + * Minosoft + * Copyright (C) 2020-2022 Moritz Zwerger + * + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.config + +object DebugOptions { + const val INFINITE_TORCHES = true +} diff --git a/src/main/java/de/bixilon/minosoft/config/StaticConfiguration.kt b/src/main/java/de/bixilon/minosoft/config/StaticConfiguration.kt index 62025477a..7b7c66569 100644 --- a/src/main/java/de/bixilon/minosoft/config/StaticConfiguration.kt +++ b/src/main/java/de/bixilon/minosoft/config/StaticConfiguration.kt @@ -23,5 +23,5 @@ object StaticConfiguration { const val IGNORE_SERVER_LIGHT = true - const val LIGHT_DEBUG_MODE = true + const val LIGHT_DEBUG_MODE = false } diff --git a/src/main/java/de/bixilon/minosoft/protocol/network/connection/play/tick/ConnectionTicker.kt b/src/main/java/de/bixilon/minosoft/protocol/network/connection/play/tick/ConnectionTicker.kt index 84ce5c274..238e117a2 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/network/connection/play/tick/ConnectionTicker.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/network/connection/play/tick/ConnectionTicker.kt @@ -17,6 +17,7 @@ import de.bixilon.kutil.concurrent.lock.simple.SimpleLock import de.bixilon.kutil.concurrent.time.TimeWorker import de.bixilon.kutil.concurrent.time.TimeWorkerTask import de.bixilon.kutil.watcher.DataWatcher.Companion.observe +import de.bixilon.minosoft.config.DebugOptions import de.bixilon.minosoft.config.StaticConfiguration import de.bixilon.minosoft.data.container.stack.ItemStack import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection @@ -55,7 +56,7 @@ class ConnectionTicker(private val connection: PlayConnection) { connection.world.randomTick() } - if (StaticConfiguration.LIGHT_DEBUG_MODE) { + if (StaticConfiguration.LIGHT_DEBUG_MODE || DebugOptions.INFINITE_TORCHES) { tasks += TimeWorkerTask(INTERVAL, maxDelayTime = MAX_DELAY) { connection.player.inventory[44] = ItemStack(connection.registries.itemRegistry["minecraft:torch"]!!, Int.MAX_VALUE) } }