package sig; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.awt.Color; public class BlockClump { private List blocks = new ArrayList(); double x,y; //the lower-left origin of this block clump. Every block positions relative to this. double yspd; int[][] collisionColumnRanges; int maxBlockHeight=0; //Gives the height in blocks. So if the top is 0, this should be 1. int launched = 120; /* Negative is for when block clumps are divided into smaller columns for re-sorting. 0=Ready for split. -1=Ready for merging. -2=Merged (Dead clump) Positive is used for how much landing launch time before being split and falling.*/ public BlockClump(List blockList, double x, double y, double startspd, int width, int launched) { collisionColumnRanges = new int[width][]; for (int i=0;i getBlocks() { return blocks; } public List getSortedBlocksOnRow(int row) { return getBlocks().stream().filter((block)->block.y==row).sorted((b1,b2)->b1.x-b2.x).collect(Collectors.toList()); } public List getSortedBlocksOnCol(int col) { return getBlocks().stream().filter((block)->block.x==col).sorted((b1,b2)->b1.y-b2.y).collect(Collectors.toList()); } private void updateBlockCollisionRangeWithBlock(Block b) { if (collisionColumnRanges[b.x][0]==-1||collisionColumnRanges[b.x][0]>b.y) { collisionColumnRanges[b.x][0]=b.y; } if (collisionColumnRanges[b.x][1]==-1||collisionColumnRanges[b.x][1] blockData) { for (BlockClump bc : blockData) { bc.drawClumpOutlines(g,originX,originY,block_width,block_height); } for (BlockClump bc : blockData) { bc.drawClumpDots(g,originX,originY,block_width,block_height); } } }