diff --git a/common/src/main/kotlin/quaedam/shell/network/ServerboundPSHLockAcquirePacket.kt b/common/src/main/kotlin/quaedam/shell/network/ServerboundPSHLockAcquirePacket.kt index 39f9147..d394a44 100644 --- a/common/src/main/kotlin/quaedam/shell/network/ServerboundPSHLockAcquirePacket.kt +++ b/common/src/main/kotlin/quaedam/shell/network/ServerboundPSHLockAcquirePacket.kt @@ -6,6 +6,7 @@ import net.minecraft.network.FriendlyByteBuf import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer import quaedam.shell.ProjectionShell +import quaedam.shell.ProjectionShellBlock import quaedam.shell.ProjectionShellMutex import java.util.function.Supplier @@ -33,7 +34,12 @@ data class ServerboundPSHLockAcquirePacket(val pos: BlockPos) { if (!ctx.player.level().isClientSide) { ctx.queue { val player = ctx.player as ServerPlayer - val result = ProjectionShellMutex.tryLock(ctx.player.level() as ServerLevel, pos, player) + val level = ctx.player.level() as ServerLevel + if (level.getBlockState(pos).block !is ProjectionShellBlock) { + ProjectionShell.channel.sendToPlayer(player, ClientboundPSHLockResultPacket(pos, false)) + return@queue + } + val result = ProjectionShellMutex.tryLock(level, pos, player) ProjectionShell.channel.sendToPlayer(player, ClientboundPSHLockResultPacket(pos, result)) } }