Posted June 1, 201411 yr When I do: world.setBlock((int) player.posX, (int) player.posY - 1, (int) player.posZ, 0); It doesn't set the block under you to air, its sets one over to air, what causes this? Is it the changing from double to int? If so, how would I get player coords correctly.
June 1, 201411 yr Hi The player Y position is at your feet or at your eyes depending on whether you're on the server or on the client. I forget which. The eye height is found using EntityPlayer.getDefaultEyeHeight(); I'm pretty sure you don't need it though, if you are setting blocks on the server. Are you calling this method on the client side? -TGG
June 1, 201411 yr Looking at the code in Entity that calls the onEntityWalking() method, this is how it detects the block being walked on. Note that they include yOffset plus some other fixed displacement. int j1 = MathHelper.floor_double(this.posX); k = [color=blue]MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);[/color] int l = MathHelper.floor_double(this.posZ); Block block = this.worldObj.getBlock(j1, k, l); int i1 = this.worldObj.getBlock(j1, k - 1, l).getRenderType(); if (i1 == 11 || i1 == 32 || i1 == 21) { block = this.worldObj.getBlock(j1, k - 1, l); } Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.