@@ -27,6 +27,7 @@ import com.lambda.util.extension.outlineShape
2727import net.minecraft.block.BlockState
2828import net.minecraft.block.entity.BlockEntity
2929import net.minecraft.entity.Entity
30+ import net.minecraft.util.math.BlockBox
3031import net.minecraft.util.math.BlockPos
3132import net.minecraft.util.math.Box
3233import net.minecraft.util.shape.VoxelShape
@@ -104,30 +105,28 @@ class ShapeBuilder(
104105 color : Color ,
105106 sides : Int = DirectionMask .ALL ,
106107 ) = runSafe { faces.apply {
107- val shape = state.getOutlineShape(world, pos)
108- filled(shape, color, sides)
108+ val shape = outlineShape(state, pos)
109+ if (shape.isEmpty) {
110+ filled(Box (pos), color, sides)
111+ } else {
112+ filled(shape, color, sides)
113+ }
109114 } }
110115
111116 @ShapeDsl
112117 fun filled (
113118 pos : BlockPos ,
114119 color : Color ,
115120 sides : Int = DirectionMask .ALL ,
116- ) = runSafe { faces.apply {
117- val shape = blockState(pos).getOutlineShape(world, pos)
118- filled(shape, color, sides)
119- } }
121+ ) = runSafe { faces.apply { filled(pos, blockState(pos), color, sides) } }
120122
121123 @ShapeDsl
122124 fun filled (
123125 pos : BlockPos ,
124126 entity : BlockEntity ,
125127 color : Color ,
126128 sides : Int = DirectionMask .ALL ,
127- ) = runSafe {
128- val shape = outlineShape(entity.cachedState, pos)
129- filled(shape, color, sides)
130- }
129+ ) = filled(pos, entity.cachedState, color, sides)
131130
132131 @ShapeDsl
133132 fun filled (
@@ -243,8 +242,12 @@ class ShapeBuilder(
243242 sides : Int = DirectionMask .ALL ,
244243 mode : DirectionMask .OutlineMode = DirectionMask .OutlineMode .OR ,
245244 ) = runSafe {
246- val shape = state.getOutlineShape(world, pos)
247- outline(shape, color, sides, mode)
245+ val shape = outlineShape(state, pos)
246+ if (shape.isEmpty) {
247+ outline(Box (pos), color, sides, mode)
248+ } else {
249+ outline(shape, color, sides, mode)
250+ }
248251 }
249252
250253 @ShapeDsl
@@ -253,10 +256,7 @@ class ShapeBuilder(
253256 color : Color ,
254257 sides : Int = DirectionMask .ALL ,
255258 mode : DirectionMask .OutlineMode = DirectionMask .OutlineMode .OR ,
256- ) = runSafe {
257- val shape = blockState(pos).getOutlineShape(world, pos)
258- outline(shape, color, sides, mode)
259- }
259+ ) = runSafe { outline(pos, blockState(pos), color, sides, mode) }
260260
261261 @ShapeDsl
262262 fun outline (
@@ -265,10 +265,7 @@ class ShapeBuilder(
265265 color : Color ,
266266 sides : Int = DirectionMask .ALL ,
267267 mode : DirectionMask .OutlineMode = DirectionMask .OutlineMode .OR ,
268- ) = runSafe {
269- val shape = outlineShape(entity.cachedState, pos)
270- outline(shape, color, sides, mode)
271- }
268+ ) = runSafe { outline(pos, entity.cachedState, color, sides, mode) }
272269
273270 @ShapeDsl
274271 fun outline (
@@ -300,9 +297,8 @@ class ShapeBuilder(
300297 sides : Int = DirectionMask .ALL ,
301298 mode : DirectionMask .OutlineMode = DirectionMask .OutlineMode .OR ,
302299 ) = runSafe {
303- val shape = state.getOutlineShape(world, pos)
304- filled(shape, filled, sides)
305- outline(shape, outline, sides, mode)
300+ filled(pos, state, filled, sides)
301+ outline(pos, state, outline, sides, mode)
306302 }
307303
308304 @ShapeDsl
0 commit comments