use Vec3 instead of VisitedCable
This commit is contained in:
@@ -4,23 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import storagecraft.block.BlockCable;
|
||||
|
||||
public class TileCable extends TileSC {
|
||||
class VisitedCable {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public VisitedCable(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCable(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
@@ -41,16 +30,16 @@ public class TileCable extends TileSC {
|
||||
return findMachines(new ArrayList(), true);
|
||||
}
|
||||
|
||||
private List<IMachine> findMachines(List<VisitedCable> visited, boolean ignoreController) {
|
||||
private List<IMachine> findMachines(List<Vec3> visited, boolean ignoreController) {
|
||||
List<IMachine> machines = new ArrayList<IMachine>();
|
||||
|
||||
for (VisitedCable visitedCable : visited) {
|
||||
if (visitedCable.x == xCoord && visitedCable.y == yCoord && visitedCable.z == zCoord) {
|
||||
for (Vec3 visitedCable : visited) {
|
||||
if (visitedCable.xCoord == xCoord && visitedCable.yCoord == yCoord && visitedCable.zCoord == zCoord) {
|
||||
return machines;
|
||||
}
|
||||
}
|
||||
|
||||
visited.add(new VisitedCable(xCoord, yCoord, zCoord));
|
||||
visited.add(Vec3.createVectorHelper(xCoord, yCoord, zCoord));
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
Reference in New Issue
Block a user