correct lighting for liquid in tank (no glow)

This commit is contained in:
YuRaNnNzZZ 2023-07-01 17:10:06 +03:00
parent c110aed90b
commit dc70b99868
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D

View File

@ -1,6 +1,5 @@
package ru.dbotthepony.mc.otm.client.render.blockentity package ru.dbotthepony.mc.otm.client.render.blockentity
import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.* import com.mojang.blaze3d.vertex.*
import com.mojang.math.Axis import com.mojang.math.Axis
import net.minecraft.client.renderer.* import net.minecraft.client.renderer.*
@ -10,7 +9,6 @@ import net.minecraft.world.inventory.InventoryMenu
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions
import ru.dbotthepony.mc.otm.block.entity.decorative.FluidTankBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.FluidTankBlockEntity
import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.client.render.*
import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.math.RGBAColor
import ru.dbotthepony.mc.otm.core.math.linearInterpolation import ru.dbotthepony.mc.otm.core.math.linearInterpolation
@ -49,8 +47,9 @@ class FluidTankRenderer(private val context: BlockEntityRendererProvider.Context
val interp = linearInterpolation(fluidLevel, sprite.v1, sprite.v0) val interp = linearInterpolation(fluidLevel, sprite.v1, sprite.v0)
val v1 = linearInterpolation(fluidBottom, sprite.v1, sprite.v0) val v1 = linearInterpolation(fluidBottom, sprite.v1, sprite.v0)
val builder = tesselator.builder // val lightLevel = fluid.fluid.fluidType.getLightLevel(fluid) // 0-15
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK)
val builder = bufferSource.getBuffer(Sheets.translucentCullBlockSheet())
poseStack.pushPose() poseStack.pushPose()
poseStack.translate(0f, fluidBottom + (if (gas) 1f - fluidLevel else 0f) * fluidHeight, 0f) poseStack.translate(0f, fluidBottom + (if (gas) 1f - fluidLevel else 0f) * fluidHeight, 0f)
@ -89,14 +88,5 @@ class FluidTankRenderer(private val context: BlockEntityRendererProvider.Context
} }
poseStack.popPose() poseStack.popPose()
RenderSystem.setShader(GameRenderer::getPositionColorTexLightmapShader)
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS)
RenderSystem.enableCull()
RenderSystem.enableBlend()
RenderSystem.enableDepthTest()
BufferUploader.drawWithShader(builder.end())
} }
} }