Fix color not being reset after block highlights
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package moe.nea.notenoughupdates.features
|
package moe.nea.notenoughupdates.features
|
||||||
|
|
||||||
|
import moe.nea.notenoughupdates.util.config.ManagedConfig
|
||||||
|
|
||||||
interface NEUFeature {
|
interface NEUFeature {
|
||||||
val name: String
|
val name: String
|
||||||
val identifier: String
|
val identifier: String
|
||||||
@@ -10,7 +12,7 @@ interface NEUFeature {
|
|||||||
set(value) {
|
set(value) {
|
||||||
FeatureManager.setEnabled(identifier, value)
|
FeatureManager.setEnabled(identifier, value)
|
||||||
}
|
}
|
||||||
|
val config: ManagedConfig? get() = null
|
||||||
fun onLoad()
|
fun onLoad()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package moe.nea.notenoughupdates.features.world
|
|||||||
import io.github.moulberry.repo.data.Coordinate
|
import io.github.moulberry.repo.data.Coordinate
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.serializer
|
import kotlinx.serialization.serializer
|
||||||
import net.minecraft.client.MinecraftClient
|
|
||||||
import net.minecraft.util.math.BlockPos
|
|
||||||
import moe.nea.notenoughupdates.events.ServerChatLineReceivedEvent
|
import moe.nea.notenoughupdates.events.ServerChatLineReceivedEvent
|
||||||
import moe.nea.notenoughupdates.events.SkyblockServerUpdateEvent
|
import moe.nea.notenoughupdates.events.SkyblockServerUpdateEvent
|
||||||
import moe.nea.notenoughupdates.events.WorldRenderLastEvent
|
import moe.nea.notenoughupdates.events.WorldRenderLastEvent
|
||||||
@@ -12,26 +10,32 @@ import moe.nea.notenoughupdates.features.NEUFeature
|
|||||||
import moe.nea.notenoughupdates.repo.RepoManager
|
import moe.nea.notenoughupdates.repo.RepoManager
|
||||||
import moe.nea.notenoughupdates.util.MC
|
import moe.nea.notenoughupdates.util.MC
|
||||||
import moe.nea.notenoughupdates.util.SBData
|
import moe.nea.notenoughupdates.util.SBData
|
||||||
|
import moe.nea.notenoughupdates.util.blockPos
|
||||||
import moe.nea.notenoughupdates.util.config.ManagedConfig
|
import moe.nea.notenoughupdates.util.config.ManagedConfig
|
||||||
import moe.nea.notenoughupdates.util.data.ProfileSpecificDataHolder
|
import moe.nea.notenoughupdates.util.data.ProfileSpecificDataHolder
|
||||||
import moe.nea.notenoughupdates.util.render.RenderBlockContext.Companion.renderBlocks
|
import moe.nea.notenoughupdates.util.render.RenderBlockContext.Companion.renderBlocks
|
||||||
import moe.nea.notenoughupdates.util.unformattedString
|
import moe.nea.notenoughupdates.util.unformattedString
|
||||||
|
|
||||||
val Coordinate.blockPos: BlockPos
|
|
||||||
get() = BlockPos(x, y, z)
|
|
||||||
|
|
||||||
object FairySouls : NEUFeature,
|
object FairySouls : NEUFeature {
|
||||||
ProfileSpecificDataHolder<FairySouls.Config>(serializer(), "found-fairysouls", ::Config) {
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Config(
|
data class Data(
|
||||||
val foundSouls: MutableMap<String, MutableSet<Int>> = mutableMapOf()
|
val foundSouls: MutableMap<String, MutableSet<Int>> = mutableMapOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override val config: ManagedConfig
|
||||||
|
get() = TConfig
|
||||||
|
|
||||||
|
object DConfig : ProfileSpecificDataHolder<Data>(serializer(), "found-fairysouls", ::Data)
|
||||||
|
|
||||||
|
|
||||||
object TConfig : ManagedConfig("fairysouls") {
|
object TConfig : ManagedConfig("fairysouls") {
|
||||||
|
|
||||||
val displaySouls by toggle("show") { false }
|
val displaySouls by toggle("show") { false }
|
||||||
val resetSouls by button("reset") {
|
val resetSouls by button("reset") {
|
||||||
FairySouls.data?.foundSouls?.clear() != null
|
DConfig.data?.foundSouls?.clear() != null
|
||||||
updateMissingSouls()
|
updateMissingSouls()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +53,7 @@ object FairySouls : NEUFeature,
|
|||||||
|
|
||||||
fun updateMissingSouls() {
|
fun updateMissingSouls() {
|
||||||
currentMissingSouls = emptyList()
|
currentMissingSouls = emptyList()
|
||||||
val c = data ?: return
|
val c = DConfig.data ?: return
|
||||||
val fi = c.foundSouls[currentLocationName] ?: setOf()
|
val fi = c.foundSouls[currentLocationName] ?: setOf()
|
||||||
val cms = currentLocationSouls.toMutableList()
|
val cms = currentLocationSouls.toMutableList()
|
||||||
fi.asSequence().sortedDescending().filter { it in cms.indices }.forEach { cms.removeAt(it) }
|
fi.asSequence().sortedDescending().filter { it in cms.indices }.forEach { cms.removeAt(it) }
|
||||||
@@ -77,11 +81,11 @@ object FairySouls : NEUFeature,
|
|||||||
|
|
||||||
private fun markNearestSoul() {
|
private fun markNearestSoul() {
|
||||||
val nearestSoul = findNearestClickableSoul() ?: return
|
val nearestSoul = findNearestClickableSoul() ?: return
|
||||||
val c = data ?: return
|
val c = DConfig.data ?: return
|
||||||
val loc = currentLocationName ?: return
|
val loc = currentLocationName ?: return
|
||||||
val idx = currentLocationSouls.indexOf(nearestSoul)
|
val idx = currentLocationSouls.indexOf(nearestSoul)
|
||||||
c.foundSouls.computeIfAbsent(loc) { mutableSetOf() }.add(idx)
|
c.foundSouls.computeIfAbsent(loc) { mutableSetOf() }.add(idx)
|
||||||
markDirty()
|
DConfig.markDirty()
|
||||||
updateMissingSouls()
|
updateMissingSouls()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package moe.nea.notenoughupdates.util
|
package moe.nea.notenoughupdates.util
|
||||||
|
|
||||||
|
import io.github.moulberry.repo.data.Coordinate
|
||||||
import net.minecraft.client.MinecraftClient
|
import net.minecraft.client.MinecraftClient
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
|
||||||
object MC {
|
object MC {
|
||||||
inline val player get() = MinecraftClient.getInstance().player
|
inline val player get() = MinecraftClient.getInstance().player
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val Coordinate.blockPos: BlockPos
|
||||||
|
get() = BlockPos(x, y, z)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import net.minecraft.client.render.VertexFormats
|
|||||||
import net.minecraft.client.util.math.MatrixStack
|
import net.minecraft.client.util.math.MatrixStack
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
|
|
||||||
class RenderBlockContext(private val tesselator: Tessellator, private val matrixStack: MatrixStack) {
|
class RenderBlockContext private constructor(private val tesselator: Tessellator, private val matrixStack: MatrixStack) {
|
||||||
private val buffer = tesselator.buffer
|
private val buffer = tesselator.buffer
|
||||||
fun color(red: Float, green: Float, blue: Float, alpha: Float) {
|
fun color(red: Float, green: Float, blue: Float, alpha: Float) {
|
||||||
RenderSystem.setShaderColor(red, green, blue, alpha)
|
RenderSystem.setShaderColor(red, green, blue, alpha)
|
||||||
@@ -83,6 +83,7 @@ class RenderBlockContext(private val tesselator: Tessellator, private val matrix
|
|||||||
|
|
||||||
matrices.pop()
|
matrices.pop()
|
||||||
|
|
||||||
|
RenderSystem.setShaderColor(1F,1F,1F,1F)
|
||||||
VertexBuffer.unbind()
|
VertexBuffer.unbind()
|
||||||
RenderSystem.enableDepthTest()
|
RenderSystem.enableDepthTest()
|
||||||
RenderSystem.disableBlend()
|
RenderSystem.disableBlend()
|
||||||
|
|||||||
Reference in New Issue
Block a user