Rename world renderer events

This commit is contained in:
nea
2023-06-11 22:35:03 +02:00
parent cfdf89aa1a
commit 74e79759bf
3 changed files with 7 additions and 11 deletions

View File

@@ -25,8 +25,6 @@ import kotlin.math.asin
import kotlin.math.atan2 import kotlin.math.atan2
import kotlin.math.sqrt import kotlin.math.sqrt
import kotlin.time.Duration.Companion.seconds import kotlin.time.Duration.Companion.seconds
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.render.VertexConsumers
import net.minecraft.entity.projectile.FishingBobberEntity import net.minecraft.entity.projectile.FishingBobberEntity
import net.minecraft.particle.ParticleTypes import net.minecraft.particle.ParticleTypes
import net.minecraft.util.math.Vec3d import net.minecraft.util.math.Vec3d
@@ -37,7 +35,7 @@ import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC import moe.nea.firmament.util.MC
import moe.nea.firmament.util.TimeMark import moe.nea.firmament.util.TimeMark
import moe.nea.firmament.util.render.RenderBlockContext.Companion.renderBlocks import moe.nea.firmament.util.render.RenderInWorldContext.Companion.renderInWorld
object FishingWarning : FirmamentFeature { object FishingWarning : FirmamentFeature {
override val name: String override val name: String
@@ -139,7 +137,7 @@ object FishingWarning : FirmamentFeature {
WorldRenderLastEvent.subscribe { WorldRenderLastEvent.subscribe {
recentParticles.removeIf { it.second.passedTime() > 5.seconds } recentParticles.removeIf { it.second.passedTime() > 5.seconds }
recentCandidates.removeIf { it.timeMark.passedTime() > 5.seconds } recentCandidates.removeIf { it.timeMark.passedTime() > 5.seconds }
renderBlocks(it.matrices, it.camera) { renderInWorld(it.matrices, it.camera) {
color(0f, 0f, 1f, 1f) color(0f, 0f, 1f, 1f)
recentParticles.forEach { recentParticles.forEach {
tinyBlock(it.first, 0.1F) tinyBlock(it.first, 0.1F)

View File

@@ -31,7 +31,7 @@ import moe.nea.firmament.util.SBData
import moe.nea.firmament.util.blockPos import moe.nea.firmament.util.blockPos
import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.data.ProfileSpecificDataHolder import moe.nea.firmament.util.data.ProfileSpecificDataHolder
import moe.nea.firmament.util.render.RenderBlockContext.Companion.renderBlocks import moe.nea.firmament.util.render.RenderInWorldContext.Companion.renderInWorld
import moe.nea.firmament.util.unformattedString import moe.nea.firmament.util.unformattedString
@@ -127,7 +127,7 @@ object FairySouls : FirmamentFeature {
} }
WorldRenderLastEvent.subscribe { WorldRenderLastEvent.subscribe {
if (!TConfig.displaySouls) return@subscribe if (!TConfig.displaySouls) return@subscribe
renderBlocks(it.matrices, it.camera) { renderInWorld(it.matrices, it.camera) {
color(1F, 1F, 0F, 0.8F) color(1F, 1F, 0F, 0.8F)
currentMissingSouls.forEach { currentMissingSouls.forEach {
block(it.blockPos) block(it.blockPos)

View File

@@ -24,16 +24,14 @@ import net.minecraft.client.gl.VertexBuffer
import net.minecraft.client.render.BufferBuilder import net.minecraft.client.render.BufferBuilder
import net.minecraft.client.render.Camera import net.minecraft.client.render.Camera
import net.minecraft.client.render.GameRenderer import net.minecraft.client.render.GameRenderer
import net.minecraft.client.render.RenderLayer
import net.minecraft.client.render.Tessellator import net.minecraft.client.render.Tessellator
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.render.VertexFormat import net.minecraft.client.render.VertexFormat
import net.minecraft.client.render.VertexFormats 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
import net.minecraft.util.math.Vec3d import net.minecraft.util.math.Vec3d
class RenderBlockContext private constructor(private val tesselator: Tessellator, private val matrixStack: MatrixStack) { class RenderInWorldContext 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) {
@@ -105,7 +103,7 @@ class RenderBlockContext private constructor(private val tesselator: Tessellator
buf.unfixColor() buf.unfixColor()
} }
fun renderBlocks(matrices: MatrixStack, camera: Camera, block: RenderBlockContext. () -> Unit) { fun renderInWorld(matrices: MatrixStack, camera: Camera, block: RenderInWorldContext. () -> Unit) {
RenderSystem.disableDepthTest() RenderSystem.disableDepthTest()
RenderSystem.enableBlend() RenderSystem.enableBlend()
RenderSystem.defaultBlendFunc() RenderSystem.defaultBlendFunc()
@@ -114,7 +112,7 @@ class RenderBlockContext private constructor(private val tesselator: Tessellator
matrices.push() matrices.push()
matrices.translate(-camera.pos.x, -camera.pos.y, -camera.pos.z) matrices.translate(-camera.pos.x, -camera.pos.y, -camera.pos.z)
val ctx = RenderBlockContext(Tessellator.getInstance(), matrices) val ctx = RenderInWorldContext(Tessellator.getInstance(), matrices)
block(ctx) block(ctx)
matrices.pop() matrices.pop()