/// <summary> /// Runs a single tick for the world /// </summary> public override void Tick() { SetWorldTime(GetWorldTime() + 1L); for (int i = 0; i < 10 && EntitySpawnQueue.Count != 0; i++) { Entity entity = EntitySpawnQueue.GetEnumerator().Current; EntitySpawnQueue.Remove(entity); if (!LoadedEntityList.Contains(entity)) { SpawnEntityInWorld(entity); } } SendQueue.ProcessReadPackets(); for (int j = 0; j < BlocksToReceive.Count; j++) { WorldBlockPositionType worldblockpositiontype = BlocksToReceive[j]; if (--worldblockpositiontype.AcceptCountdown == 0) { base.SetBlockAndMetadata(worldblockpositiontype.PosX, worldblockpositiontype.PosY, worldblockpositiontype.PosZ, worldblockpositiontype.BlockID, worldblockpositiontype.Metadata); base.MarkBlockNeedsUpdate(worldblockpositiontype.PosX, worldblockpositiontype.PosY, worldblockpositiontype.PosZ); BlocksToReceive.RemoveAt(j--); } } Field_20915_C.Unload100OldestChunks(); TickBlocksAndAmbiance(); }
/// <summary> /// Invalidates an AABB region of blocks from the receive queue, in the event that the block has been modified /// client-side in the intervening 80 receive ticks. /// </summary> public virtual void InvalidateBlockReceiveRegion(int par1, int par2, int par3, int par4, int par5, int par6) { for (int i = 0; i < BlocksToReceive.Count; i++) { WorldBlockPositionType worldblockpositiontype = BlocksToReceive[i]; if (worldblockpositiontype.PosX >= par1 && worldblockpositiontype.PosY >= par2 && worldblockpositiontype.PosZ >= par3 && worldblockpositiontype.PosX <= par4 && worldblockpositiontype.PosY <= par5 && worldblockpositiontype.PosZ <= par6) { BlocksToReceive.RemoveAt(i--); } } }