diff --git a/src/main/java/fi/dy/masa/litematica/mixin/MixinClientPlayerEntity.java b/src/main/java/fi/dy/masa/litematica/mixin/MixinClientPlayerEntity.java index c68eca0e7..9da3cfdba 100644 --- a/src/main/java/fi/dy/masa/litematica/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/fi/dy/masa/litematica/mixin/MixinClientPlayerEntity.java @@ -16,6 +16,7 @@ import net.minecraft.entity.MovementType; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Property; @@ -109,7 +110,7 @@ private boolean tryToPlaceBlock(BlockPos pos) { Vec3d posVec = Vec3d.ofCenter(pos); - Direction schDir = getBlockDirection(state); + Direction facing = getBlockDirection(state); int half = getBlockHalf(state); for(Direction side : Direction.values()) { @@ -129,6 +130,14 @@ private boolean tryToPlaceBlock(BlockPos pos) { hitVec = hitVec.add(0, -0.25, 0); } + if (facing != null) { + float yaw = dir.asRotation(); + float pitch = client.player.pitch; + + client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly( + yaw, pitch, client.player.isOnGround())); + } + ((IClientPlayerInteractionManager) client.interactionManager).rightClickBlock(neighbor, side.getOpposite(), hitVec);