Use global buffer source
This commit is contained in:
parent
e88c2ba9b0
commit
90da43ec49
@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack
|
||||
import net.minecraft.client.Camera
|
||||
import net.neoforged.neoforge.client.event.RenderLevelStageEvent
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
||||
|
||||
abstract class AndroidActiveFeature(type: AndroidFeatureType<*>, android: MatteryPlayer) : AndroidSwitchableFeature(type, android) {
|
||||
/**
|
||||
@ -22,5 +23,5 @@ abstract class AndroidActiveFeature(type: AndroidFeatureType<*>, android: Matter
|
||||
*
|
||||
* pose stack has pose pushed already
|
||||
*/
|
||||
abstract fun renderPreview(poseStack: PoseStack, camera: Camera)
|
||||
abstract fun renderPreview(poseStack: PoseStack, camera: Camera, bufferSource: DynamicBufferSource)
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.core.Vec3i
|
||||
import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.sounds.SoundSource
|
||||
@ -323,7 +322,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
|
||||
override val previewRenderStage: RenderLevelStageEvent.Stage
|
||||
get() = RenderLevelStageEvent.Stage.AFTER_PARTICLES
|
||||
|
||||
override fun renderPreview(poseStack: PoseStack, camera: Camera) {
|
||||
override fun renderPreview(poseStack: PoseStack, camera: Camera, bufferSource: DynamicBufferSource) {
|
||||
if (!canUse()) return
|
||||
val (pos, phasedBlocks) = trace()
|
||||
|
||||
@ -350,7 +349,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
|
||||
if (phasedBlocks.isNotEmpty()) {
|
||||
poseStack.popPose()
|
||||
val collisionContext = CollisionContext.of(ply)
|
||||
val builder = source.getBuffer(linesIgnoreZRenderType)
|
||||
val builder = bufferSource.getBuffer(linesIgnoreZRenderType)
|
||||
|
||||
for (blockPos in phasedBlocks) {
|
||||
val blockState = ply.level().getBlockState(blockPos)
|
||||
@ -367,7 +366,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
|
||||
)
|
||||
}
|
||||
|
||||
source.endBatch(linesIgnoreZRenderType)
|
||||
bufferSource.endBatch(linesIgnoreZRenderType)
|
||||
}
|
||||
|
||||
RenderSystem.enableDepthTest()
|
||||
@ -387,10 +386,6 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val source by lazy {
|
||||
DynamicBufferSource(maximalInitialBufferSize = 256)
|
||||
}
|
||||
|
||||
private val SHAPE_CHECK_NOT_FENCE = Block.box(6.0, 17.0, 6.0, 10.0, 31.0, 10.0)
|
||||
private val SHAPE_CHECK_SUPPORT_PLAYER = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0)
|
||||
|
||||
|
@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.client.render.is3DContext
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
||||
import ru.dbotthepony.mc.otm.network.ActivateAndroidFeaturePacket
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@ -83,7 +84,7 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl
|
||||
try {
|
||||
is3DContext = true
|
||||
event.poseStack.pushPose()
|
||||
feature.renderPreview(event.poseStack, event.camera)
|
||||
feature.renderPreview(event.poseStack, event.camera, DynamicBufferSource.WORLD)
|
||||
} finally {
|
||||
is3DContext = false
|
||||
event.poseStack.popPose()
|
||||
|
Loading…
Reference in New Issue
Block a user