PositionSetProvider class
Пакет: com.hypixel.hytale.server.npc.sensorinfo
Файл: com/hypixel/hytale/server/npc/sensorinfo/PositionSetProvider.java
extends: InfoProviderBase
implements: IPositionProvider, IPositionSet
Поля (13)
| Модификаторы | Тип | Имя |
|---|---|---|
|
return this.count > |
0 |
|
|
return |
|
Rotation3f |
var10 |
|
|
var10 |
|
Ref |
var11 |
|
Ref |
var12 |
|
Rotation3f |
var2 |
|
Ref |
var2 |
|
Rotation3f |
var3 |
|
Vector3d |
var9 |
|
|
var9 |
|
|
var9 |
|
int |
var9 |
Методы (17)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
void |
addvoid add(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7) |
public |
void |
addvoid add(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7, @Nonnull Rotation3fc var8) |
private |
void |
addInternalvoid addInternal(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7, @Nullable Rotation3fc var8) |
static |
void |
applyTransformvoid applyTransform(@Nonnull IPositionProvider var0,
@Nonnull PositionSetTransform var1,
@Nonnull PositionSetProvider var2,
boolean var3,
@Nonnull Vector3d var4,
@Nonnull Vector3d var5,
@Nonnull Rotation3f var6,
@Nonnull Store<EntityStore> var7) |
|
|
for for(int var10 = 0; var10 < var9; var10++) |
|
|
if if(var8 == null) |
|
|
if if(var10 == null) |
|
|
if if(this.count == 0) |
|
|
if if(this.count == 0) |
|
|
if if(var2 == null) |
|
|
if if(var1 >= 0 && var1 < this.count) |
|
|
if if(var1 >= 0 && var1 < this.count) |
|
|
if if(var1 >= 0 && var1 < this.count) |
|
|
if if(var3 == null) |
|
|
if if(var0 instanceof IPositionSet var8) |
public |
void |
resetvoid reset() |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.sensorinfo;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.math.vector.Rotation3fc;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.parameterproviders.ParameterProvider;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3dc;
class="kw">public class PositionSetProvider class="kw">extends InfoProviderBase class="kw">implements IPositionProvider, IPositionSet {
@Nonnull
class="kw">private class="kw">final ObjectArrayList<Vector3d> positions = new ObjectArrayList();
@Nonnull
class="kw">private class="kw">final ObjectArrayList<Ref<EntityStore>> refs = new ObjectArrayList();
@Nonnull
class="kw">private class="kw">final ObjectArrayList<Rotation3f> orientations = new ObjectArrayList();
class="kw">private int count;
class="kw">public PositionSetProvider() {
}
class="kw">public PositionSetProvider(ParameterProvider var1) {
super(var1);
}
class="kw">public void reset() {
this.count = 0;
}
class="kw">public void add(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7) {
this.addInternal(var1, var3, var5, var7, null);
}
class="kw">public void add(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7, @Nonnull Rotation3fc var8) {
this.addInternal(var1, var3, var5, var7, var8);
}
class="kw">private void addInternal(double var1, double var3, double var5, @Nullable Ref<EntityStore> var7, @Nullable Rotation3fc var8) {
Vector3d var9;
if (this.count < this.positions.size()) {
var9 = (Vector3d)this.positions.get(this.count);
} else {
var9 = new Vector3d();
this.positions.add(var9);
this.refs.add(null);
this.orientations.add(null);
}
var9.set(var1, var3, var5);
this.refs.set(this.count, var7);
if (var8 == null) {
this.orientations.set(this.count, null);
} else {
Rotation3f var10 = (Rotation3f)this.orientations.get(this.count);
if (var10 == null) {
var10 = new Rotation3f();
this.orientations.set(this.count, var10);
}
var10.set(var8);
}
this.count++;
}
@Override
class="kw">public boolean hasPosition() {
class="kw">return this.count > 0;
}
@Override
class="kw">public boolean providePosition(@Nonnull Vector3d var1) {
if (this.count == 0) {
class="kw">return false;
}
var1.set((Vector3dc)this.positions.getFirst());
class="kw">return true;
}
@Override
class="kw">public double getX() {
class="kw">return this.count > 0 ? ((Vector3d)this.positions.getFirst()).x : 2.147483647E9;
}
@Override
class="kw">public double getY() {
class="kw">return this.count > 0 ? ((Vector3d)this.positions.getFirst()).y : 2.147483647E9;
}
@Override
class="kw">public double getZ() {
class="kw">return this.count > 0 ? ((Vector3d)this.positions.getFirst()).z : 2.147483647E9;
}
@Nullable
@Override
class="kw">public Ref<EntityStore> getTarget() {
class="kw">return this.count > 0 ? (Ref)this.refs.getFirst() : null;
}
@Override
class="kw">public boolean provideOrientation(@Nonnull Rotation3f var1) {
if (this.count == 0) {
class="kw">return false;
}
Rotation3f var2 = (Rotation3f)this.orientations.getFirst();
if (var2 == null) {
class="kw">return false;
}
var1.set(var2);
class="kw">return true;
}
@Override
class="kw">public void clear() {
this.count = 0;
}
@Nonnull
@Override
class="kw">public IPositionProvider getPositionProvider() {
class="kw">return this;
}
@Override
class="kw">public int size() {
class="kw">return this.count;
}
@Nullable
@Override
class="kw">public Ref<EntityStore> getTarget(int var1) {
if (var1 >= 0 && var1 < this.count) {
Ref var2 = (Ref<EntityStore>)this.refs.get(var1);
class="kw">return var2 != null && var2.isValid() ? var2 : null;
} else {
class="kw">return null;
}
}
@Override
class="kw">public boolean getPosition(int var1, @Nonnull Vector3d var2) {
if (var1 >= 0 && var1 < this.count) {
var2.set((Vector3dc)this.positions.get(var1));
class="kw">return true;
} else {
class="kw">return false;
}
}
@Override
class="kw">public boolean getOrientation(int var1, @Nonnull Rotation3f var2) {
if (var1 >= 0 && var1 < this.count) {
Rotation3f var3 = (Rotation3f)this.orientations.get(var1);
if (var3 == null) {
class="kw">return false;
}
var2.set(var3);
class="kw">return true;
} else {
class="kw">return false;
}
}
class="kw">public class="kw">static void applyTransform(
@Nonnull IPositionProvider var0,
@Nonnull PositionSetTransform var1,
@Nonnull PositionSetProvider var2,
boolean var3,
@Nonnull Vector3d var4,
@Nonnull Vector3d var5,
@Nonnull Rotation3f var6,
@Nonnull Store<EntityStore> var7
) {
var2.reset();
if (var0 class="kw">instanceof IPositionSet var8) {
int var9 = var8.size();
for (int var10 = 0; var10 < var9; var10++) {
Ref var11 = var3 ? var8.getTarget(var10) : null;
if (var8.getPosition(var10, var4) && var1.transform(var4, var5, var7)) {
if (var8.getOrientation(var10, var6)) {
var2.add(var5.x, var5.y, var5.z, var11, var6);
} else {
var2.add(var5.x, var5.y, var5.z, var11);
}
}
}
} else if (var0.hasPosition()) {
var4.set(var0.getX(), var0.getY(), var0.getZ());
if (!var1.transform(var4, var5, var7)) {
class="kw">return;
}
Ref var12 = var3 ? var0.getTarget() : null;
if (var0.provideOrientation(var6)) {
var2.add(var5.x, var5.y, var5.z, var12, var6);
} else {
var2.add(var5.x, var5.y, var5.z, var12);
}
}
}
}