fix: make projector block not piston push-able

This commit is contained in:
xtex 2023-07-26 15:29:20 +08:00
parent df4ad180d7
commit f9e6ffacc1
Signed by: xtex
GPG Key ID: B918086ED8045B91
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.BlockHitResult
object ProjectorBlock : Block(Properties.of()
@ -21,7 +22,9 @@ object ProjectorBlock : Block(Properties.of()
.mapColor(MapColor.COLOR_BLACK)
.randomTicks()
.strength(4.0f)
.requiresCorrectToolForDrops()), EntityBlock {
.requiresCorrectToolForDrops()
.pushReaction(PushReaction.IGNORE)
), EntityBlock {
fun checkUpdate(level: Level, pos: BlockPos) {
if (!level.isClientSide) {

View File

@ -16,7 +16,7 @@ object ProjectionShellItem : Item(
val block = context.level.getBlockState(context.clickedPos).block
if (block is ProjectionShellBlock && context.level.isClientSide) {
ProjectionShell.channel.sendToServer(ServerboundPSHLockAcquirePacket(context.clickedPos))
return InteractionResult.SUCCESS
return InteractionResult.CONSUME
}
return InteractionResult.PASS
}