Jump to content

Recommended Posts

Posted

https://bitbucket.org/makerimages/electronica-engineered

 

Issue 5 and commit 8c31178 are related to this.

 

When I go to place down a bucket, it will place it INTO the block i clicked on, not the block that is on the face I clicked on, like it shoud do. Also, it wont empty the bucket. And the water wont immediately start flowing aswell.

 

If you can help me with that, you could please try out issue 5 part 2 aswell(the things i classified "Creative  only")

 

thanks!

 

Posted

Do you have any code that decides what side you clicked on and responds accordingly?

This is what you may be missing:

int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ;

if (!world.canMineBlock(player, x, y, z)) {
return item;
}
if (movingobjectposition.sideHit == 0) {
y--;
}
if (movingobjectposition.sideHit == 1) {
y++;
}
if (movingobjectposition.sideHit == 2) {
z--;
}
if (movingobjectposition.sideHit == 3) {
z++;
}
if (movingobjectposition.sideHit == 4) {
x--;
}
if (movingobjectposition.sideHit == 5) {
x++;
}

 

Try to understand what is happening here. The position of the block that has been hit is x, y, z. The side which the player hits the block is being checked, and depending on which side is hit, the x, y or z value is being decremented or incremented by 1, thus moving the position of the new block to put down out of the block that is hit.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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