Jump to content

minecraftman215

Members
  • Posts

    1
  • Joined

  • Last visited

minecraftman215's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi, I have the code: private static void placeBlock(final BlockPos pos, final boolean spoofRotation) { if (!this.mc.world.getBlockState(pos).getMaterial().isReplaceable()) { Command.sendChatMessage("BLOCK WAS UNABLE TO BE PLACED :("); return; } for (final EnumFacing side : EnumFacing.values()) { final BlockPos neighbor = pos.offset(side); final EnumFacing side2 = side.getOpposite(); if (this.mc.world.getBlockState(neighbor).getBlock().canCollideCheck(this.mc.world.getBlockState(neighbor), false)) { final Vec3d hitVec = new Vec3d((Vec3i)neighbor).add(0.5, 0.5, 0.5).add(new Vec3d(side2.getDirectionVec()).scale(0.5)); if (spoofRotation) { final Vec3d eyesPos = new Vec3d(this.mc.player.posX, this.mc.player.posY + this.mc.player.getEyeHeight(), this.mc.player.posZ); final double diffX = hitVec.x - eyesPos.x; final double diffY = hitVec.y - eyesPos.y; final double diffZ = hitVec.z - eyesPos.z; final double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); final float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0f; final float pitch = (float)(-Math.toDegrees(Math.atan2(diffY, diffXZ))); this.mc.player.connection.sendPacket((Packet)new CPacketPlayer.Rotation(this.mc.player.rotationYaw + MathHelper.wrapDegrees(yaw - this.mc.player.rotationYaw), this.mc.player.rotationPitch + MathHelper.wrapDegrees(pitch - this.mc.player.rotationPitch), this.mc.player.onGround)); } this.mc.playerController.processRightClickBlock(this.mc.player, this.mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); this.mc.player.swingArm(EnumHand.MAIN_HAND); this.mc.rightClickDelayTimer = 4; return; } } } however upon placing a block such as a dispenser, its orientation seems random. I was wondering if there was a way to Specify which way it should be facing (north, west etc) Ive searched around and have no idea where to start, thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.