EntityUIModule class

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

Файл: com/hypixel/hytale/server/core/modules/entityui/EntityUIModule.java

extends: JavaPlugin

Поля (4)

МодификаторыТипИмя
final PluginManifest MANIFEST
instance
ComponentType var1
Store var1

Методы (4)

МодификаторыВозвратСигнатура
static EntityUIModule getEntityUIModule get()
public ComponentType<EntityStore, UIComponentList> getUIComponentListTypeComponentType<EntityStore, UIComponentList> getUIComponentListType()
private void onLoadedAssetsEventvoid onLoadedAssetsEvent(LoadedAssetsEvent<String, EntityUIComponent, IndexedLookupTableAssetMap<String, EntityUIComponent>> var1)
abstract super super(var1)

Исходный код

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

class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.event.LoadedAssetsEvent;
class="kw">import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
class="kw">import com.hypixel.hytale.common.plugin.PluginManifest;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.asset.HytaleAssetStore;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.tracker.EntityTrackerSystems;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.EntityStatsModule;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.asset.EntityStatType;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.CombatTextUIComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.CombatTextUIComponentAnimationEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.CombatTextUIComponentOpacityAnimationEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.CombatTextUIComponentPositionAnimationEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.CombatTextUIComponentScaleAnimationEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.EntityStatUIComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.EntityUIComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entityui.asset.EntityUIComponentPacketGenerator;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPlugin;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
class="kw">import com.hypixel.hytale.server.core.universe.Universe;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;

class="kw">public class EntityUIModule class="kw">extends JavaPlugin {
   class="kw">public class="kw">static class="kw">final PluginManifest MANIFEST = PluginManifest.corePlugin(EntityUIModule.class).depends(EntityStatsModule.class).build();
   class="kw">private class="kw">static EntityUIModule instance;
   class="kw">private ComponentType<EntityStore, UIComponentList> uiComponentListType;

   class="kw">public class="kw">static EntityUIModule get() {
      class="kw">return instance;
   }

   class="kw">public EntityUIModule(@Nonnull JavaPluginInit var1) {
      super(var1);
      instance = this;
   }

   class="kw">public ComponentType<EntityStore, UIComponentList> getUIComponentListType() {
      class="kw">return this.uiComponentListType;
   }

   @Override
   class="kw">protected void setup() {
      AssetRegistry.register(
         ((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)HytaleAssetStore.builder(
                              EntityUIComponent.class, new IndexedLookupTableAssetMap<>(EntityUIComponent[]::new)
                           )
                           .setPath("Entity/UI"))
                        .setCodec(EntityUIComponent.CODEC))
                     .setKeyFunction(EntityUIComponent::getId))
                  .setPacketGenerator(new EntityUIComponentPacketGenerator())
                  .setReplaceOnRemove(EntityUIComponent::getUnknownFor))
               .loadsAfter(EntityStatType.class))
            .build()
      );
      this.getCodecRegistry(EntityUIComponent.CODEC).register("EntityStat", EntityStatUIComponent.class, EntityStatUIComponent.CODEC);
      this.getCodecRegistry(EntityUIComponent.CODEC).register("CombatText", CombatTextUIComponent.class, CombatTextUIComponent.CODEC);
      this.getCodecRegistry(CombatTextUIComponentAnimationEvent.CODEC)
         .register("Scale", CombatTextUIComponentScaleAnimationEvent.class, CombatTextUIComponentScaleAnimationEvent.CODEC);
      this.getCodecRegistry(CombatTextUIComponentAnimationEvent.CODEC)
         .register("Position", CombatTextUIComponentPositionAnimationEvent.class, CombatTextUIComponentPositionAnimationEvent.CODEC);
      this.getCodecRegistry(CombatTextUIComponentAnimationEvent.CODEC)
         .register("Opacity", CombatTextUIComponentOpacityAnimationEvent.class, CombatTextUIComponentOpacityAnimationEvent.CODEC);
      this.uiComponentListType = this.getEntityStoreRegistry().registerComponent(UIComponentList.class, "UIComponentList", UIComponentList.CODEC);
      ComponentType var1 = EntityModule.get().getVisibleComponentType();
      this.getEntityStoreRegistry().registerSystem(new UIComponentSystems.Setup(this.uiComponentListType));
      this.getEntityStoreRegistry().registerSystem(new UIComponentSystems.Update(var1, this.uiComponentListType));
      this.getEntityStoreRegistry().registerSystem(new UIComponentSystems.Remove(var1, this.uiComponentListType));
      this.getEventRegistry().register(LoadedAssetsEvent.class, EntityUIComponent.class, this::onLoadedAssetsEvent);
   }

   class="kw">private void onLoadedAssetsEvent(LoadedAssetsEvent<String, EntityUIComponent, IndexedLookupTableAssetMap<String, EntityUIComponent>> var1) {
      Universe.get()
         .getWorlds()
         .forEach(
            (var0, var1x) -> var1x.execute(
               () -> {
                  Store var1 = var1x.getEntityStore().getStore();
                  var1.forEachEntityParallel(
                     UIComponentList.getComponentType(), (var0x, var1xx, var2) -> var1xx.getComponent(var0x, UIComponentList.getComponentType()).update()
                  );
               }
            )
         );
   }
}