Exemple #1
0
        private void ClearLiquidBlock(int index)
        {
            int posXInChunk = index % _shrinkWidth - shrinkMaxLevel + pos.x;
            int posZInChunk = index / _shrinkWidth - shrinkMaxLevel + pos.z;

//			chunk.world.SetBlock(posXInChunk + chunk.worldPos.x,pos.y + chunk.worldPos.y,posZInChunk + chunk.worldPos.z,air);
//			chunk.world.CheckAndRecalculateMesh(posXInChunk + chunk.worldPos.x,pos.y + chunk.worldPos.y,posZInChunk + chunk.worldPos.z,air);
            BlockDispatcher dispatcher = BlockDispatcherFactory.GetDefaultDispatcher();

            dispatcher.SetBlock(chunk.world, posXInChunk + chunk.worldPos.x, pos.y + chunk.worldPos.y, posZInChunk + chunk.worldPos.z, air, false);
        }
        private void SetLiquidBlock(int index, int level)
        {
            int   posXInChunk = index % _spreadWidth - spreadMaxLevel + pos.x;
            int   posZInChunk = index / _spreadWidth - spreadMaxLevel + pos.z;
            Block liquid      = new Block(liquidType, (byte)level);

            BlockDispatcher dispatcher = BlockDispatcherFactory.GetDefaultDispatcher();

            dispatcher.SetBlock(chunk.world, posXInChunk + chunk.worldPos.x, pos.y + chunk.worldPos.y, posZInChunk + chunk.worldPos.z, liquid, false);
//			SetBlockAndNotify(chunk.world,posXInChunk + chunk.worldPos.x,pos.y + chunk.worldPos.y,posZInChunk + chunk.worldPos.z,liquid);
//			chunk.world.CheckAndRecalculateMesh(posXInChunk + chunk.worldPos.x,pos.y + chunk.worldPos.y,posZInChunk + chunk.worldPos.z,liquid);
        }