Actually fix android glitches on death
This commit is contained in:
parent
667553fb3d
commit
32f5b2ece9
@ -17,6 +17,7 @@ import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.GameRenderer
|
||||
import net.minecraft.core.Vec3i
|
||||
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.core.component1
|
||||
@ -24,6 +25,7 @@ import ru.dbotthepony.mc.otm.core.component2
|
||||
import ru.dbotthepony.mc.otm.core.component3
|
||||
import ru.dbotthepony.mc.otm.core.linearInterpolation
|
||||
import ru.dbotthepony.mc.otm.milliTime
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.stream.Collectors
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.ceil
|
||||
@ -415,12 +417,17 @@ object GlitchRenderer {
|
||||
|
||||
private const val GLITCH_BLOCK_SIZE = 8f
|
||||
|
||||
private var lastAndroid: WeakReference<MatteryPlayerCapability>? = null
|
||||
|
||||
@JvmStatic
|
||||
fun render() {
|
||||
if (System.nanoTime() - glitchSince >= glitchUntil && (minecraft.player?.matteryPlayer?.isAndroid != true || minecraft.player?.isAlive != false)) {
|
||||
if (System.nanoTime() - glitchSince >= glitchUntil && ((minecraft.player?.matteryPlayer ?: lastAndroid?.get())?.isAndroid != true || minecraft.player?.isAlive != false)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (lastAndroid?.get() !== minecraft.player?.matteryPlayer)
|
||||
lastAndroid = WeakReference(minecraft.player?.matteryPlayer!!)
|
||||
|
||||
val glitchBuffer = glitchBuffer
|
||||
val projection = RenderSystem.getProjectionMatrix()
|
||||
RenderSystem.setProjectionMatrix(Matrix4f().also { it.setIdentity() })
|
||||
|
Loading…
Reference in New Issue
Block a user