Skip to content

Commit

Permalink
Fix placing blocks with rightclick with tools not respecting creative…
Browse files Browse the repository at this point in the history
… mode #1011
  • Loading branch information
bonii-xx committed Sep 23, 2014
1 parent 570edc8 commit 15902fb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/tconstruct/library/tools/HarvestTool.java
Expand Up @@ -191,7 +191,16 @@ public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int
return false;
}

int dmg = nearbyStack.getItemDamage();
int count = nearbyStack.stackSize;

used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
// handle creative mode
if(player.capabilities.isCreativeMode) {
// fun fact: vanilla minecraft does it exactly the same way
nearbyStack.setItemDamage(dmg);
nearbyStack.stackSize = count;
}
if (nearbyStack.stackSize < 1)
{
nearbyStack = null;
Expand Down

0 comments on commit 15902fb

Please sign in to comment.