PatrolPathMarkerEntity class
Пакет: com.hypixel.hytale.builtin.path.entities
Файл: com/hypixel/hytale/builtin/path/entities/PatrolPathMarkerEntity.java
extends: Entity
implements: IPrefabPathWaypoint
Поля (7)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<PatrolPathMarkerEntity> |
CODEC |
|
Ref |
var2 |
|
Ref |
var2 |
|
TransformComponent |
var3 |
|
TransformComponent |
var3 |
|
Player |
var4 |
|
WorldPathData |
var9 |
Методы (10)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
String |
getPathNameString getPathName() |
public |
short |
getTempPathLengthshort getTempPathLength() |
|
|
if if(var3 < 0) |
public |
void |
setObservationAnglevoid setObservationAngle(float var1) |
public |
void |
setOrdervoid setOrder(int var1) |
public |
void |
setParentPathvoid setParentPath(IPrefabPath var1) |
public |
void |
setPathIdvoid setPathId(UUID var1) |
public |
void |
setPathNamevoid setPathName(String var1) |
public |
void |
setPauseTimevoid setPauseTime(double var1) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.path.entities;
class="kw">import com.hypixel.hytale.builtin.path.WorldPathData;
class="kw">import com.hypixel.hytale.builtin.path.path.IPrefabPath;
class="kw">import com.hypixel.hytale.builtin.path.path.PatrolPath;
class="kw">import com.hypixel.hytale.builtin.path.waypoint.IPrefabPathWaypoint;
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.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.protocol.GameMode;
class="kw">import com.hypixel.hytale.server.core.entity.Entity;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.path.IPath;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">public class PatrolPathMarkerEntity class="kw">extends Entity class="kw">implements IPrefabPathWaypoint {
class="kw">public class="kw">static class="kw">final BuilderCodec<PatrolPathMarkerEntity> CODEC = BuilderCodec.builder(
PatrolPathMarkerEntity.class, PatrolPathMarkerEntity::new, Entity.CODEC
)
.append(new KeyedCodec<>("PathId", Codec.UUID_BINARY), (var0, var1) -> var0.pathId = var1, var0 -> var0.pathId)
.setVersionRange(5, 5)
.add()
.<String>append(new KeyedCodec<>("PathName", Codec.STRING), (var0, var1) -> var0.pathName = var1, var0 -> var0.pathName)
.setVersionRange(5, 5)
.add()
.<String>append(new KeyedCodec<>("Path", Codec.STRING), (var0, var1) -> var0.pathName = var1, var0 -> var0.pathName)
.setVersionRange(0, 4)
.add()
.addField(
new KeyedCodec<>("PathLength", Codec.INTEGER),
(var0, var1) -> var0.tempPathLength = var1.shortValue(),
var0 -> var0.parentPath != null ? var0.parentPath.length() : var0.tempPathLength
)
.addField(new KeyedCodec<>("Order", Codec.INTEGER), (var0, var1) -> var0.order = var1, var0 -> var0.order)
.addField(new KeyedCodec<>("PauseTime", Codec.DOUBLE), (var0, var1) -> var0.pauseTime = var1, var0 -> var0.pauseTime)
.addField(new KeyedCodec<>("ObsvAngle", Codec.DOUBLE), (var0, var1) -> var0.observationAngle = var1.floatValue(), var0 -> (double)var0.observationAngle)
.build();
@Nullable
class="kw">private UUID pathId;
class="kw">private String pathName;
class="kw">private int order;
class="kw">private double pauseTime;
class="kw">private float observationAngle;
class="kw">private short tempPathLength;
class="kw">private IPrefabPath parentPath;
@Nullable
class="kw">public class="kw">static ComponentType<EntityStore, PatrolPathMarkerEntity> getComponentType() {
class="kw">return EntityModule.get().getComponentType(PatrolPathMarkerEntity.class);
}
class="kw">public PatrolPathMarkerEntity() {
}
class="kw">public PatrolPathMarkerEntity(World var1) {
super(var1);
}
class="kw">public void setParentPath(IPrefabPath var1) {
this.parentPath = var1;
}
@Nullable
class="kw">public UUID getPathId() {
class="kw">return this.pathId;
}
class="kw">public void setPathId(UUID var1) {
this.pathId = var1;
}
class="kw">public String getPathName() {
class="kw">return this.pathName;
}
class="kw">public void setPathName(String var1) {
this.pathName = var1;
}
@Nonnull
class="kw">public class="kw">static String generateDisplayName(int var0, PatrolPathMarkerEntity var1) {
class="kw">return String.format(
"%s.%s (%s) #%s [Wait %ss] <Rotate %.2fdeg>",
var0,
var1.pathId,
var1.pathName,
var1.order,
var1.pauseTime,
var1.observationAngle * (180.0F / (float)Math.PI)
);
}
class="kw">public short getTempPathLength() {
class="kw">return this.tempPathLength;
}
@Override
class="kw">public void initialise(@Nonnull UUID var1, @Nonnull String var2, int var3, double var4, float var6, int var7, @Nonnull ComponentAccessor<EntityStore> var8) {
this.pathId = var1;
this.pathName = var2;
WorldPathData var9 = var8.getResource(WorldPathData.getResourceType());
this.parentPath = var9.getOrConstructPrefabPath(var7, this.pathId, var2, PatrolPath::new);
this.pauseTime = var4;
this.observationAngle = var6;
if (var3 < 0) {
this.order = this.parentPath.registerNewWaypoint(this, var7);
} else {
this.order = var3;
this.parentPath.registerNewWaypointAt(var3, this, var7);
}
this.tempPathLength = (short)this.parentPath.length();
}
@Override
class="kw">public IPath<IPrefabPathWaypoint> getParentPath() {
class="kw">return this.parentPath;
}
@Override
class="kw">public boolean isCollidable() {
class="kw">return false;
}
@Override
class="kw">public boolean isHiddenFromLivingEntity(@Nonnull Ref<EntityStore> var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
Player var4 = var3.getComponent(var2, Player.getComponentType());
class="kw">return var4 == null || var4.getGameMode() != GameMode.Creative;
}
@Override
class="kw">public int getOrder() {
class="kw">return this.order;
}
class="kw">public void setOrder(int var1) {
this.order = var1;
this.markNeedsSave();
}
@Override
class="kw">public double getPauseTime() {
class="kw">return this.pauseTime;
}
class="kw">public void setPauseTime(double var1) {
this.pauseTime = var1;
this.markNeedsSave();
}
@Override
class="kw">public float getObservationAngle() {
class="kw">return this.observationAngle;
}
@Override
class="kw">public void onReplaced() {
this.pathId = null;
this.remove();
}
class="kw">public void setObservationAngle(float var1) {
this.observationAngle = var1;
this.markNeedsSave();
}
@Nonnull
@Override
class="kw">public Vector3d getWaypointPosition(@Nonnull ComponentAccessor<EntityStore> var1) {
Ref var2 = this.getReference();
assert var2 != null && var2.isValid() : "Entity reference is null or invalid";
TransformComponent var3 = var1.getComponent(var2, TransformComponent.getComponentType());
assert var3 != null;
class="kw">return var3.getPosition();
}
@Nonnull
@Override
class="kw">public Rotation3f getWaypointRotation(@Nonnull ComponentAccessor<EntityStore> var1) {
Ref var2 = this.getReference();
assert var2 != null && var2.isValid() : "Entity reference is null or invalid";
TransformComponent var3 = var1.getComponent(var2, TransformComponent.getComponentType());
assert var3 != null;
class="kw">return var3.getRotation();
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "PatrolPathMarkerEntity{pathId="
+ this.pathId
+ ", path='"
+ this.pathName
+ "', order="
+ this.order
+ ", pauseTime="
+ this.pauseTime
+ ", observationAngle="
+ this.observationAngle
+ ", tempPathLength="
+ this.tempPathLength
+ ", parentPath="
+ this.parentPath
+ "} "
+ super.toString();
}
}