File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
kotlin/com/lambda/interaction/construction/simulation/processing/preprocessors/property/placement/post Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos
3131@Suppress(" unused" )
3232object 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 )
Original file line number Diff line number Diff line change @@ -22,13 +22,16 @@ import com.lambda.interaction.construction.simulation.processing.PreProcessingIn
2222import com.lambda.interaction.construction.simulation.processing.ProcessorRegistry.standardInteractProperties
2323import com.lambda.interaction.construction.simulation.processing.PropertyPostProcessor
2424import net.minecraft.block.BlockState
25+ import net.minecraft.block.Blocks
26+ import net.minecraft.block.DoorBlock
27+ import net.minecraft.block.TrapdoorBlock
2528import net.minecraft.util.math.BlockPos
2629
2730// Collected using reflections and then accessed from a collection in ProcessorRegistry
2831@Suppress(" unused" )
2932object 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}
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ transitive-accessible method net/minecraft/entity/Entity getFlag (I)Z
3434transitive-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;
3535transitive-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;
3636accessible field net/minecraft/client/world/ClientChunkManager$ClientChunkMap loadedChunkCount I
37+ accessible field net/minecraft/block/TrapdoorBlock blockSetType Lnet/minecraft/block/BlockSetType;
3738
3839# Entity
3940transitive-accessible field net/minecraft/entity/projectile/FireworkRocketEntity shooter Lnet/minecraft/entity/LivingEntity;
You can’t perform that action at this time.
0 commit comments