Skip to content

Commit 9f1feb4

Browse files
committed
fix doors and trapdoors preprocessing to check for canOpenByHand
1 parent d75b9ee commit 9f1feb4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/main/kotlin/com/lambda/interaction/construction/simulation/processing/preprocessors/property/placement/post/ChestPostProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos
3131
@Suppress("unused")
3232
object ChestPostProcessor : PropertyPostProcessor {
3333
override fun acceptsState(state: BlockState, targetState: BlockState) =
34-
state.block is ChestBlock && state.block === targetState.block &&
34+
targetState.block is ChestBlock &&
3535
Properties.CHEST_TYPE in state && Properties.HORIZONTAL_FACING in state &&
3636
state.get(Properties.HORIZONTAL_FACING) == targetState.get(Properties.HORIZONTAL_FACING) &&
3737
state.get(Properties.CHEST_TYPE) != targetState.get(Properties.CHEST_TYPE)

src/main/kotlin/com/lambda/interaction/construction/simulation/processing/preprocessors/property/placement/post/StandardInteractPostProcessor.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ import com.lambda.interaction.construction.simulation.processing.PreProcessingIn
2222
import com.lambda.interaction.construction.simulation.processing.ProcessorRegistry.standardInteractProperties
2323
import com.lambda.interaction.construction.simulation.processing.PropertyPostProcessor
2424
import net.minecraft.block.BlockState
25+
import net.minecraft.block.Blocks
26+
import net.minecraft.block.DoorBlock
27+
import net.minecraft.block.TrapdoorBlock
2528
import net.minecraft.util.math.BlockPos
2629

2730
// Collected using reflections and then accessed from a collection in ProcessorRegistry
2831
@Suppress("unused")
2932
object StandardInteractPostProcessor : PropertyPostProcessor {
3033
override fun acceptsState(state: BlockState, targetState: BlockState) =
31-
standardInteractProperties.any {
34+
state.canBeModifiedByHand() && standardInteractProperties.any {
3235
it in targetState && state.get(it) != targetState.get(it)
3336
}
3437

@@ -37,4 +40,11 @@ object StandardInteractPostProcessor : PropertyPostProcessor {
3740
setItem(null)
3841
setPlacing(false)
3942
}
43+
44+
fun BlockState.canBeModifiedByHand() =
45+
when (val block = block) {
46+
is DoorBlock -> block.blockSetType.canOpenByHand
47+
is TrapdoorBlock -> block.blockSetType.canOpenByHand
48+
else -> true
49+
}
4050
}

src/main/resources/lambda.accesswidener

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ transitive-accessible method net/minecraft/entity/Entity getFlag (I)Z
3434
transitive-accessible method net/minecraft/block/ChestBlock getChestType (Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Lnet/minecraft/block/enums/ChestType;
3535
transitive-accessible method net/minecraft/block/ChestBlock getNeighborChestDirection (Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Lnet/minecraft/util/math/Direction;
3636
accessible field net/minecraft/client/world/ClientChunkManager$ClientChunkMap loadedChunkCount I
37+
accessible field net/minecraft/block/TrapdoorBlock blockSetType Lnet/minecraft/block/BlockSetType;
3738

3839
# Entity
3940
transitive-accessible field net/minecraft/entity/projectile/FireworkRocketEntity shooter Lnet/minecraft/entity/LivingEntity;

0 commit comments

Comments
 (0)