LegacyProjectileSystems class

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

Файл: com/hypixel/hytale/server/core/modules/entity/LegacyProjectileSystems.java

Поля (24)

МодификаторыТипИмя
private static final HytaleLogger LOGGER
private static final ComponentType<EntityStore, ProjectileComponent> PROJECTILE_COMPONENT_TYPE
private static final ComponentType<EntityStore, ProjectileComponent> PROJECTILE_COMPONENT_TYPE
private final Archetype<EntityStore> archetype
private final ComponentType<EntityStore, BoundingBox> boundingBoxComponentType
private final ComponentType<EntityStore, ProjectileComponent> projectileComponentType
return
private final ComponentType<EntityStore, TransformComponent> transformComponentType
Ref var10
World var11
ProjectileComponent var4
BoundingBox var5
var5
var5
var5
ProjectileComponent var5
ModelAsset var6
TransformComponent var6
Model var7
ProjectileComponent var7
Projectile var8
Velocity var8
BoundingBox var9
private final ComponentType<EntityStore, Velocity> velocityComponentType

Методы (13)

МодификаторыВозвратСигнатура
public OnAddHolderSystempublic OnAddHolderSystem()
public OnAddRefSystempublic OnAddRefSystem()
public TickingSystempublic TickingSystem(@Nonnull ComponentType<EntityStore, ProjectileComponent> var1, @Nonnull ComponentType<EntityStore, TransformComponent> var2, @Nonnull ComponentType<EntityStore, Velocity> var3, @Nonnull ComponentType<EntityStore, BoundingBox> var4)
public Query<EntityStore> getQuerypublic Query<EntityStore> getQuery()
public Query<EntityStore> getQuerypublic Query<EntityStore> getQuery()
public Query<EntityStore> getQuerypublic Query<EntityStore> getQuery()
if if(var6 != null)
if if(var8 != null)
public void onEntityAddpublic void onEntityAdd(@Nonnull Holder<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3)
public void onEntityAddedpublic void onEntityAdded(@Nonnull Ref<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4)
public void onEntityRemovepublic void onEntityRemove(@Nonnull Ref<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4)
public void onEntityRemovedpublic void onEntityRemoved(@Nonnull Holder<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3)
public void tickpublic void tick(float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5)

Исходный код

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

class="kw">import com.hypixel.hytale.component.AddReason;
class="kw">import com.hypixel.hytale.component.Archetype;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.DisableProcessingAssert;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.RemoveReason;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.system.HolderSystem;
class="kw">import com.hypixel.hytale.component.system.RefSystem;
class="kw">import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import com.hypixel.hytale.math.shape.Box;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.Model;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
class="kw">import com.hypixel.hytale.server.core.asset.type.projectile.config.Projectile;
class="kw">import com.hypixel.hytale.server.core.entity.entities.ProjectileComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.PersistentModel;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;

class="kw">public class LegacyProjectileSystems {
   @Nonnull
   class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();

   class="kw">public LegacyProjectileSystems() {
   }

   class="kw">public class="kw">static class OnAddHolderSystem class="kw">extends HolderSystem<EntityStore> {
      @Nonnull
      class="kw">private class="kw">static class="kw">final ComponentType<EntityStore, ProjectileComponent> PROJECTILE_COMPONENT_TYPE = ProjectileComponent.getComponentType();

      class="kw">public OnAddHolderSystem() {
      }

      @Override
      class="kw">public void onEntityAdd(@Nonnull Holder<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3) {
         if (!var1.getArchetype().contains(NetworkId.getComponentType())) {
            var1.addComponent(NetworkId.getComponentType(), new NetworkId(var3.getExternalData().takeNextNetworkId()));
         }

         ProjectileComponent var4 = var1.getComponent(PROJECTILE_COMPONENT_TYPE);
         assert var4 != null;
         var4.initialize();
         ModelAsset var6 = ModelAsset.getAssetMap().getAsset(var4.getAppearance());
         BoundingBox var5;
         if (var6 != null) {
            Model var7 = Model.createUnitScaleModel(var6);
            var1.putComponent(ModelComponent.getComponentType(), new ModelComponent(var7));
            var1.putComponent(PersistentModel.getComponentType(), new PersistentModel(var7.toReference()));
            var5 = new BoundingBox(var7.getBoundingBox());
         } else {
            Projectile var8 = var4.getProjectile();
            if (var8 != null) {
               var5 = new BoundingBox(Box.horizontallyCentered(var8.getRadius(), var8.getHeight(), var8.getRadius()));
            } else {
               var5 = new BoundingBox(Box.horizontallyCentered(0.25, 0.25, 0.25));
            }
         }

