Skip to content

Commit 7389e70

Browse files
committed
slab post processing to avoid breaking incomplete double slabs
1 parent 4bbda8a commit 7389e70

File tree

1 file changed

+41
-0
lines changed
  • src/main/kotlin/com/lambda/interaction/construction/simulation/processing/preprocessors/property/placement/post

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2026 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.interaction.construction.simulation.processing.preprocessors.property.placement.post
19+
20+
import com.lambda.context.SafeContext
21+
import com.lambda.interaction.construction.simulation.processing.PreProcessingInfoAccumulator
22+
import com.lambda.interaction.construction.simulation.processing.PropertyPostProcessor
23+
import net.minecraft.block.BlockState
24+
import net.minecraft.block.SlabBlock
25+
import net.minecraft.block.enums.SlabType
26+
import net.minecraft.state.property.Properties
27+
import net.minecraft.util.math.BlockPos
28+
29+
// Collected using reflections and then accessed from a collection in ProcessorRegistry
30+
@Suppress("unused")
31+
object SlabPostProcessor : PropertyPostProcessor {
32+
override fun acceptsState(state: BlockState, targetState: BlockState) =
33+
targetState.block is SlabBlock && targetState.get(Properties.SLAB_TYPE) == SlabType.DOUBLE &&
34+
state.block == targetState.block &&
35+
state.get(Properties.SLAB_TYPE) != SlabType.DOUBLE
36+
37+
context(safeContext: SafeContext)
38+
override fun PreProcessingInfoAccumulator.preProcess(state: BlockState, targetState: BlockState, pos: BlockPos) {
39+
addIgnores(Properties.SLAB_TYPE)
40+
}
41+
}

0 commit comments

Comments
 (0)