smol coolant logic cleanup
This commit is contained in:
parent
b05ab4f6ab
commit
b25ddde5c8
|
@ -17,7 +17,7 @@ import java.util.*;
|
|||
public class CoolantBaseBlock extends Block {
|
||||
static Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
static List<Block> VALID_COOLANT_BLOCKS = List.of(Blocks.COMPRESSOR_BLOCK.block().get(), Blocks.COPPER_TUBE_BLOCK.block().get(), Blocks.COOLANT_HEAT_SPREADER_BLOCK.block().get(), Blocks.COOLANT_METERING_BLOCK.block().get());
|
||||
static Set<Block> VALID_COOLANT_BLOCKS = Set.of(Blocks.COMPRESSOR_BLOCK.block().get(), Blocks.COPPER_TUBE_BLOCK.block().get(), Blocks.COOLANT_HEAT_SPREADER_BLOCK.block().get(), Blocks.COOLANT_METERING_BLOCK.block().get());
|
||||
|
||||
public CoolantBaseBlock(Properties p_49795_) {
|
||||
super(p_49795_);
|
||||
|
@ -31,7 +31,7 @@ public class CoolantBaseBlock extends Block {
|
|||
boolean encounteredMetering = false;
|
||||
boolean encounteredCompressor = false;
|
||||
boolean encounteredHeatSpreader = false;
|
||||
List<BlockPos> visitedBlocks = new ArrayList<>();
|
||||
Set<BlockPos> visitedBlocks = new HashSet<>();
|
||||
// If we happened to choose the path that encounters the metering device before a heat spreader, we need to swap our detection system.
|
||||
boolean prematureMetering = false;
|
||||
Direction lastTransitionDirection;
|
||||
|
@ -120,7 +120,7 @@ public class CoolantBaseBlock extends Block {
|
|||
|
||||
// Try to finalise stuff - we gotta have everything in our network.
|
||||
// First, check that the last remaining direction takes us into a block we've already visited (the closed loop)
|
||||
if (visitedBlocks.contains(dirs.values().toArray()[0])) {
|
||||
if (visitedBlocks.contains(dirs.values().iterator().next())) {
|
||||
// Check for premature mode
|
||||
if (prematureMetering) {
|
||||
if (!(encounteredCompressor && encounteredHeatSpreader)) {
|
||||
|
@ -146,8 +146,8 @@ public class CoolantBaseBlock extends Block {
|
|||
LOGGER.info("Discovery took " + (endTime - startTime) + "ms");
|
||||
}
|
||||
|
||||
private Map<Direction, BlockPos> getValidTransitionsFrom(BlockPos pos, Direction incoming, Level level, List<BlockPos> visited) {
|
||||
Map<Direction, BlockPos> dirs = new HashMap<>();
|
||||
private Map<Direction, BlockPos> getValidTransitionsFrom(BlockPos pos, Direction incoming, Level level, Set<BlockPos> visited) {
|
||||
Map<Direction, BlockPos> dirs = new EnumMap<>(Direction.class);
|
||||
for (Direction dir : Direction.values()) {
|
||||
if (incoming != null && dir == incoming) continue;
|
||||
BlockPos newPos = pos.relative(dir);
|
||||
|
|
Loading…
Reference in New Issue
Block a user