Removed WorldIterator.java and WorldIteratorRadius.java since they are no longer used anywhere else.

Also small change and cleanup
This commit is contained in:
psxlover 2012-06-14 22:04:29 +03:00
parent 90905e38b3
commit 6540aed3f9
4 changed files with 1 additions and 98 deletions

View file

@ -62,7 +62,6 @@ import net.minecraft.src.buildcraft.core.BptPlayerIndex;
import net.minecraft.src.buildcraft.core.BptRootIndex;
import net.minecraft.src.buildcraft.core.CoreProxy;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.WorldIteratorRadius;
import net.minecraft.src.forge.Configuration;
import net.minecraft.src.forge.MinecraftForge;
import net.minecraft.src.forge.Property;
@ -281,9 +280,6 @@ public class BuildCraftBuilders {
new BptBlockWallSide(pathMarkerBlock.blockID);
new BptBlockFiller(fillerBlock.blockID);
// Optimization
WorldIteratorRadius.createPrecomputedList(TilePathMarker.searchSize);
if (BuildCraftCore.loadDefaultRecipes)
loadRecipes();
}

View file

@ -73,11 +73,6 @@ public class TilePathMarker extends TileMarker {
double nearestDistance = 0, distance; //The initialization of nearestDistance is only to make the compiler shut up
for (TilePathMarker t : availableMarkers) {
if (t.isFullyConnected()) {
System.err.printf("Removing the non-available path markers isn't correct\n");
continue;
}
if (t == this || t == this.links[0] || t == this.links[1])
continue;
@ -101,7 +96,7 @@ public class TilePathMarker extends TileMarker {
return;
}
tryingToConnect = true;
tryingToConnect = !tryingToConnect; //Allow the user to stop the path marker from searching for new path markers to connect
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
}

View file

@ -1,30 +0,0 @@
package net.minecraft.src.buildcraft.core;
import java.util.Iterator;
import net.minecraft.src.World;
public abstract class WorldIterator {
protected World world;
protected int x;
protected int y;
protected int z;
protected Iterator<BlockIndex> iterator;
public WorldIterator(World world, int x, int y, int z) {
this.world = world;
this.x = x;
this.y = y;
this.z = z;
}
public BlockIndex iterate() {
if (iterator.hasNext())
return iterator.next();
else
return null;
}
}

View file

@ -1,58 +0,0 @@
package net.minecraft.src.buildcraft.core;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import net.minecraft.src.World;
public class WorldIteratorRadius extends WorldIterator {
@SuppressWarnings("unchecked")
private static LinkedList<BlockIndex>[] lists = new LinkedList[65];
public WorldIteratorRadius(World world, int px, int py, int pz, int radius) {
super(world, px, py, pz);
createPrecomputedList(radius);
iterator = lists[radius].iterator();
}
@Override
public BlockIndex iterate() {
if (iterator.hasNext()) {
BlockIndex b = iterator.next();
return new BlockIndex(b.i + x, b.j + y, b.k + z);
} else
return null;
}
public static void createPrecomputedList(int radius) {
if (lists[radius] == null) {
lists[radius] = new LinkedList<BlockIndex>();
for (int i = -radius; i <= radius; ++i)
for (int j = -radius; j <= radius; ++j)
for (int k = -radius; k <= radius; ++k)
lists[radius].add(new BlockIndex(i, j, k));
Collections.sort(lists[radius], new Comparator<BlockIndex>() {
@Override
public int compare(BlockIndex o1, BlockIndex o2) {
double d1 = o1.i * o1.i + o1.j * o1.j + o1.k * o1.k;
double d2 = o2.i * o2.i + o2.j * o2.j + o2.k * o2.k;
if (d1 < d2)
return -1;
else if (d1 > d2)
return 1;
else
return 0;
}
});
}
}
}