ChunkMigrations class

Пакет: com.hypixel.hytale.server.core.modules.migrations

Файл: com/hypixel/hytale/server/core/modules/migrations/ChunkMigrations.java

Поля (15)

МодификаторыТипИмя
EntitySection var13
HolderSystem var13
SystemType var14
ObjectArrayList var16
BlockComponentSection var23
boolean var5
ChunkColumn var6
BitSet var6
Holder[] var7
boolean var7
var7
SystemType var8
int var8
var8
HolderSystem var9

Методы (11)

МодификаторыВозвратСигнатура
for for(Holder var12 : var7)
for for(Holder var21 : var7)
for for(Holder var24 : var7)
for for(Holder var11 : var5)
for for(Holder var15 : var5)
if if(var4 != null && var3 != null)
if if(var12 != null)
if if(var21 != null)
if if(var24 != null)
static boolean migrateboolean migrate(@Nonnull Holder<ChunkStore> var0, @Nonnull ComponentRegistry.Data<ChunkStore> var1, @Nonnull Store<ChunkStore> var2, @Nullable ComponentRegistry.Data<EntityStore> var3, @Nullable Store<EntityStore> var4)
static <S, T extends HolderSystem<S>> boolean runMigrations<S, T extends HolderSystem<S>> boolean runMigrations(@Nonnull SystemType<S, T> var0, @Nonnull ComponentRegistry<S> var1, @Nonnull ComponentRegistry.Data<S> var2, @Nonnull Store<S> var3, @Nonnull RemoveReason var4, @Nonnull Iterable<Holder<S>> var5)

Исходный код

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

class="kw">import com.hypixel.hytale.component.AddReason;
class="kw">import com.hypixel.hytale.component.ComponentRegistry;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.RemoveReason;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.SystemType;
class="kw">import com.hypixel.hytale.component.system.HolderSystem;
class="kw">import com.hypixel.hytale.server.core.modules.block.BlockModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.ChunkColumn;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockComponentSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.EntitySection;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import java.util.BitSet;
class="kw">import java.util.Collections;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class="kw">final class ChunkMigrations {
   class="kw">private ChunkMigrations() {
   }

   class="kw">public class="kw">static boolean migrate(
      @Nonnull Holder<ChunkStore> var0,
      @Nonnull ComponentRegistry.Data<ChunkStore> var1,
      @Nonnull Store<ChunkStore> var2,
      @Nullable ComponentRegistry.Data<EntityStore> var3,
      @Nullable Store<EntityStore> var4
   ) {
      boolean var5 = runMigrations(
         MigrationModule.get().getChunkColumnMigrationSystem(), ChunkStore.REGISTRY, var1, var2, RemoveReason.UNLOAD, Collections.singletonList(var0)
      );
      ChunkColumn var6 = var0.getComponent(ChunkColumn.getComponentType());
      if (var6 != null && var6.getSectionHolders() != null) {
         Holder[] var7 = var6.getSectionHolders();
         if (var4 != null && var3 != null) {
            SystemType var8 = EntityModule.get().getMigrationSystemType();

            for (Holder var12 : var7) {
               if (var12 != null) {
                  EntitySection var13 = var12.getComponent(EntitySection.getComponentType());
                  if (var13 != null && !var13.getEntityHolders().isEmpty()) {
                     var5 |= runMigrations(var8, EntityStore.REGISTRY, var3, var4, RemoveReason.UNLOAD, var13.getEntityHolders());
                  }
               }
            }
         }

         SystemType var14 = BlockModule.get().getMigrationSystemType();

         for (Holder var21 : var7) {
            if (var21 != null) {
               BlockComponentSection var23 = var21.getComponent(BlockComponentSection.getComponentType());
               if (var23 != null && !var23.getBlockHolders().isEmpty()) {
                  var5 |= runMigrations(var14, ChunkStore.REGISTRY, var1, var2, RemoveReason.REMOVE, var23.getBlockHolders().values());
               }
            }
         }

         ObjectArrayList var16 = new ObjectArrayList(var7.length);

         for (Holder var24 : var7) {
            if (var24 != null) {
               var16.add(var24);
            }
         }

         var5 |= runMigrations(MigrationModule.get().getChunkSectionMigrationSystem(), ChunkStore.REGISTRY, var1, var2, RemoveReason.REMOVE, var16);
      }

      class="kw">return var5;
   }

   class="kw">private class="kw">static <S, T class="kw">extends HolderSystem<S>> boolean runMigrations(
      @Nonnull SystemType<S, T> var0,
      @Nonnull ComponentRegistry<S> var1,
      @Nonnull ComponentRegistry.Data<S> var2,
      @Nonnull Store<S> var3,
      @Nonnull RemoveReason var4,
      @Nonnull Iterable<Holder<S>> var5
   ) {
      BitSet var6 = var2.getSystemIndexesForType(var0);
      boolean var7 = false;
      int var8 = -1;

      while ((var8 = var6.nextSetBit(var8 + 1)) >= 0) {
         HolderSystem var9 = (T)var2.getSystem(var8, var0);

         for (Holder var11 : var5) {
            if (var9.test(var1, var11.getArchetype())) {
               var9.onEntityAdd(var11, AddReason.LOAD, var3);
               var7 = true;
            }
         }
      }

      var8 = -1;

      while ((var8 = var6.nextSetBit(var8 + 1)) >= 0) {
         HolderSystem var13 = (T)var2.getSystem(var8, var0);

         for (Holder var15 : var5) {
            if (var13.test(var1, var15.getArchetype())) {
               var13.onEntityRemoved(var15, var4, var3);
            }
         }
      }

      class="kw">return var7;
   }
}