LightingInfoCommand class

Пакет: com.hypixel.hytale.server.core.command.commands.utility.lighting

Файл: com/hypixel/hytale/server/core/command/commands/utility/lighting/LightingInfoCommand.java

extends: AbstractWorldCommand

Поля (9)

МодификаторыТипИмя
BlockSection var10
Store var4
ChunkLightingManager var5
AtomicInteger var6
int var6
AtomicInteger var7
int var7
AtomicInteger var8
BlockChunk var8

Методы (2)

МодификаторыВозвратСигнатура
for for(int var9 = 0; var9 < 10; var9++)
abstract super super("info", "server.commands.lighting.info.desc")

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.utility.lighting;

class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.BlockChunk;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.lighting.ChunkLightingManager;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.concurrent.atomic.AtomicInteger;
class="kw">import javax.annotation.Nonnull;

class="kw">public class LightingInfoCommand class="kw">extends AbstractWorldCommand {
   @Nonnull
   class="kw">private class="kw">final FlagArg detailFlag = this.withFlagArg("detail", "server.commands.lighting.info.detail.desc");

   class="kw">public LightingInfoCommand() {
      super("info", "server.commands.lighting.info.desc");
   }

   @Override
   class="kw">protected void execute(@Nonnull CommandContext var1, @Nonnull World var2, @Nonnull Store<EntityStore> var3) {
      Store var4 = var2.getChunkStore().getStore();
      ChunkLightingManager var5 = var2.getChunkLighting();
      var1.sendMessage(
         Message.translation("server.commands.lighting.info.summary")
            .param("queueSize", var5.getQueueSize())
            .param("lightCalculation", var5.getLightCalculation().getClass().getSimpleName())
      );
      if (this.detailFlag.get(var1)) {
         AtomicInteger var6 = new AtomicInteger();
         AtomicInteger var7 = new AtomicInteger();
         AtomicInteger var8 = new AtomicInteger();
         var4.forEachEntityParallel(WorldChunk.getComponentType(), (var3x, var4x, var5x) -> {
            int var6 = 0;
            int var7 = 0;
            BlockChunk var8 = var4x.getComponent(var3x, BlockChunk.getComponentType());
            assert var8 != null;

            for (int var9 = 0; var9 < 10; var9++) {
               BlockSection var10 = var8.getSectionAtBlockY(var9);
               if (var10.hasLocalLight()) {
                  var6++;
               }

               if (var10.hasGlobalLight()) {
                  var7++;
               }
            }

            var6.getAndAdd(10);
            var7.getAndAdd(var6);
            var8.getAndAdd(var7);
         });
         var1.sendMessage(
            Message.translation("server.commands.lighting.info.chunkDetails")
               .param("totalChunkSections", var6.get())
               .param("chunksWithLocalLight", var7.get())
               .param("chunksWithGlobalLight", var8.get())
         );
      }
   }
}