EntityPlayer player = (EntityPlayer) event.entity;
int posX = (int) Math.floor(player.posX);
int posY = (int) Math.floor(player.posY);
int posZ = (int) Math.floor(player.posZ);
if (player.inventory.getCurrentItem() != null) {
if (player.inventory.getCurrentItem().getItem() instanceof Item) {
player.worldObj.setBlock(posX, posY + 5, posZ, block);
}
}
When I use this code, it places 2 blocks above my head when I'm grounded, but when I fly, it places 2 blocks above my head with a block of air in between. Is there any way I can get the coords of my feet or something to return a more stable Y value? Thank you!