ChunkResendCommand class

Пакет: com.hypixel.hytale.server.core.command.commands.world.chunk

Файл: com/hypixel/hytale/server/core/command/commands/world/chunk/ChunkResendCommand.java

extends: AbstractTargetPlayerCommand

Поля (12)

МодификаторыТипИмя
Vector3d var10
int var11
int var12
ChunkStore var13
Store var14
SpiralIterator var15
long var16
Ref var18
BlockChunk var19
Player var7
ChunkTracker var8
TransformComponent var9

Методы (3)

МодификаторыВозвратСигнатура
for for(int var20 = 0; var20 < 10; var20++)
if if(var19 != null)
abstract super super("resend", "server.commands.chunk.resend.desc")

Исходный код

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

class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.iterator.SpiralIterator;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.protocol.packets.world.ClearChunks;
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.AbstractTargetPlayerCommand;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.player.ChunkTracker;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
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.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;

class="kw">public class ChunkResendCommand class="kw">extends AbstractTargetPlayerCommand {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_CHUNK_RESEND_UNLOADED_ALL = Message.translation("server.commands.chunk.resend.unloadedAll");
   @Nonnull
   class="kw">private class="kw">final FlagArg clearCacheArg = this.withFlagArg("clearcache", "server.commands.chunk.resend.clearcache.desc");

   class="kw">public ChunkResendCommand() {
      super("resend", "server.commands.chunk.resend.desc");
   }

   @Override
   class="kw">protected void execute(
      @Nonnull CommandContext var1,
      @Nullable Ref<EntityStore> var2,
      @Nonnull Ref<EntityStore> var3,
      @Nonnull PlayerRef var4,
      @Nonnull World var5,
      @Nonnull Store<EntityStore> var6
   ) {
      Player var7 = var6.getComponent(var3, Player.getComponentType());
      assert var7 != null;
      ChunkTracker var8 = var6.getComponent(var3, ChunkTracker.getComponentType());
      assert var8 != null;
      TransformComponent var9 = var6.getComponent(var3, TransformComponent.getComponentType());
      assert var9 != null;
      Vector3d var10 = var9.getPosition();
      int var11 = MathUtil.floor(var10.x()) >> 5;
      int var12 = MathUtil.floor(var10.z()) >> 5;
      if (this.clearCacheArg.provided(var1)) {
         ChunkStore var13 = var5.getChunkStore();
         Store var14 = var13.getStore();
         SpiralIterator var15 = new SpiralIterator(var11, var12, var7.getViewRadius());

         while (var15.hasNext()) {
            long var16 = var15.next();
            Ref var18 = var13.getChunkReference(var16);
            if (var18 != null && var18.isValid()) {
               BlockChunk var19 = var14.getComponent(var18, BlockChunk.getComponentType());
               if (var19 != null) {
                  for (int var20 = 0; var20 < 10; var20++) {
                     var19.invalidateChunkSection(var20);
                  }
               }
            }
         }
      }

      var8.clear();
      var4.getPacketHandler().writeNoCache(new ClearChunks());
      var1.sendMessage(MESSAGE_COMMANDS_CHUNK_RESEND_UNLOADED_ALL);
   }
}