remove name from some profile delegates

This commit is contained in:
Moritz Zwerger 2023-11-23 08:12:17 +01:00
parent 94b1400b53
commit e5535d9b72
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
28 changed files with 60 additions and 59 deletions

View File

@ -23,6 +23,10 @@ open class SimpleDelegate<T>(
private val verify: ((T) -> Unit)? = null,
) : DataObserver<T>(default), AbstractProfileDelegate<T> {
init {
}
override fun set(value: T): T {
validate(value)
return super.set(value)

View File

@ -19,7 +19,6 @@ import de.bixilon.minosoft.config.profile.profiles.Profile
open class BooleanDelegate(
override val profile: Profile,
default: Boolean,
name: String = "",
) : SimpleDelegate<Boolean>(profile, default) {
override fun validate(value: Boolean) = Unit

View File

@ -19,7 +19,6 @@ import de.bixilon.minosoft.config.profile.profiles.Profile
open class DoubleDelegate(
override val profile: Profile,
default: Double,
name: String,
private val ranges: Array<ClosedFloatingPointRange<Double>>? = null,
) : SimpleDelegate<Double>(profile, default) {

View File

@ -19,7 +19,6 @@ import de.bixilon.minosoft.config.profile.profiles.Profile
open class FloatDelegate(
override val profile: Profile,
default: Float,
name: String,
private val ranges: Array<ClosedFloatingPointRange<Float>>? = null,
) : SimpleDelegate<Float>(profile, default) {

View File

@ -37,13 +37,13 @@ class AudioProfile(
* Skips the loading od the AudioPlayer
* Requires reloading of the whole audio subsystem to be applied
*/
var skipLoading by BooleanDelegate(this, false, "profile.audio.loading.skip")
var skipLoading by BooleanDelegate(this, false)
/**
* Enabled or disables all audio playing
* Does not skip loading of audio
*/
var enabled by BooleanDelegate(this, false, "profile.audio.enabled")
var enabled by BooleanDelegate(this, false)
val types = TypesC(this)
val volume = VolumeC(this)

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,10 +21,10 @@ class GuiC(profile: AudioProfile) {
/**
* Enables all gui sounds
*/
var enabled by BooleanDelegate(profile, true, "profile.audio.gui.enabled")
var enabled by BooleanDelegate(profile, true)
/**
* Enables all sounds related to button (currently only clicking
*/
var button by BooleanDelegate(profile, true, "profile.audio.gui.button")
var button by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,5 +21,5 @@ class TypesC(profile: AudioProfile) {
/**
* Play (custom) sounds from the server
*/
var packet by BooleanDelegate(profile, true, "profile.audio.types.packet")
var packet by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -17,5 +17,5 @@ import de.bixilon.minosoft.config.profile.delegate.primitive.FloatDelegate
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfile
class VolumeC(profile: AudioProfile) {
var master by FloatDelegate(profile, 1.0f, "profile.audio.volume.master", arrayOf(0.0f..1.0f))
var master by FloatDelegate(profile, 1.0f, arrayOf(0.0f..1.0f))
}

View File

@ -23,14 +23,14 @@ class OutlineC(profile: BlockProfile) {
/**
* Highlights the current selected block
*/
var enabled by BooleanDelegate(profile, true, "profile.block.outline.enabled")
var enabled by BooleanDelegate(profile, true)
/**
* Disables the z-buffer of the block outline
* Makes the whole outline visible and ignores the walls
*/
var showThroughWalls by BooleanDelegate(profile, false, "profile.block.outline.through_walls")
var showThroughWalls by BooleanDelegate(profile, false)
/**
* The color of the block that is currently selected
@ -42,7 +42,7 @@ class OutlineC(profile: BlockProfile) {
/**
* Shows the collision box of the selected block
*/
var collisions by BooleanDelegate(profile, false, "profile.block.outline.collisions.enabled")
var collisions by BooleanDelegate(profile, false)
/**
* The color of the block collision box that is currently selected

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -23,7 +23,7 @@ class RenderingC(profile: BlockProfile) {
* This option tries to do its best to fix any occurring [Moiré Patterns](https://en.wikipedia.org/wiki/Moir%C3%A9_pattern)
* If set position based random block models are disabled
*/
var antiMoirePattern by BooleanDelegate(profile, true, "profile.block.rendering.anti_moire_pattern")
var antiMoirePattern by BooleanDelegate(profile, true)
val entities = EntitiesC(profile)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -23,11 +23,11 @@ class MouseC(profile: ControlsProfile) {
* Controls how fast the mouse rotates the player around
* Must be non-negative
*/
var sensitivity by FloatDelegate(profile, 1.0f, "", arrayOf(0.01f..10.0f))
var sensitivity by FloatDelegate(profile, 1.0f, arrayOf(0.01f..10.0f))
/**
* Controls how fast you scroll (e.g. in the hotbar)
* Must be non-negative
*/
var scrollSensitivity by FloatDelegate(profile, 1.0f, "", arrayOf(0.01f..10.0f))
var scrollSensitivity by FloatDelegate(profile, 1.0f, arrayOf(0.01f..10.0f))
}

View File

@ -55,7 +55,7 @@ class ErosServer(
/**
* Sends version -1 in the handshake to query the servers version
*/
override var queryVersion by BooleanDelegate(profile, queryVersion, "")
override var queryVersion by BooleanDelegate(profile, queryVersion)
/**
* Profiles to use for the connection to the server.

View File

@ -38,7 +38,7 @@ class GUIProfile(
* The scale of the hud
* Must be non-negative
*/
var scale by FloatDelegate(this, 2.0f, "", arrayOf(1.0f..10.0f))
var scale by FloatDelegate(this, 2.0f, arrayOf(1.0f..10.0f))
val chat = ChatC(this)
val hud = HudC(this)

View File

@ -36,5 +36,5 @@ class AdvancedC(profile: RenderingProfile) {
* Violates the opengl specification.
* Requires rendering restart to apply
*/
var preferQuads by BooleanDelegate(profile, false, "profile.rendering.advanced.prefer_quads")
var preferQuads by BooleanDelegate(profile, false)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,5 +21,5 @@ class AnimationsC(profile: RenderingProfile) {
/**
* Enables or disables sprite animations.
*/
var sprites by BooleanDelegate(profile, true, "profile.rendering.animations.sprite")
var sprites by BooleanDelegate(profile, true)
}

View File

@ -25,10 +25,10 @@ class CameraC(profile: RenderingProfile) {
* Field of view
* Value must be greater than 0 and smaller than 180
*/
var fov by FloatDelegate(profile, 70.0f, "profile.rendering.camera.fov", arrayOf(10.0f..179.0f))
var fov by FloatDelegate(profile, 70.0f, arrayOf(10.0f..179.0f))
/**
* Changes the fov to create a speed or slowness illusion
*/
var dynamicFOV by BooleanDelegate(profile, true, "profile.rendering.camera.fov.dynamic")
var dynamicFOV by BooleanDelegate(profile, true)
}

View File

@ -23,7 +23,7 @@ class ShakingC(profile: RenderingProfile) {
*/
var enabled by BooleanDelegate(profile, true)
var amplifier by FloatDelegate(profile, 1.0f, "", ranges = arrayOf(0.1f..2.0f))
var amplifier by FloatDelegate(profile, 1.0f, ranges = arrayOf(0.1f..2.0f))
/**
* Shake the camera while walking

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,5 +21,5 @@ class ChunkBorderC(profile: RenderingProfile) {
/**
* Enables or disables chunk border lines
*/
var enabled by BooleanDelegate(profile, false, "profile.rendering.chunk_border.enabled")
var enabled by BooleanDelegate(profile, false)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -23,5 +23,5 @@ class ExperimentalC(profile: RenderingProfile) {
* Recommended way to disable vsync
*/
// For further information take a look into the code at ExperimentalRenderStats
var fps by BooleanDelegate(profile, false, "profile.rendering.experimental.fps")
var fps by BooleanDelegate(profile, false)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,5 +21,5 @@ class FogC(profile: RenderingProfile) {
/**
* Enables or disables fog
*/
var enabled by BooleanDelegate(profile, true, "profile.rendering.fog.enabled")
var enabled by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -24,10 +24,10 @@ class LightC(profile: RenderingProfile) {
* In original minecraft this setting is called brightness
* Must be non-negative and may not exceed 1
*/
var gamma by FloatDelegate(profile, 0.0f, "profile.rendering.light.gamma", arrayOf(0.0f..1.0f))
var gamma by FloatDelegate(profile, 0.0f, arrayOf(0.0f..1.0f))
/**
* Makes everything bright
*/
var fullbright by BooleanDelegate(profile, false, "profile.rendering.light.fullbright")
var fullbright by BooleanDelegate(profile, false)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -22,5 +22,5 @@ class MovementC(profile: RenderingProfile) {
* Disable all packets that update the position on the server
* Does not disable position/teleport confirmation
*/
var packetSending by BooleanDelegate(profile, true, "profile.rendering.movement.packet_sending")
var packetSending by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -23,17 +23,17 @@ class OverlayC(profile: RenderingProfile) {
/**
* Enables the powder snow 2d overlay if the player is frozen
*/
var powderSnow by BooleanDelegate(profile, true, "")
var powderSnow by BooleanDelegate(profile, true)
/**
* Enabled the pumpkin blur overlay if the player is waring a carved pumpkin
*/
var pumpkin by BooleanDelegate(profile, true, "")
var pumpkin by BooleanDelegate(profile, true)
/**
* Enables the world boreder overlay
*/
var worldBorder by BooleanDelegate(profile, true, "")
var worldBorder by BooleanDelegate(profile, true)
val fire = FireC(profile)
val weather = WeatherC(profile)

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,15 +21,15 @@ class FireC(profile: RenderingProfile) {
/**
* Enables the fire/burning overlay
*/
var enabled by BooleanDelegate(profile, true, "")
var enabled by BooleanDelegate(profile, true)
/**
* Enables the overlay if in creative
*/
var creative by BooleanDelegate(profile, true, "")
var creative by BooleanDelegate(profile, true)
/**
* Enables the fire overlay if in lava
*/
var lava by BooleanDelegate(profile, true, "")
var lava by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -21,10 +21,10 @@ class WeatherC(profile: RenderingProfile) {
/**
* Enables rain overlay
*/
var rain by BooleanDelegate(profile, true, "")
var rain by BooleanDelegate(profile, true)
/**
* Enables snow overlay
*/
var snow by BooleanDelegate(profile, true, "")
var snow by BooleanDelegate(profile, true)
}

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 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.
*
@ -22,7 +22,7 @@ class PerformanceC(profile: RenderingProfile) {
* Does not render the bottom bedrock face when at minimum y.
* Kind of xray when falling out of the world.
*/
var fastBedrock by BooleanDelegate(profile, true, "")
var fastBedrock by BooleanDelegate(profile, true)
/**
* Disables the voronoi noise for biome cache building.
@ -31,10 +31,10 @@ class PerformanceC(profile: RenderingProfile) {
* Only affects 19w36+ (~1.14.4)
* ToDo: Requires rejoin to apply
*/
var fastBiomeNoise by BooleanDelegate(profile, true, "")
var fastBiomeNoise by BooleanDelegate(profile, true)
/**
* Sleeps 100 ms if the rendering window is not in focus anymore
*/
var slowRendering by BooleanDelegate(profile, true, "")
var slowRendering by BooleanDelegate(profile, true)
}

View File

@ -28,7 +28,7 @@ class SkyC(profile: RenderingProfile) {
/**
* Enables or disables the (ugly?) sun scatter
*/
var sunScatter by BooleanDelegate(profile, true, "")
var sunScatter by BooleanDelegate(profile, true)
val clouds = CloudC(profile)
}

View File

@ -23,22 +23,22 @@ class CloudC(profile: RenderingProfile) {
/**
* Renders clouds
*/
var enabled by BooleanDelegate(profile, true, "")
var enabled by BooleanDelegate(profile, true)
/**
* Renders clouds flat and not 3d
*/
var flat by BooleanDelegate(profile, false, "")
var flat by BooleanDelegate(profile, false)
/**
* Moves clouds from time to time
*/
var movement by BooleanDelegate(profile, true, "")
var movement by BooleanDelegate(profile, true)
/**
* Max y axis distance to clouds
*/
var maxDistance by FloatDelegate(profile, 60.0f, "")
var maxDistance by FloatDelegate(profile, 60.0f)
/**