Skip to content

Commit

Permalink
Distance check fix for crafting table
Browse files Browse the repository at this point in the history
  • Loading branch information
evermoreobsolete committed Jan 8, 2021
1 parent 2c62ea9 commit 2706805
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,9 @@ public ItemStack onTakeItem(PlayerEntity player, ItemStack stack)
return super.onTakeItem(player, stack);
}
}

@Override
public boolean canUse(PlayerEntity player) {
return this.blockEntity.canPlayerUse(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ public void markDirty() {
}

@Override
public boolean canPlayerUse(PlayerEntity var1) {
return true;
public boolean canPlayerUse(PlayerEntity player) {
if (this.world.getBlockEntity(this.pos) != this) {
return false;
} else {
return player.squaredDistanceTo((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}
}

@Override
Expand Down

0 comments on commit 2706805

Please sign in to comment.