void HandleOnShrinkPlaneFinish(LiquidShrinkSource source) { source.OnShrinkPlaneFinish -= HandleOnShrinkPlaneFinish; List <WorldPos> list = source.GetNextSpreadSourceList(); for (int i = 0; i < list.Count; i++) { BlockDispatcher dispatcher = BlockDispatcherFactory.GetBlockDispatcher(BlockType.Air); dispatcher.SetBlock(source.chunk.world, list[i].x, list[i].y, list[i].z, new Block(BlockType.Air)); } LiquidShrinkSourceManager.SaveShrinkSource(source); }
public override void NotifySelf(World world, int x, int y, int z, Block oldBlock, Block newBlock) { //重新流动的时候不收缩 if (oldBlock.BlockType == BlockType.FlowingWater && newBlock.BlockType == BlockType.FlowingWater) { return; } LiquidShrinkSource source = LiquidShrinkSourceManager.GetShrinkSource(); source.chunk = world.GetChunk(x, y, z); source.liquidType = oldBlock.BlockType; source.pos = new WorldPos(x - source.chunk.worldPos.x, y - source.chunk.worldPos.y, z - source.chunk.worldPos.z); source.curShrinkLevel = oldBlock.ExtendId > BAC_FlowingWater.waterExtendLevel ? 0 : (int)oldBlock.ExtendId; source.shrinkMaxLevel = BAC_FlowingWater.waterExtendLevel; source.OnShrinkPlaneFinish += HandleOnShrinkPlaneFinish; source.StartShrink(); }