PersistentPrefabPreview class
Пакет: com.hypixel.hytale.server.core.modules.entity.component
Файл: com/hypixel/hytale/server/core/modules/entity/component/PersistentPrefabPreview.java
implements: Component<EntityStore>
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<PersistentPrefabPreview> |
CODEC |
|
PersistentPrefabPreview |
var3 |
|
Holder |
var4 |
|
PrefabPreview |
var4 |
Методы (10)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
getBiomeTintint getBiomeTint() |
static |
ComponentType<EntityStore, PersistentPrefabPreview> |
getComponentTypeComponentType<EntityStore, PersistentPrefabPreview> getComponentType() |
public |
int |
getVisibleLayerCountint getVisibleLayerCount() |
public |
int |
getWaterTintint getWaterTint() |
public |
boolean |
hasTintOverrideboolean hasTintOverride() |
|
|
if if(var3 != null) |
|
|
if if(var4 != null) |
static |
void |
removevoid remove(@Nonnull Store<EntityStore> var0, @Nonnull Ref<EntityStore> var1) |
public |
void |
setVisibleLayerCountvoid setVisibleLayerCount(int var1) |
static |
void |
updateLayersvoid updateLayers(@Nonnull Store<EntityStore> var0, @Nonnull Ref<EntityStore> var1, int var2) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.entity.component;
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.codec.validation.Validators;
class="kw">import com.hypixel.hytale.component.AddReason;
class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentType;
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.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.server.core.entity.UUIDComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class PersistentPrefabPreview class="kw">implements Component<EntityStore> {
class="kw">public class="kw">static class="kw">final BuilderCodec<PersistentPrefabPreview> CODEC = BuilderCodec.builder(PersistentPrefabPreview.class, PersistentPrefabPreview::new)
.append(new KeyedCodec<>("PrefabKey", Codec.STRING), (var0, var1) -> var0.prefabKey = var1, var0 -> var0.prefabKey)
.addValidator(Validators.nonNull())
.add()
.append(new KeyedCodec<>("VisibleLayerCount", Codec.INTEGER), (var0, var1) -> var0.visibleLayerCount = var1, var0 -> var0.visibleLayerCount)
.add()
.append(new KeyedCodec<>("HasTintOverride", Codec.BOOLEAN, false), (var0, var1) -> var0.hasTintOverride = var1, var0 -> var0.hasTintOverride)
.add()
.append(new KeyedCodec<>("BiomeTint", Codec.INTEGER, false), (var0, var1) -> var0.biomeTint = var1, var0 -> var0.biomeTint)
.add()
.append(new KeyedCodec<>("WaterTint", Codec.INTEGER, false), (var0, var1) -> var0.waterTint = var1, var0 -> var0.waterTint)
.add()
.build();
@Nonnull
class="kw">private String prefabKey = "";
class="kw">private int visibleLayerCount;
class="kw">private boolean hasTintOverride;
class="kw">private int biomeTint;
class="kw">private int waterTint;
class="kw">public class="kw">static ComponentType<EntityStore, PersistentPrefabPreview> getComponentType() {
class="kw">return EntityModule.get().getPersistentPrefabPreviewComponentType();
}
class="kw">private PersistentPrefabPreview() {
}
class="kw">public PersistentPrefabPreview(@Nonnull String var1, int var2) {
this.prefabKey = var1;
this.visibleLayerCount = var2;
}
class="kw">public PersistentPrefabPreview(@Nonnull String var1, int var2, int var3, int var4) {
this.prefabKey = var1;
this.visibleLayerCount = var2;
this.hasTintOverride = true;
this.biomeTint = var3;
this.waterTint = var4;
}
@Nonnull
class="kw">public class="kw">static Ref<EntityStore> spawn(@Nonnull Store<EntityStore> var0, @Nonnull Vector3d var1, @Nonnull Rotation3f var2, @Nonnull String var3, int var4) {
class="kw">return spawn(var0, var1, var2, new PersistentPrefabPreview(var3, var4));
}
@Nonnull
class="kw">public class="kw">static Ref<EntityStore> spawn(
@Nonnull Store<EntityStore> var0, @Nonnull Vector3d var1, @Nonnull Rotation3f var2, @Nonnull String var3, int var4, int var5, int var6
) {
class="kw">return spawn(var0, var1, var2, new PersistentPrefabPreview(var3, var4, var5, var6));
}
@Nonnull
class="kw">private class="kw">static Ref<EntityStore> spawn(
@Nonnull Store<EntityStore> var0, @Nonnull Vector3d var1, @Nonnull Rotation3f var2, @Nonnull PersistentPrefabPreview var3
) {
Holder var4 = var0.getRegistry().newHolder();
var4.addComponent(NetworkId.getComponentType(), new NetworkId(var0.getExternalData().takeNextNetworkId()));
var4.addComponent(TransformComponent.getComponentType(), new TransformComponent(var1, var2));
var4.addComponent(getComponentType(), var3);
var4.ensureComponent(UUIDComponent.getComponentType());
class="kw">return var0.addEntity(var4, AddReason.SPAWN);
}
class="kw">public class="kw">static void updateLayers(@Nonnull Store<EntityStore> var0, @Nonnull Ref<EntityStore> var1, int var2) {
PersistentPrefabPreview var3 = var0.getComponent(var1, getComponentType());
if (var3 != null) {
var3.setVisibleLayerCount(var2);
}
PrefabPreview var4 = var0.getComponent(var1, PrefabPreview.getComponentType());
if (var4 != null) {
var4.setVisibleLayerCount(var2);
}
}
class="kw">public class="kw">static void remove(@Nonnull Store<EntityStore> var0, @Nonnull Ref<EntityStore> var1) {
var0.removeEntity(var1, RemoveReason.REMOVE);
}
@Nonnull
class="kw">public String getPrefabKey() {
class="kw">return this.prefabKey;
}
class="kw">public int getVisibleLayerCount() {
class="kw">return this.visibleLayerCount;
}
class="kw">public boolean hasTintOverride() {
class="kw">return this.hasTintOverride;
}
class="kw">public int getBiomeTint() {
class="kw">return this.biomeTint;
}
class="kw">public int getWaterTint() {
class="kw">return this.waterTint;
}
class="kw">public void setVisibleLayerCount(int var1) {
this.visibleLayerCount = var1;
}
@Nonnull
@Override
class="kw">public Component<EntityStore> clone() {
class="kw">return this.hasTintOverride
? new PersistentPrefabPreview(this.prefabKey, this.visibleLayerCount, this.biomeTint, this.waterTint)
: new PersistentPrefabPreview(this.prefabKey, this.visibleLayerCount);
}
}