コード例 #1
0
    private void updateBlockRadiusEffects()
    {
        Vector3i blockPosition = base.GetBlockPosition();
        int      num           = World.toChunkXZ(blockPosition.x);
        int      num2          = World.toChunkXZ(blockPosition.z);

        this.startedThisFrame = new List <string>();
        for (int i = -1; i < 2; i++)
        {
            for (int j = -1; j < 2; j++)
            {
                Chunk chunk = (Chunk)this.world.GetChunkSync(num + j, num2 + i);
                if (chunk != null)
                {
                    DictionaryList <Vector3i, TileEntity> tileEntities = chunk.GetTileEntities();
                    for (int k = 0; k < tileEntities.list.Count; k++)
                    {
                        TileEntity tileEntity = tileEntities.list[k];
                        if (tileEntity.IsActive(this.world))
                        {
                            BlockValue block  = this.world.GetBlock(tileEntity.ToWorldPos());
                            Block      block2 = Block.list[block.type];
                            if (block2.RadiusEffects != null)
                            {
                                float distanceSq = base.GetDistanceSq(tileEntity.ToWorldPos().ToVector3());
                                for (int l = 0; l < block2.RadiusEffects.Length; l++)
                                {
                                    BlockRadiusEffect blockRadiusEffect = block2.RadiusEffects[l];
                                    if (distanceSq <= blockRadiusEffect.radius * blockRadiusEffect.radius && !this.Buffs.HasBuff(blockRadiusEffect.variable))
                                    {
                                        this.Buffs.AddBuff(blockRadiusEffect.variable, -1, true, false, false);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }