CaveNode class
Пакет: com.hypixel.hytale.server.worldgen.cave.element
Файл: com/hypixel/hytale/server/worldgen/cave/element/CaveNode.java
implements: CaveElement
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
CaveNodeType |
caveNodeType |
|
int |
var2 |
|
int |
var3 |
|
int |
var4 |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
void |
addPrefabvoid addPrefab(@Nonnull CavePrefab var1) |
public |
void |
compilevoid compile() |
|
|
for for(int var6 = var2; var6 <= var4; var6++) |
abstract |
|
for for(int var5 = this.bounds.getLowChunkX() |
public |
void |
forEachChunkvoid forEachChunk(@Nonnull LongConsumer var1) |
public |
CaveNodeType |
getCaveNodeTypeCaveNodeType getCaveNodeType() |
public |
CavePrefab[] |
getCavePrefabsCavePrefab[] getCavePrefabs() |
public |
int |
getCeilingPositionint getCeilingPosition(int var1, double var2, double var4) |
public |
Vector3d |
getEndVector3d getEnd() |
public |
int |
getFloorPositionint getFloorPosition(int var1, double var2, double var4) |
public |
float |
getPitchfloat getPitch() |
public |
int |
getSeedOffsetint getSeedOffset() |
public |
float |
getYawfloat getYaw() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.worldgen.cave.element;
class="kw">import com.hypixel.hytale.math.util.ChunkUtil;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.server.worldgen.cave.CaveNodeType;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.CaveNodeShape;
class="kw">import com.hypixel.hytale.server.worldgen.util.bounds.IWorldBounds;
class="kw">import com.hypixel.hytale.server.worldgen.util.bounds.WorldBounds;
class="kw">import java.util.ArrayList;
class="kw">import java.util.Arrays;
class="kw">import java.util.List;
class="kw">import java.util.function.LongConsumer;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">public class CaveNode class="kw">implements CaveElement {
class="kw">private class="kw">final CaveNodeType caveNodeType;
@Nonnull
class="kw">private class="kw">final CaveNodeShape shape;
@Nonnull
class="kw">private class="kw">final WorldBounds bounds;
class="kw">private class="kw">final int seedOffset;
class="kw">private class="kw">final float pitch;
class="kw">private class="kw">final float yaw;
@Nullable
class="kw">private List<CavePrefab> rawCavePrefabs;
class="kw">private CavePrefab[] cavePrefabs;
class="kw">public CaveNode(int var1, CaveNodeType var2, @Nonnull CaveNodeShape var3, float var4, float var5) {
this.seedOffset = var1;
this.rawCavePrefabs = new ArrayList<>();
this.caveNodeType = var2;
this.shape = var3;
this.yaw = var4;
this.pitch = var5;
this.bounds = new WorldBounds(var3.getBounds());
}
class="kw">public int getSeedOffset() {
class="kw">return this.seedOffset;
}
class="kw">public CaveNodeType getCaveNodeType() {
class="kw">return this.caveNodeType;
}
@Nonnull
class="kw">public CaveNodeShape getShape() {
class="kw">return this.shape;
}
class="kw">public CavePrefab[] getCavePrefabs() {
class="kw">return this.cavePrefabs;
}
class="kw">public float getYaw() {
class="kw">return this.yaw;
}
class="kw">public float getPitch() {
class="kw">return this.pitch;
}
class="kw">public Vector3d getEnd() {
class="kw">return this.shape.getEnd();
}
class="kw">public void addPrefab(@Nonnull CavePrefab var1) {
this.rawCavePrefabs.add(var1);
this.bounds.include(var1.getBounds());
}
@Nonnull
@Override
class="kw">public IWorldBounds getBounds() {
class="kw">return this.bounds;
}
class="kw">public int getFloorPosition(int var1, double var2, double var4) {
class="kw">return MathUtil.floor(this.shape.getFloorPosition(var1, var2, var4));
}
class="kw">public int getCeilingPosition(int var1, double var2, double var4) {
class="kw">return MathUtil.floor(this.shape.getCeilingPosition(var1, var2, var4));
}
class="kw">public void forEachChunk(@Nonnull LongConsumer var1) {
int var2 = this.bounds.getLowChunkZ();
int var3 = this.bounds.getHighChunkX();
int var4 = this.bounds.getHighChunkZ();
for (int var5 = this.bounds.getLowChunkX(); var5 <= var3; var5++) {
for (int var6 = var2; var6 <= var4; var6++) {
var1.accept(ChunkUtil.indexChunk(var5, var6));
}
}
}
class="kw">public void compile() {
this.cavePrefabs = this.rawCavePrefabs.toArray(CavePrefab[]::new);
this.rawCavePrefabs = null;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "CaveNode{cavePrefabs="
+ Arrays.toString(this.cavePrefabs)
+ ", rawCavePrefabs="
+ this.rawCavePrefabs
+ ", caveNodeType="
+ this.caveNodeType
+ ", shape="
+ this.shape
+ ", bounds="
+ this.bounds
+ ", seedOffset="
+ this.seedOffset
+ ", pitch="
+ this.pitch
+ ", yaw="
+ this.yaw
+ "}";
}
}