mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Proper checking of distance in the bindings for Functional and Generating flowers.
This commit is contained in:
1 parent
f4020f6e76
commit
45e2bc2610
2 files changed
+23
-11
No files matched your search
@@ -184,18 +184,24 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@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 IManaPool) {
|
||||
linkedPool = tile;
|
||||
return true;
|
||||
int range = 10;
|
||||
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 IManaPool) {
|
||||
linkedPool = tile;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user