Posted September 11, 201510 yr Well i made my 3x3 pickaxe based on player yaw and pitch. I am not happy though. Nit at all. After some testing i saw that the pickaxe is not very accurate. Sometimes instead of doing 3x3 when i am looking down it mines like iam looking forward. Is there a way to get ghe side of the block that i am pointing at. Like north, west, up, down. This way the mining would be pretty accurate without using the player yaw and pitch.
September 11, 201510 yr i dont know if there is a straight way of doing this, but you could try comparing the player's position with the block's position, instead of using the player's view... this might not be the optimal way of achieving your goal, but it may help you get a new vision on the subject
September 11, 201510 yr Author That would still not be very accurate. Another way of doing it is raycasting but i dont know how to use it properly ao i just used a block and place it wherever i am destroying a block so i can get the right position however that brought me Problems with the edges
September 12, 201510 yr I know that the PlayerInteractEvent gives u an EnumFcing with it. So I am pretty sure that there must be a method in ur Item class that gives u an enum facing u can use.
September 12, 201510 yr Another option could be with Minecraft.getMinecraft().objectMouseOver which is the data type MovingObjectPosition. It can be used to reference not only the block position, but the side that was hit as well. I have used this to find the entity that a player is looking at, but should work just as well with blocks. Hope this helps
September 12, 201510 yr public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } found this in 1.8 . mb u can find it in 1.7 too
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.