@@ -53,9 +53,10 @@ import net.minecraft.text.Text
5353import org.joml.Matrix4fStack
5454import org.joml.Quaternionf
5555
56- class OutlineCapturingQueue (
56+ class OutlineCapturingQueue @JvmOverloads constructor (
5757 private val delegate : OrderedRenderCommandQueueImpl ,
58- private val entityId : Any
58+ private val entityId : Any ,
59+ private val outlineOnly : Boolean = false
5960) : OrderedRenderCommandQueueImpl() {
6061 override fun clear () = delegate.clear()
6162 override fun onNextFrame () = delegate.onNextFrame()
@@ -102,30 +103,37 @@ class OutlineCapturingQueue(
102103 BlockModelRenderer .render(matrices.peek(), consumer, model, r, g, b, l, o)
103104 consumer.flush()
104105 }
105- delegate.submitBlockStateModel(matrices, layer, model, r, g, b, l, o, oc)
106+ if ( ! outlineOnly) delegate.submitBlockStateModel(matrices, layer, model, r, g, b, l, o, oc)
106107 }
107108
108109 override fun getBatchingQueue (i : Int ): BatchingRenderCommandQueue =
109- OutlineCapturingBatchingQueue (delegate.getBatchingQueue(i), this )
110+ OutlineCapturingBatchingQueue (delegate.getBatchingQueue(i), this , outlineOnly )
110111
111112 private inner class OutlineCapturingBatchingQueue (
112113 private val batchedDelegate : BatchingRenderCommandQueue ,
113- parent : OrderedRenderCommandQueueImpl
114+ parent : OrderedRenderCommandQueueImpl ,
115+ private val outlineOnly : Boolean
114116 ) : BatchingRenderCommandQueue(parent) {
115- override fun submitShadowPieces (matrices : MatrixStack , radius : Float , pieces : List <EntityRenderState .ShadowPiece >) =
116- batchedDelegate.submitShadowPieces(matrices, radius, pieces)
117117
118- override fun submitLabel (matrices : MatrixStack , pos : Vec3d ? , y : Int , label : Text , ns : Boolean , l : Int , dist : Double , cam : CameraRenderState ) =
119- batchedDelegate.submitLabel(matrices, pos, y, label, ns, l, dist, cam)
118+ override fun submitShadowPieces (matrices : MatrixStack , radius : Float , pieces : List <EntityRenderState .ShadowPiece >) {
119+ if (! outlineOnly) batchedDelegate.submitShadowPieces(matrices, radius, pieces)
120+ }
121+
122+ override fun submitLabel (matrices : MatrixStack , pos : Vec3d ? , y : Int , label : Text , ns : Boolean , l : Int , dist : Double , cam : CameraRenderState ) {
123+ if (! outlineOnly) batchedDelegate.submitLabel(matrices, pos, y, label, ns, l, dist, cam)
124+ }
120125
121- override fun submitText (matrices : MatrixStack , x : Float , y : Float , text : OrderedText , ds : Boolean , lt : TextRenderer .TextLayerType , l : Int , c : Int , bc : Int , oc : Int ) =
122- batchedDelegate.submitText(matrices, x, y, text, ds, lt, l, c, bc, oc)
126+ override fun submitText (matrices : MatrixStack , x : Float , y : Float , text : OrderedText , ds : Boolean , lt : TextRenderer .TextLayerType , l : Int , c : Int , bc : Int , oc : Int ) {
127+ if (! outlineOnly) batchedDelegate.submitText(matrices, x, y, text, ds, lt, l, c, bc, oc)
128+ }
123129
124- override fun submitFire (matrices : MatrixStack , state : EntityRenderState , rot : Quaternionf ) =
125- batchedDelegate.submitFire(matrices, state, rot)
130+ override fun submitFire (matrices : MatrixStack , state : EntityRenderState , rot : Quaternionf ) {
131+ if (! outlineOnly) batchedDelegate.submitFire(matrices, state, rot)
132+ }
126133
127- override fun submitLeash (matrices : MatrixStack , data : EntityRenderState .LeashData ) =
128- batchedDelegate.submitLeash(matrices, data)
134+ override fun submitLeash (matrices : MatrixStack , data : EntityRenderState .LeashData ) {
135+ if (! outlineOnly) batchedDelegate.submitLeash(matrices, data)
136+ }
129137
130138 override fun submitCustom (matrices : MatrixStack , layer : RenderLayer , renderer : OrderedRenderCommandQueue .Custom ) {
131139 if (layer.isOutline || layer.affectedOutline.isPresent) {
@@ -134,11 +142,12 @@ class OutlineCapturingQueue(
134142 renderer.render(matrices.peek(), baseConsumer)
135143 baseConsumer.flush()
136144 }
137- batchedDelegate.submitCustom(matrices, layer, renderer)
145+ if ( ! outlineOnly) batchedDelegate.submitCustom(matrices, layer, renderer)
138146 }
139147
140- override fun submitCustom (renderer : OrderedRenderCommandQueue .LayeredCustom ) =
141- batchedDelegate.submitCustom(renderer)
148+ override fun submitCustom (renderer : OrderedRenderCommandQueue .LayeredCustom ) {
149+ if (! outlineOnly) batchedDelegate.submitCustom(renderer)
150+ }
142151
143152 override fun <S > submitModel (
144153 model : Model <in S >,
@@ -160,7 +169,7 @@ class OutlineCapturingQueue(
160169 model.render(matrices, consumer, light, overlay, tintedColor)
161170 baseConsumer.flush()
162171 }
163- batchedDelegate.submitModel(model, state, matrices, renderLayer, light, overlay, tintedColor, sprite, outlineColor, crumblingOverlay)
172+ if ( ! outlineOnly) batchedDelegate.submitModel(model, state, matrices, renderLayer, light, overlay, tintedColor, sprite, outlineColor, crumblingOverlay)
164173 }
165174
166175 override fun submitModelPart (
@@ -183,7 +192,7 @@ class OutlineCapturingQueue(
183192 part.render(matrices, consumer, light, overlay, tintedColor)
184193 baseConsumer.flush()
185194 }
186- batchedDelegate.submitModelPart(part, matrices, renderLayer, light, overlay, sprite, sheeted, hasGlint, tintedColor, crumblingOverlay, i)
195+ if ( ! outlineOnly) batchedDelegate.submitModelPart(part, matrices, renderLayer, light, overlay, sprite, sheeted, hasGlint, tintedColor, crumblingOverlay, i)
187196 }
188197
189198 override fun submitBlock (matrices : MatrixStack , state : BlockState , light : Int , overlay : Int , outlineColor : Int ) {
@@ -193,7 +202,7 @@ class OutlineCapturingQueue(
193202 val consumer = CapturingConsumer (null )
194203 BlockModelRenderer .render(matrices.peek(), consumer, model, 1f , 1f , 1f , light, overlay)
195204 consumer.flush()
196- batchedDelegate.submitBlock(matrices, state, light, overlay, outlineColor)
205+ if ( ! outlineOnly) batchedDelegate.submitBlock(matrices, state, light, overlay, outlineColor)
197206 }
198207
199208 override fun submitMovingBlock (matrices : MatrixStack , state : MovingBlockRenderState ) {
@@ -203,11 +212,12 @@ class OutlineCapturingQueue(
203212 val consumer = CapturingConsumer (null )
204213 BlockModelRenderer .render(matrices.peek(), consumer, model, 1f , 1f , 1f , 0 , 0 )
205214 consumer.flush()
206- batchedDelegate.submitMovingBlock(matrices, state)
215+ if ( ! outlineOnly) batchedDelegate.submitMovingBlock(matrices, state)
207216 }
208217
209- override fun submitBlockStateModel (matrices : MatrixStack , layer : RenderLayer , model : BlockStateModel , r : Float , g : Float , b : Float , l : Int , o : Int , oc : Int ) =
210- batchedDelegate.submitBlockStateModel(matrices, layer, model, r, g, b, l, o, oc)
218+ override fun submitBlockStateModel (matrices : MatrixStack , layer : RenderLayer , model : BlockStateModel , r : Float , g : Float , b : Float , l : Int , o : Int , oc : Int ) {
219+ if (! outlineOnly) batchedDelegate.submitBlockStateModel(matrices, layer, model, r, g, b, l, o, oc)
220+ }
211221
212222 override fun submitItem (
213223 matrices : MatrixStack ,
@@ -242,7 +252,7 @@ class OutlineCapturingQueue(
242252 }
243253 }
244254 }
245- batchedDelegate.submitItem(matrices, displayContext, light, overlay, outlineColors, tintLayers, quads, renderLayer, glintType)
255+ if ( ! outlineOnly) batchedDelegate.submitItem(matrices, displayContext, light, overlay, outlineColors, tintLayers, quads, renderLayer, glintType)
246256 }
247257
248258 override fun getShadowPiecesCommands (): List <ShadowPiecesCommand ?>? = batchedDelegate.shadowPiecesCommands
0 commit comments