Proper checking of distance in the bindings for Functional and Generating flowers.

This commit is contained in:
Lizbeth Rika committed 2014-10-09 21:04:25 +01:00
1 parent f4020f6e76
commit 45e2bc2610
2 files changed
+23 -11

No files matched your search

@@ -220,10 +220,16 @@ public class SubTileGenerating extends SubTileEntity {
@Override
public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
if(tile instanceof IManaCollector) {
linkedCollector = tile;
return true;
int range = 6;
range *= range;
double dist = (x - supertile.xCoord) * (x - supertile.xCoord) + (y - supertile.yCoord) * (y - supertile.yCoord) + (z - supertile.zCoord) * (z - supertile.zCoord);
if(range >= dist) {
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
if(tile instanceof IManaCollector) {
linkedCollector = tile;
return true;
}
}
return false;