HeightMask class
Пакет: com.hypixel.hytale.builtin.worldgen.modifier.content.common
Файл: com/hypixel/hytale/builtin/worldgen/modifier/content/common/HeightMask.java
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<HeightMask> |
CODEC |
|
int |
var1 |
|
int |
var2 |
|
IntRange |
var3 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
protected |
void |
rebuildvoid rebuild() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.worldgen.modifier.content.common;
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.validation.Validators;
class="kw">import com.hypixel.hytale.math.range.IntRange;
class="kw">import com.hypixel.hytale.procedurallib.condition.BasicHeightThresholdInterpreter;
class="kw">import com.hypixel.hytale.procedurallib.condition.DefaultCoordinateRndCondition;
class="kw">import com.hypixel.hytale.procedurallib.condition.ICoordinateRndCondition;
class="kw">import com.hypixel.hytale.procedurallib.condition.IHeightThresholdInterpreter;
class="kw">import javax.annotation.Nonnull;
class="kw">public class HeightMask {
class="kw">public class="kw">static class="kw">final BuilderCodec<HeightMask> CODEC = BuilderCodec.builder(HeightMask.class, HeightMask::new)
.documentation("Defines a height mask that restricts placement to a specific vertical range within the world")
.<Integer>append(new KeyedCodec<>("Min", Codec.INTEGER), (var0, var1) -> var0.range.setInclusiveMin(var1), var0 -> var0.range.getInclusiveMin())
.addValidator(Validators.range(0, 319))
.documentation("The inclusive minimum height of the mask range")
.add()
.<Integer>append(new KeyedCodec<>("Max", Codec.INTEGER), (var0, var1) -> var0.range.setInclusiveMax(var1), var0 -> var0.range.getInclusiveMax())
.addValidator(Validators.range(0, 319))
.documentation("The inclusive maximum height of the mask range")
.add()
.afterDecode(HeightMask::rebuild)
.build();
class="kw">public class="kw">static class="kw">final IHeightThresholdInterpreter DEFAULT_HEIGHT_THRESHOLD = new BasicHeightThresholdInterpreter(
new int[]{0, 319}, new float[]{1.0F, 1.0F}, 320
);
class="kw">public class="kw">static class="kw">final HeightMask DEFAULT = new HeightMask() {
{
this.rebuild();
}
};
class="kw">public class="kw">static class="kw">final HeightMask DEFAULT_ZERO = new HeightMask() {
{
this.range.setInclusiveMin(0);
this.range.setInclusiveMax(0);
this.rebuild();
}
};
class="kw">public class="kw">static class="kw">final HeightMask DEFAULT_ONE = new HeightMask() {
{
this.range.setInclusiveMin(1);
this.range.setInclusiveMax(1);
this.rebuild();
}
};
class="kw">public class="kw">static class="kw">final HeightMask DEFAULT_FLUID = new HeightMask() {
{
this.range.setInclusiveMin(114);
this.range.setInclusiveMax(114);
this.rebuild();
}
};
@Nonnull
class="kw">protected IntRange range = new IntRange(0, 319);
@Nonnull
class="kw">protected class="kw">transient ICoordinateRndCondition condition = DefaultCoordinateRndCondition.DEFAULT_TRUE;
class="kw">public HeightMask() {
}
@Nonnull
class="kw">public IntRange range() {
class="kw">return this.range;
}
@Nonnull
class="kw">public ICoordinateRndCondition getCondition() {
class="kw">return this.condition;
}
class="kw">protected void rebuild() {
int var1 = Math.min(this.range.getInclusiveMin(), this.range.getInclusiveMax());
int var2 = Math.max(this.range.getInclusiveMin(), this.range.getInclusiveMax());
this.range.setInclusiveMin(var1);
this.range.setInclusiveMax(var2);
IntRange var3 = this.range;
this.condition = (var1x, var2x, var3x, var4, var5) -> var4 >= var3.getInclusiveMin() && var4 <= var3.getInclusiveMax();
}
}