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

View File

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