mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
world border overlay
This commit is contained in:
parent
3f84b769ef
commit
29671aefd8
@ -27,5 +27,10 @@ class OverlayC {
|
|||||||
*/
|
*/
|
||||||
var pumpkin by delegate(true)
|
var pumpkin by delegate(true)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the world boreder overlay
|
||||||
|
*/
|
||||||
|
var worldBorder by delegate(true)
|
||||||
|
|
||||||
val fire = FireC()
|
val fire = FireC()
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,7 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays
|
package de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays
|
||||||
|
|
||||||
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple.PowderSnowOverlay
|
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple.*
|
||||||
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple.PumpkinOverlay
|
|
||||||
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple.WallOverlay
|
|
||||||
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple.WaterOverlay
|
|
||||||
|
|
||||||
object DefaultOverlays {
|
object DefaultOverlays {
|
||||||
val OVERLAYS = listOf(
|
val OVERLAYS = listOf(
|
||||||
@ -25,5 +22,6 @@ object DefaultOverlays {
|
|||||||
PumpkinOverlay,
|
PumpkinOverlay,
|
||||||
PowderSnowOverlay,
|
PowderSnowOverlay,
|
||||||
FireOverlay,
|
FireOverlay,
|
||||||
|
WorldBorderOverlay,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
|||||||
|
|
||||||
class PowderSnowOverlay(renderWindow: RenderWindow, z: Float) : SimpleOverlay(renderWindow, z) {
|
class PowderSnowOverlay(renderWindow: RenderWindow, z: Float) : SimpleOverlay(renderWindow, z) {
|
||||||
private val config = renderWindow.connection.profiles.rendering.overlay
|
private val config = renderWindow.connection.profiles.rendering.overlay
|
||||||
override val texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture("misc/powder_snow_outline".toResourceLocation().texture())
|
override val texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture(OVERLAY_TEXTURE)
|
||||||
private var ticksFrozen: Int = 0
|
private var ticksFrozen: Int = 0
|
||||||
override val render: Boolean
|
override val render: Boolean
|
||||||
get() = config.powderSnow && ticksFrozen > 0
|
get() = config.powderSnow && ticksFrozen > 0
|
||||||
|
@ -23,7 +23,7 @@ import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
|||||||
|
|
||||||
class PumpkinOverlay(renderWindow: RenderWindow, z: Float) : FirstPersonOverlay(renderWindow, z) {
|
class PumpkinOverlay(renderWindow: RenderWindow, z: Float) : FirstPersonOverlay(renderWindow, z) {
|
||||||
private val config = renderWindow.connection.profiles.rendering.overlay
|
private val config = renderWindow.connection.profiles.rendering.overlay
|
||||||
override val texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture("misc/pumpkinblur".toResourceLocation().texture())
|
override val texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture(OVERLAY_TEXTURE)
|
||||||
override val render: Boolean
|
override val render: Boolean
|
||||||
get() {
|
get() {
|
||||||
if (!config.pumpkin) {
|
if (!config.pumpkin) {
|
||||||
@ -41,6 +41,7 @@ class PumpkinOverlay(renderWindow: RenderWindow, z: Float) : FirstPersonOverlay(
|
|||||||
|
|
||||||
|
|
||||||
companion object : OverlayFactory<PumpkinOverlay> {
|
companion object : OverlayFactory<PumpkinOverlay> {
|
||||||
|
private val OVERLAY_TEXTURE = "misc/pumpkinblur".toResourceLocation().texture()
|
||||||
|
|
||||||
override fun build(renderWindow: RenderWindow, z: Float): PumpkinOverlay {
|
override fun build(renderWindow: RenderWindow, z: Float): PumpkinOverlay {
|
||||||
return PumpkinOverlay(renderWindow, z)
|
return PumpkinOverlay(renderWindow, z)
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.gui.rendering.framebuffer.world.overlay.overlays.simple
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.text.RGBColor
|
||||||
|
import de.bixilon.minosoft.gui.rendering.RenderWindow
|
||||||
|
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.OverlayFactory
|
||||||
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
|
||||||
|
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
|
||||||
|
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||||
|
|
||||||
|
class WorldBorderOverlay(renderWindow: RenderWindow, z: Float) : SimpleOverlay(renderWindow, z) {
|
||||||
|
private val config = renderWindow.connection.profiles.rendering.overlay
|
||||||
|
override val texture: AbstractTexture = renderWindow.textureManager.staticTextures.createTexture(OVERLAY_TEXTURE)
|
||||||
|
override val render: Boolean
|
||||||
|
get() = config.worldBorder && renderWindow.connection.world.border.isOutside(renderWindow.connection.player.position)
|
||||||
|
|
||||||
|
override fun update() {
|
||||||
|
tintColor = RGBColor(1.0f, 0.0f, 0.0f, 0.5f) // ToDo: Correct
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
companion object : OverlayFactory<WorldBorderOverlay> {
|
||||||
|
private val OVERLAY_TEXTURE = "misc/vignette".toResourceLocation().texture()
|
||||||
|
|
||||||
|
override fun build(renderWindow: RenderWindow, z: Float): WorldBorderOverlay? {
|
||||||
|
if (renderWindow.connection.assetsManager.nullGet(OVERLAY_TEXTURE) == null) { // ToDo: Don't get twice
|
||||||
|
// overlay not yet available (< 1.17)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return WorldBorderOverlay(renderWindow, z)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user