PersistentRefCount class

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

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

implements: Component<EntityStore>

Поля (2)

МодификаторыТипИмя
final BuilderCodec<PersistentRefCount> CODEC
PersistentRefCount var1

Методы (4)

МодификаторыВозвратСигнатура
public int getint get()
static ComponentType<EntityStore, PersistentRefCount> getComponentTypeComponentType<EntityStore, PersistentRefCount> getComponentType()
if if(this.refCount >= Integer.MAX_VALUE)
public void incrementvoid increment()

Исходный код

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

class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
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.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;

class="kw">public class PersistentRefCount class="kw">implements Component<EntityStore> {
   class="kw">public class="kw">static class="kw">final BuilderCodec<PersistentRefCount> CODEC = BuilderCodec.builder(PersistentRefCount.class, PersistentRefCount::new)
      .append(new KeyedCodec<>("Count", Codec.INTEGER), (var0, var1) -> var0.refCount = var1, var0 -> var0.refCount)
      .add()
      .build();
   class="kw">private int refCount;

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

   class="kw">public class="kw">static ComponentType<EntityStore, PersistentRefCount> getComponentType() {
      class="kw">return EntityModule.get().getPersistentRefCountComponentType();
   }

   class="kw">public int get() {
      class="kw">return this.refCount;
   }

   class="kw">public void increment() {
      if (this.refCount >= Integer.MAX_VALUE) {
         this.refCount = 0;
      } else {
         this.refCount++;
      }
   }

   @Nonnull
   @Override
   class="kw">public Component<EntityStore> clone() {
      PersistentRefCount var1 = new PersistentRefCount();
      var1.refCount = this.refCount;
      class="kw">return var1;
   }
}