mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
remove RenderBuilder::identifier
This commit is contained in:
parent
83304514cf
commit
46d42fce17
@ -308,7 +308,6 @@ class ChunkRenderer(
|
||||
|
||||
|
||||
companion object : RendererBuilder<ChunkRenderer> {
|
||||
override val identifier = minosoft("chunk")
|
||||
|
||||
override fun build(connection: PlayConnection, context: RenderContext): ChunkRenderer {
|
||||
return ChunkRenderer(connection, context)
|
||||
|
@ -132,7 +132,6 @@ class WorldBorderRenderer(
|
||||
}
|
||||
|
||||
companion object : RendererBuilder<WorldBorderRenderer> {
|
||||
override val identifier = minosoft("world_border")
|
||||
val GROWING_COLOR = "#40FF80".asColor()
|
||||
val SHRINKING_COLOR = "#FF3030".asColor()
|
||||
val STATIC_COLOR = "#20A0FF".asColor()
|
||||
|
@ -21,7 +21,6 @@ import de.bixilon.minosoft.config.key.KeyActions
|
||||
import de.bixilon.minosoft.config.key.KeyBinding
|
||||
import de.bixilon.minosoft.config.key.KeyCodes
|
||||
import de.bixilon.minosoft.data.registries.dimension.DimensionProperties
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||
import de.bixilon.minosoft.gui.rendering.RenderConstants
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
@ -204,7 +203,6 @@ class ChunkBorderRenderer(
|
||||
|
||||
|
||||
companion object : RendererBuilder<ChunkBorderRenderer> {
|
||||
override val identifier = minosoft("chunk_borders")
|
||||
private val CHUNK_BORDER_TOGGLE_KEY_COMBINATION = "minosoft:toggle_chunk_borders".toResourceLocation()
|
||||
private const val SECTION_LINE_WIDTH = RenderConstants.DEFAULT_LINE_WIDTH * 3
|
||||
private const val INNER_CHUNK_LINE_WIDTH = SECTION_LINE_WIDTH * 3
|
||||
|
@ -25,7 +25,6 @@ import de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.BlockWit
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.offset.RandomOffsetBlock
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.collision.CollidableBlock
|
||||
import de.bixilon.minosoft.data.registries.blocks.types.properties.shape.outline.OutlinedBlock
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
import de.bixilon.minosoft.gui.rendering.RenderConstants
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.gui.rendering.renderer.MeshSwapper
|
||||
@ -151,7 +150,6 @@ class BlockOutlineRenderer(
|
||||
|
||||
|
||||
companion object : RendererBuilder<BlockOutlineRenderer> {
|
||||
override val identifier = minosoft("block_outline")
|
||||
|
||||
override fun build(connection: PlayConnection, context: RenderContext): BlockOutlineRenderer {
|
||||
return BlockOutlineRenderer(connection, context)
|
||||
|
@ -158,7 +158,6 @@ class EntityRenderer(
|
||||
|
||||
|
||||
companion object : RendererBuilder<EntityRenderer> {
|
||||
override val identifier = minosoft("entity")
|
||||
private val HITBOX_TOGGLE_KEY_COMBINATION = minosoft("toggle_hitboxes")
|
||||
|
||||
|
||||
|
@ -158,7 +158,6 @@ class GUIRenderer(
|
||||
}
|
||||
|
||||
companion object : RendererBuilder<GUIRenderer> {
|
||||
override val identifier = "minosoft:gui".toResourceLocation()
|
||||
|
||||
override fun build(connection: PlayConnection, context: RenderContext): GUIRenderer {
|
||||
return GUIRenderer(connection, context)
|
||||
|
@ -270,7 +270,6 @@ class ParticleRenderer(
|
||||
|
||||
|
||||
companion object : RendererBuilder<ParticleRenderer> {
|
||||
override val identifier = minosoft("particle")
|
||||
const val MAXIMUM_AMOUNT = 50000
|
||||
const val MAX_FRAME_TIME = 5
|
||||
|
||||
|
@ -13,11 +13,10 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.renderer.renderer
|
||||
|
||||
import de.bixilon.minosoft.data.registries.identified.Identified
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
|
||||
interface RendererBuilder<T : Renderer> : Identified {
|
||||
interface RendererBuilder<T : Renderer> {
|
||||
|
||||
fun build(connection: PlayConnection, context: RenderContext): T?
|
||||
}
|
||||
|
@ -21,13 +21,11 @@ import de.bixilon.kutil.concurrent.worker.unconditional.UnconditionalWorker
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.latch.ParentLatch
|
||||
import de.bixilon.kutil.latch.SimpleLatch
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.PostDrawable
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.PreDrawable
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.RenderPhases
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.SkipAll
|
||||
import de.bixilon.minosoft.terminal.RunConfiguration
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
@ -35,21 +33,17 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
class RendererManager(
|
||||
private val context: RenderContext,
|
||||
) {
|
||||
private val renderers: MutableMap<ResourceLocation, Renderer> = synchronizedMapOf()
|
||||
private val renderers: MutableMap<RendererBuilder<*>, Renderer> = synchronizedMapOf()
|
||||
private val connection = context.connection
|
||||
private val renderSystem = context.system
|
||||
private val framebufferManager = context.framebuffer
|
||||
|
||||
|
||||
fun <T : Renderer> register(builder: RendererBuilder<T>): T? {
|
||||
val resourceLocation = builder.identifier
|
||||
if (resourceLocation in RunConfiguration.SKIP_RENDERERS) {
|
||||
return null
|
||||
}
|
||||
val renderer = builder.build(connection, context) ?: return null
|
||||
val previous = renderers.put(resourceLocation, renderer)
|
||||
val previous = renderers.put(builder, renderer)
|
||||
if (previous != null) {
|
||||
Log.log(LogMessageType.RENDERING, LogLevels.WARN) { "Renderer $previous(${builder.identifier}) got replaced by $renderer!" }
|
||||
Log.log(LogMessageType.RENDERING, LogLevels.WARN) { "Renderer $previous ($builder) got replaced by $renderer!" }
|
||||
}
|
||||
return renderer
|
||||
}
|
||||
@ -58,12 +52,8 @@ class RendererManager(
|
||||
register(builder)
|
||||
}
|
||||
|
||||
operator fun <T : Renderer> get(renderer: RendererBuilder<T>): T? {
|
||||
return this[renderer.identifier].unsafeCast()
|
||||
}
|
||||
|
||||
operator fun get(resourceLocation: ResourceLocation): Renderer? {
|
||||
return renderers[resourceLocation]
|
||||
operator fun <T : Renderer> get(builder: RendererBuilder<T>): T? {
|
||||
return this[builder].unsafeCast()
|
||||
}
|
||||
|
||||
fun init(latch: AbstractLatch) {
|
||||
|
@ -17,7 +17,6 @@ import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.gui.rendering.events.CameraMatrixChangeEvent
|
||||
import de.bixilon.minosoft.gui.rendering.renderer.renderer.AsyncRenderer
|
||||
@ -109,7 +108,6 @@ class SkyRenderer(
|
||||
}
|
||||
|
||||
companion object : RendererBuilder<SkyRenderer> {
|
||||
override val identifier = minosoft("sky")
|
||||
|
||||
override fun build(connection: PlayConnection, context: RenderContext): SkyRenderer {
|
||||
return SkyRenderer(connection, context)
|
||||
|
@ -255,7 +255,6 @@ class CloudRenderer(
|
||||
}
|
||||
|
||||
companion object : RendererBuilder<CloudRenderer> {
|
||||
override val identifier = minosoft("cloud")
|
||||
private val RAIN_COLOR = Vec3(0.31f, 0.35f, 0.40f)
|
||||
private val SUNRISE_COLOR = Vec3(0.85f, 0.68f, 0.36f)
|
||||
private val DAY_COLOR = Vec3(0.95f, 0.97f, 0.97f)
|
||||
|
@ -16,10 +16,8 @@ package de.bixilon.minosoft.terminal
|
||||
import de.bixilon.kutil.shutdown.AbstractShutdownReason
|
||||
import de.bixilon.kutil.shutdown.ShutdownManager
|
||||
import de.bixilon.minosoft.assets.util.AssetsOptions
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.modding.loader.parameters.ModParameters
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.json.Jackson
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import net.sourceforge.argparse4j.ArgumentParsers
|
||||
@ -65,11 +63,6 @@ object CommandLineArguments {
|
||||
.action(Arguments.storeTrue())
|
||||
.help("Disables the server list and rendering")
|
||||
|
||||
addArgument("--skip_renderer")
|
||||
.setDefault(null)
|
||||
.action(Arguments.store())
|
||||
.help("Skips specific renderers")
|
||||
|
||||
addArgument("--connect")
|
||||
.setDefault(null)
|
||||
.action(Arguments.store())
|
||||
@ -132,16 +125,6 @@ object CommandLineArguments {
|
||||
RunConfiguration.DISABLE_RENDERING = true
|
||||
}
|
||||
|
||||
namespace.getString("skip_renderer")?.split(" ", ",", ";")?.let {
|
||||
val skip: MutableList<ResourceLocation> = mutableListOf()
|
||||
|
||||
for (string in it) {
|
||||
skip += string.toResourceLocation()
|
||||
}
|
||||
|
||||
RunConfiguration.SKIP_RENDERERS = skip
|
||||
}
|
||||
|
||||
RunConfiguration.AUTO_CONNECT_TO = namespace.getString("connect")
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ import com.google.common.base.StandardSystemProperty
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.kutil.os.OSTypes
|
||||
import de.bixilon.kutil.os.PlatformInfo
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.modding.loader.parameters.ModParameters
|
||||
import java.io.IOException
|
||||
import java.nio.file.Path
|
||||
@ -51,8 +50,6 @@ object RunConfiguration {
|
||||
|
||||
var APPLICATION_NAME = "Minosoft"
|
||||
|
||||
var SKIP_RENDERERS: List<ResourceLocation> = emptyList()
|
||||
|
||||
var VERBOSE_LOGGING = false
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user