Dirty class

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

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

implements: Component<EntityStore>

Поля (2)

МодификаторыТипИмя
final float DEFAULT_ENTITY_SAVE_COOLDOWN_SECONDS
boolean var1

Методы (13)

МодификаторыВозвратСигнатура
public void clearSavingvoid clearSaving(@Nonnull CompletableFuture<Void> var1)
public boolean consumeDirtyboolean consumeDirty()
public void forceMarkDirtyvoid forceMarkDirty()
if if(var2)
if if(this.section != null)
if if(var2 || !this.isDirty)
if if(this.savingFuture == var1)
public boolean isDirtyboolean isDirty()
public boolean isSavingboolean isSaving()
public void markDirtyvoid markDirty()
private void markDirtyWithCooldownvoid markDirtyWithCooldown(float var1, boolean var2)
public float pollCooldownfloat pollCooldown(float var1)
public void setSavingvoid setSaving(@Nonnull CompletableFuture<Void> var1)

Исходный код

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

class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.EntitySection;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.concurrent.CompletableFuture;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class Dirty class="kw">implements Component<EntityStore> {
   class="kw">private class="kw">static class="kw">final float DEFAULT_ENTITY_SAVE_COOLDOWN_SECONDS = 5.0F;
   @Deprecated
   @Nullable
   class="kw">private EntitySection section;
   class="kw">private boolean isDirty;
   @Nullable
   class="kw">private CompletableFuture<Void> savingFuture;
   class="kw">private float cooldownSeconds;

   @Nonnull
   class="kw">public class="kw">static ComponentType<EntityStore, Dirty> getComponentType() {
      class="kw">return EntityModule.get().getDirtyComponentType();
   }

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

   class="kw">public Dirty(@Nullable EntitySection var1, boolean var2) {
      this.section = var1;
      if (var2) {
         this.markDirty();
      }
   }

   class="kw">public void markDirty() {
      this.markDirtyWithCooldown(5.0F, false);
   }

   class="kw">public void forceMarkDirty() {
      this.markDirtyWithCooldown(0.0F, true);
   }

   class="kw">private void markDirtyWithCooldown(float var1, boolean var2) {
      if (this.section != null) {
         this.section.markNeedsSaving();
      }

      if (var2 || !this.isDirty) {
         this.cooldownSeconds = var1;
      }

      this.isDirty = true;
   }

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

   class="kw">public boolean isDirty() {
      class="kw">return this.isDirty;
   }

   class="kw">public float pollCooldown(float var1) {
      this.cooldownSeconds -= var1;
      class="kw">return this.cooldownSeconds;
   }

   class="kw">public boolean isSaving() {
      class="kw">return this.savingFuture != null;
   }

   class="kw">public void setSaving(@Nonnull CompletableFuture<Void> var1) {
      this.savingFuture = var1;
   }

   class="kw">public void clearSaving(@Nonnull CompletableFuture<Void> var1) {
      if (this.savingFuture == var1) {
         this.savingFuture = null;
      }
   }

   @Nullable
   class="kw">public CompletableFuture<Void> getSavingFuture() {
      class="kw">return this.savingFuture;
   }

   @Deprecated
   class="kw">public void setSection(@Nullable EntitySection var1) {
      this.section = var1;
   }

   @Nullable
   @Override
   class="kw">public Component<EntityStore> clone() {
      class="kw">return new Dirty(null, true);
   }
}