CacheDensity class
Пакет: com.hypixel.hytale.builtin.hytalegenerator.density
Файл: com/hypixel/hytale/builtin/hytalegenerator/density/CacheDensity.java
extends: Density
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Vector3d |
position |
|
double |
value |
Методы (3)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
private |
Cacheprivate Cache() |
|
|
if if(this.cache.position != null
&& this.cache.position.x == var1.position.x
&& this.cache.position.y == var1.position.y
&& this.cache.position.z == var1.position.z) |
|
|
if if(this.cache.position == null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.hytalegenerator.density;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class CacheDensity class="kw">extends Density {
@Nonnull
class="kw">private class="kw">final CacheDensity.Cache cache;
@Nonnull
class="kw">private Density input;
class="kw">public CacheDensity(@Nonnull Density var1) {
this.input = var1;
this.cache = new CacheDensity.Cache();
}
@Override
class="kw">public double process(@Nonnull Density.Context var1) {
if (this.cache.position != null
&& this.cache.position.x == var1.position.x
&& this.cache.position.y == var1.position.y
&& this.cache.position.z == var1.position.z) {
class="kw">return this.cache.value;
}
if (this.cache.position == null) {
this.cache.position = new Vector3d();
}
this.cache.position.set(var1.position);
this.cache.value = this.input.process(var1);
class="kw">return this.cache.value;
}
@Override
class="kw">public void setInputs(@Nonnull Density[] var1) {
assert var1.length != 0;
assert var1[0] != null;
this.input = var1[0];
}
class="kw">private class="kw">static class Cache {
Vector3d position;
double value;
class="kw">private Cache() {
}
}
}