mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
A few inconsequential cleanups
This commit is contained in:
6 files changed
+24
-34
No files matched your search
@@ -50,19 +50,16 @@ public class SubTileBubbell extends SubTileFunctional {
|
||||
if(ticksExisted % 10 == 0 && range < getRange())
|
||||
range++;
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
BlockPos pos = supertile.getPos().add(i, j, k);
|
||||
if(MathHelper.pointDistanceSpace(i, j, k, 0, 0, 0) < range) {
|
||||
IBlockState state = supertile.getWorld().getBlockState(pos);
|
||||
if(state.getMaterial() == Material.WATER) {
|
||||
supertile.getWorld().setBlockState(pos, ModBlocks.fakeAir.getDefaultState(), 2);
|
||||
TileFakeAir air = (TileFakeAir) supertile.getWorld().getTileEntity(pos);
|
||||
air.setFlower(supertile);
|
||||
}
|
||||
}
|
||||
for(BlockPos pos : BlockPos.getAllInBoxMutable(getPos().add(-range, -range, -range), getPos().add(range, range, range))) {
|
||||
if(getPos().distanceSq(pos) < range * range) {
|
||||
IBlockState state = supertile.getWorld().getBlockState(pos);
|
||||
if(state.getMaterial() == Material.WATER) {
|
||||
supertile.getWorld().setBlockState(pos, ModBlocks.fakeAir.getDefaultState(), 2);
|
||||
TileFakeAir air = (TileFakeAir) supertile.getWorld().getTileEntity(pos);
|
||||
air.setFlower(supertile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
public boolean bindTo(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
|
||||
boolean bound = super.bindTo(player, wand, pos, side);
|
||||
|
||||
if(!bound && !pos.equals(bindPos) && MathHelper.pointDistanceSpace(pos, supertile.getPos()) <= BIND_RANGE && !(pos.equals(supertile.getPos()))) {
|
||||
if(!bound && !pos.equals(bindPos) && pos.distanceSq(supertile.getPos()) <= BIND_RANGE * BIND_RANGE && !(pos.equals(supertile.getPos()))) {
|
||||
bindPos = pos;
|
||||
sync();
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
|
||||
@Override
|
||||
public boolean bindTo(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
|
||||
if(player.worldObj.getBlockState(pos).getBlock() != ModBlocks.lightRelay || MathHelper.pointDistanceSpace(pos, getPos()) > MAX_DIST)
|
||||
if(player.worldObj.getBlockState(pos).getBlock() != ModBlocks.lightRelay || pos.distanceSq(getPos()) > MAX_DIST * MAX_DIST)
|
||||
return false;
|
||||
|
||||
bindPos = pos;
|
||||
|
||||
@@ -52,10 +52,6 @@ public final class MathHelper {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static float pointDistanceSpace(BlockPos p1, BlockPos p2) {
|
||||
return pointDistanceSpace(p1.getX(), p1.getY(), p1.getZ(), p2.getX(), p2.getY(), p2.getZ());
|
||||
}
|
||||
|
||||
public static float pointDistanceSpace(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
|
||||
}
|
||||
|
||||
@@ -46,23 +46,20 @@ public class ItemObedienceStick extends ItemMod {
|
||||
Actuator act = pool ? Actuator.functionalActuator : Actuator.generatingActuator;
|
||||
int range = pool ? SubTileFunctional.LINK_RANGE : SubTileGenerating.LINK_RANGE;
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
BlockPos pos_ = pos.add(i, j, k);
|
||||
if(MathHelper.pointDistanceSpace(pos_, pos) > range)
|
||||
continue;
|
||||
for(BlockPos pos_ : BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, range, range))) {
|
||||
if(pos_.distanceSq(pos) > range * range)
|
||||
continue;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos_);
|
||||
if(tile instanceof ISubTileContainer) {
|
||||
SubTileEntity subtile = ((ISubTileContainer) tile).getSubTile();
|
||||
if(act.actuate(subtile, tileAt)) {
|
||||
Vector3 orig = new Vector3(pos_.getX() + 0.5, pos_.getY() + 0.5, pos_.getZ() + 0.5);
|
||||
Vector3 end = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
ItemTwigWand.doParticleBeam(world, orig, end);
|
||||
}
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos_);
|
||||
if(tile instanceof ISubTileContainer) {
|
||||
SubTileEntity subtile = ((ISubTileContainer) tile).getSubTile();
|
||||
if(act.actuate(subtile, tileAt)) {
|
||||
Vector3 orig = new Vector3(pos_.getX() + 0.5, pos_.getY() + 0.5, pos_.getZ() + 0.5);
|
||||
Vector3 end = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
ItemTwigWand.doParticleBeam(world, orig, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(player.worldObj.isRemote)
|
||||
player.swingArm(hand);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LensMagnet extends Lens {
|
||||
|
||||
BlockPos srcCoords = burst.getBurstSourceBlockPos();
|
||||
|
||||
if(MathHelper.pointDistanceSpace(tile.getPos(), srcCoords) > 3 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) {
|
||||
if(tile.getPos().distanceSq(srcCoords) > 9 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) {
|
||||
Vector3 burstVec = Vector3.fromEntity(entity);
|
||||
Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0);
|
||||
Vector3 motionVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ);
|
||||
|
||||
Reference in new issue
Block a user