Point class
Пакет: com.hypixel.hytale.builtin.points.component
Файл: com/hypixel/hytale/builtin/points/component/Point.java
implements: Component<EntityStore>
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Point |
var1 |
|
Point |
var1 |
|
Vector3f |
var5 |
|
PointEntry |
var6 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
getPrefabIndexint getPrefabIndex() |
public |
void |
setPrefabIndexvoid setPrefabIndex(int var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.points.component;
class="kw">import com.hypixel.hytale.builtin.points.manager.PointCodecs;
class="kw">import com.hypixel.hytale.builtin.points.manager.PointEntry;
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.codecs.EnumCodec;
class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.math.vector.Vector3fUtil;
class="kw">import com.hypixel.hytale.protocol.packets.player.PointShapeType;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.Collections;
class="kw">import java.util.HashMap;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3f;
class="kw">public class Point class="kw">implements Component<EntityStore> {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<Point> CODEC = BuilderCodec.builder(Point.class, Point::new)
.append(
new KeyedCodec<>("Rotation", Vector3fUtil.CODEC, false),
(var0, var1) -> var0.rotation = var1,
var0 -> var0.rotation.lengthSquared() > 0.0F ? var0.rotation : null
)
.add()
.append(new KeyedCodec<>("Name", Codec.STRING, false), (var0, var1) -> var0.name = var1, var0 -> var0.name)
.add()
.append(new KeyedCodec<>("Tags", PointCodecs.TAGS, false), (var0, var1) -> var0.rawTags = var1, var0 -> var0.rawTags.isEmpty() ? null : var0.rawTags)
.add()
.append(
new KeyedCodec<>("PrefabIndex", Codec.INTEGER, false),
(var0, var1) -> var0.prefabIndex = var1,
var0 -> var0.prefabIndex >= 0 ? var0.prefabIndex : null
)
.add()
.append(
new KeyedCodec<>("Shape", new EnumCodec<>(PointShapeType.class), false),
(var0, var1) -> var0.shape = var1,
var0 -> var0.shape != PointShapeType.Block ? var0.shape : null
)
.add()
.build();
@Nonnull
class="kw">private Vector3f rotation = new Vector3f();
@Nullable
class="kw">private String name;
@Nonnull
class="kw">private Map<String, String> rawTags = Collections.emptyMap();
@Nonnull
class="kw">private PointShapeType shape = PointShapeType.Block;
class="kw">private int prefabIndex = -1;
class="kw">public Point() {
}
@Nonnull
class="kw">public class="kw">static Point fromPointEntry(@Nonnull PointEntry var0) {
Point var1 = new Point();
var1.rotation = new Vector3f(var0.getRotation());
var1.name = var0.getName();
var1.rawTags = copyTags(var0.getRawTags());
var1.shape = var0.getShape();
class="kw">return var1;
}
@Nonnull
class="kw">public PointEntry toPointEntry(@Nonnull String var1, @Nonnull String var2, @Nonnull Vector3d var3) {
class="kw">return this.toPointEntry(var1, var2, var3, 0.0F);
}
@Nonnull
class="kw">public PointEntry toPointEntry(@Nonnull String var1, @Nonnull String var2, @Nonnull Vector3d var3, float var4) {
Vector3f var5 = new Vector3f(this.rotation);
var5.y = var5.y + (float)Math.toDegrees(var4);
PointEntry var6 = new PointEntry(var1, var2, var3, var5, this.name, true);
var6.setShape(this.shape);
if (!this.rawTags.isEmpty()) {
var6.setTags(copyTags(this.rawTags));
}
class="kw">return var6;
}
class="kw">public int getPrefabIndex() {
class="kw">return this.prefabIndex;
}
class="kw">public void setPrefabIndex(int var1) {
this.prefabIndex = var1;
}
@Nonnull
class="kw">private class="kw">static Map<String, String> copyTags(@Nonnull Map<String, String> var0) {
class="kw">return var0.isEmpty() ? Collections.emptyMap() : new HashMap<>(var0);
}
@Nonnull
@Override
class="kw">public Component<EntityStore> clone() {
Point var1 = new Point();
var1.rotation = new Vector3f(this.rotation);
var1.name = this.name;
var1.rawTags = copyTags(this.rawTags);
var1.shape = this.shape;
var1.prefabIndex = this.prefabIndex;
class="kw">return var1;
}
}