MountedComponent class

Пакет: com.hypixel.hytale.builtin.mounts

Файл: com/hypixel/hytale/builtin/mounts/MountedComponent.java

implements: Component<EntityStore>

Поля (2)

МодификаторыТипИмя
private Ref<EntityStore> mountedToEntity
boolean var1

Методы (6)

МодификаторыВозвратСигнатура
public boolean consumeNetworkOutdatedboolean consumeNetworkOutdated()
public Vector3fc getAttachmentOffsetVector3fc getAttachmentOffset()
public BlockMountType getBlockMountTypeBlockMountType getBlockMountType()
static ComponentType<EntityStore, MountedComponent> getComponentTypeComponentType<EntityStore, MountedComponent> getComponentType()
public MountController getControllerTypeMountController getControllerType()
public long getMountedDurationMslong getMountedDurationMs()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.mounts;

class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.protocol.BlockMountType;
class="kw">import com.hypixel.hytale.protocol.MountController;
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.Vector3f;
class="kw">import org.joml.Vector3fc;

class="kw">public class MountedComponent class="kw">implements Component<EntityStore> {
   class="kw">private Ref<EntityStore> mountedToEntity;
   class="kw">private Ref<ChunkStore> mountedToBlock;
   class="kw">private class="kw">final MountController controller;
   class="kw">private BlockMountType blockMountType;
   class="kw">private class="kw">final Vector3f attachmentOffset;
   class="kw">private class="kw">final long mountStartMs;
   class="kw">private boolean isNetworkOutdated = true;

   class="kw">public class="kw">static ComponentType<EntityStore, MountedComponent> getComponentType() {
      class="kw">return MountPlugin.getInstance().getMountedComponentType();
   }

   class="kw">public MountedComponent(Ref<EntityStore> var1, Vector3f var2, MountController var3) {
      this.mountedToEntity = var1;
      this.attachmentOffset = var2;
      this.controller = var3;
      this.mountStartMs = System.currentTimeMillis();
   }

   class="kw">public MountedComponent(Ref<ChunkStore> var1, Vector3f var2, BlockMountType var3) {
      this.mountedToBlock = var1;
      this.attachmentOffset = var2;
      this.controller = MountController.BlockMount;
      this.blockMountType = var3;
      this.mountStartMs = System.currentTimeMillis();
   }

   @Nullable
   class="kw">public Ref<EntityStore> getMountedToEntity() {
      class="kw">return this.mountedToEntity;
   }

   @Nullable
   class="kw">public Ref<ChunkStore> getMountedToBlock() {
      class="kw">return this.mountedToBlock;
   }

   class="kw">public Vector3fc getAttachmentOffset() {
      class="kw">return this.attachmentOffset;
   }

   class="kw">public MountController getControllerType() {
      class="kw">return this.controller;
   }

   class="kw">public BlockMountType getBlockMountType() {
      class="kw">return this.blockMountType;
   }

   class="kw">public long getMountedDurationMs() {
      class="kw">return System.currentTimeMillis() - this.mountStartMs;
   }

   class="kw">public boolean consumeNetworkOutdated() {
      boolean var1 = this.isNetworkOutdated;
      this.isNetworkOutdated = false;
      class="kw">return var1;
   }

   @Nonnull
   @Override
   class="kw">public Component<EntityStore> clone() {
      class="kw">return this.controller == MountController.BlockMount
         ? new MountedComponent(this.mountedToBlock, this.attachmentOffset, this.blockMountType)
         : new MountedComponent(this.mountedToEntity, this.attachmentOffset, this.controller);
   }
}