light debug: separate option for infinite torches

This commit is contained in:
Bixilon 2022-08-19 21:32:40 +02:00
parent 0cd5396421
commit fbde9061e9
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 21 additions and 2 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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
}

View File

@ -23,5 +23,5 @@ object StaticConfiguration {
const val IGNORE_SERVER_LIGHT = true
const val LIGHT_DEBUG_MODE = true
const val LIGHT_DEBUG_MODE = false
}

View File

@ -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) }
}