diff --git a/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java b/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java index ac6ce61..06748e2 100644 --- a/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java +++ b/common/src/main/java/ru/octol1ttle/knockdowns/common/events/KnockdownsEvents.java @@ -2,11 +2,13 @@ package ru.octol1ttle.knockdowns.common.events; import dev.architectury.event.CompoundEventResult; import dev.architectury.event.EventResult; +import dev.architectury.event.events.common.BlockEvent; import dev.architectury.event.events.common.EntityEvent; import dev.architectury.event.events.common.InteractionEvent; import dev.architectury.event.events.common.PlayerEvent; import dev.architectury.event.events.common.TickEvent; import net.minecraft.SharedConstants; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; @@ -126,6 +128,12 @@ public class KnockdownsEvents { } return EventResult.pass(); }); + BlockEvent.PLACE.register((level, pos, state, placer) -> { + if (placer instanceof PlayerEntity player && KnockdownsUtils.isKnockedOrReviving(player)) { + return EventResult.interruptFalse(); + } + return EventResult.pass(); + }); InteractionEvent.RIGHT_CLICK_ITEM.register((player, hand) -> { if (KnockdownsUtils.isKnockedOrReviving(player)) { return CompoundEventResult.interruptFalse(hand == Hand.MAIN_HAND ? player.getMainHandStack() : player.getOffHandStack());