Fix 〃to connect the chain
This commit is contained in:
@@ -537,27 +537,23 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int[] i = {0};
|
final int[] i = {0};
|
||||||
final Array<Tile> chain = new Array<Tile>();
|
|
||||||
lineRequests.each(req -> {
|
lineRequests.each(req -> {
|
||||||
if(!(req.block instanceof PowerNode)) return;
|
if(!(req.block instanceof PowerNode)) return;
|
||||||
|
|
||||||
if(i[0]++ == 0 || i[0] == lineRequests.size){
|
if(i[0]++ == 0 || i[0] == lineRequests.size){
|
||||||
// beginning & end should always be placed
|
// beginning & end should always be placed
|
||||||
}else{
|
}else{
|
||||||
final boolean[] overlaps = {false};
|
int overlaps = 0;
|
||||||
chain.each(tile -> {
|
for(int j = 0; j < i[0]; j++){
|
||||||
if(((PowerNode) req.block).overlaps(req.tile(), tile)){
|
if (((PowerNode) req.block).overlaps(lineRequests.get(i[0]).tile(), lineRequests.get(j).tile()) && lineRequests.get(j).block instanceof PowerNode){
|
||||||
overlaps[0] = true;
|
overlaps++;
|
||||||
};
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
if(overlaps[0]){
|
if(overlaps > 1){
|
||||||
req.block = Blocks.air;
|
req.block = Blocks.air;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chain.add(req.tile());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user