remove an unnecessary method

This commit is contained in:
Ell 2020-10-13 19:00:11 +02:00
parent 03a798649a
commit cafa3f39c2
2 changed files with 8 additions and 13 deletions

View file

@ -297,15 +297,6 @@ public class PipeNetwork implements ICapabilitySerializable<CompoundNBT>, GraphL
return null;
}
public List<PipeTileEntity> getNetworkNodes(BlockPos pos, Predicate<PipeTileEntity> predicate) {
if (!this.isNode(pos))
return Collections.emptyList();
return this.getOrderedNetworkNodes(pos).stream()
.map(this::getPipe)
.filter(predicate)
.collect(Collectors.toList());
}
private List<NetworkEdge> createAllEdges(BlockPos pos, BlockState state, boolean ignoreCurrBlocked) {
this.startProfile("create_all_edges");
List<NetworkEdge> edges = new ArrayList<>();
@ -361,7 +352,9 @@ public class PipeNetwork implements ICapabilitySerializable<CompoundNBT>, GraphL
return null;
}
private List<BlockPos> getOrderedNetworkNodes(BlockPos node) {
public List<BlockPos> getOrderedNetworkNodes(BlockPos node) {
if (!this.isNode(node))
return Collections.emptyList();
List<BlockPos> ret = this.nodeToConnectedNodes.get(node);
if (ret == null) {
this.startProfile("compile_connected_nodes");

View file

@ -304,11 +304,13 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide
}
private PressurizerTileEntity findPressurizer() {
for (PipeTileEntity node : PipeNetwork.get(this.world).getNetworkNodes(this.pos, p -> true)) {
PipeNetwork network = PipeNetwork.get(this.world);
for (BlockPos node : network.getOrderedNetworkNodes(this.pos)) {
PipeTileEntity pipe = network.getPipe(node);
for (Direction dir : Direction.values()) {
IPipeConnectable connectable = node.getPipeConnectable(dir);
IPipeConnectable connectable = pipe.getPipeConnectable(dir);
if (connectable instanceof PressurizerBlock)
return Utility.getTileEntity(PressurizerTileEntity.class, this.world, node.pos.offset(dir));
return Utility.getTileEntity(PressurizerTileEntity.class, this.world, node.offset(dir));
}
}
return null;