         var1.putComponent(BoundingBox.getComponentType(), var5);
         var4.initializePhysics(var5);
      }

      @Override
      class="kw">public void onEntityRemoved(@Nonnull Holder<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3) {
      }

      @Override
      class="kw">public Query<EntityStore> getQuery() {
         class="kw">return PROJECTILE_COMPONENT_TYPE;
      }
   }

   class="kw">public class="kw">static class OnAddRefSystem class="kw">extends RefSystem<EntityStore> {
      @Nonnull
      class="kw">private class="kw">static class="kw">final ComponentType<EntityStore, ProjectileComponent> PROJECTILE_COMPONENT_TYPE = ProjectileComponent.getComponentType();

      class="kw">public OnAddRefSystem() {
      }

      @Override
      class="kw">public Query<EntityStore> getQuery() {
         class="kw">return PROJECTILE_COMPONENT_TYPE;
      }

      @Override
      class="kw">public void onEntityAdded(
         @Nonnull Ref<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
      ) {
         ProjectileComponent var5 = var4.getComponent(var1, PROJECTILE_COMPONENT_TYPE);
         assert var5 != null;
         if (var5.getProjectile() == null) {
            LegacyProjectileSystems.LOGGER.at(Level.WARNING).log("Removing projectile entity %s as it failed to initialize correctly!", var1);
            var4.removeEntity(var1, RemoveReason.REMOVE);
         }
      }

      @Override
      class="kw">public void onEntityRemove(
         @Nonnull Ref<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
      ) {
      }
   }

   class="kw">public class="kw">static class TickingSystem class="kw">extends EntityTickingSystem<EntityStore> class="kw">implements DisableProcessingAssert {
      @Nonnull
      class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, TransformComponent> transformComponentType;
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, Velocity> velocityComponentType;
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, BoundingBox> boundingBoxComponentType;
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, ProjectileComponent> projectileComponentType;
      @Nonnull
      class="kw">private class="kw">final Archetype<EntityStore> archetype;

      class="kw">public TickingSystem(
         @Nonnull ComponentType<EntityStore, ProjectileComponent> var1,
         @Nonnull ComponentType<EntityStore, TransformComponent> var2,
         @Nonnull ComponentType<EntityStore, Velocity> var3,
         @Nonnull ComponentType<EntityStore, BoundingBox> var4
      ) {
         this.projectileComponentType = var1;
         this.velocityComponentType = var3;
         this.boundingBoxComponentType = var4;
         this.transformComponentType = var2;
         this.archetype = Archetype.of(var1, var2, var3, var4);
      }

      @Override
      class="kw">public Query<EntityStore> getQuery() {
         class="kw">return this.archetype;
      }

      @Override
      class="kw">public void tick(
         float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5
      ) {
         TransformComponent var6 = var3.getComponent(var2, this.transformComponentType);
         assert var6 != null;
         ProjectileComponent var7 = var3.getComponent(var2, this.projectileComponentType);
         assert var7 != null;
         Velocity var8 = var3.getComponent(var2, this.velocityComponentType);
         assert var8 != null;
         BoundingBox var9 = var3.getComponent(var2, this.boundingBoxComponentType);
         Ref var10 = var3.getReferenceTo(var2);

         try {
            if (var7.consumeDeadTimer(var1)) {
               var7.onProjectileDeath(var10, var6.getPosition(), var5);
               var5.removeEntity(var10, RemoveReason.REMOVE);
               class="kw">return;
            }

            World var11 = var5.getExternalData().getWorld();
            var7.getSimplePhysicsProvider().tick(var1, var8, var11, var6, var10, var5);
         } catch (Throwable var12) {
            ((HytaleLogger.Api)LOGGER.at(Level.SEVERE).withCause(var12)).log("Exception while ticking entity! Removing!! %s", var7);
            var5.removeEntity(var10, RemoveReason.REMOVE);
         }
      }
   }
}