PatternDirectionality class
Пакет: com.hypixel.hytale.builtin.hytalegenerator.props.deprecated.directionality
Файл: com/hypixel/hytale/builtin/hytalegenerator/props/deprecated/directionality/PatternDirectionality.java
extends: Directionality
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
break |
|
|
break |
|
|
break |
|
ArrayList |
var2 |
|
FastRandom |
var3 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
switch switch(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.hytalegenerator.props.deprecated.directionality;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.bounds.Bounds3i;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.patterns.OrPattern;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.patterns.Pattern;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.rng.RngField;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.scanners.Scanner;
class="kw">import com.hypixel.hytale.math.util.FastRandom;
class="kw">import com.hypixel.hytale.server.core.prefab.PrefabRotation;
class="kw">import java.util.ArrayList;
class="kw">import java.util.Collections;
class="kw">import java.util.List;
class="kw">import javax.annotation.Nonnull;
class="kw">public class PatternDirectionality class="kw">extends Directionality {
@Nonnull
class="kw">private class="kw">final List<PrefabRotation> rotations;
@Nonnull
class="kw">private class="kw">final PrefabRotation south;
@Nonnull
class="kw">private class="kw">final PrefabRotation north;
@Nonnull
class="kw">private class="kw">final PrefabRotation east;
@Nonnull
class="kw">private class="kw">final PrefabRotation west;
@Nonnull
class="kw">private class="kw">final Pattern southPattern;
@Nonnull
class="kw">private class="kw">final Pattern northPattern;
@Nonnull
class="kw">private class="kw">final Pattern eastPattern;
@Nonnull
class="kw">private class="kw">final Pattern westPattern;
@Nonnull
class="kw">private class="kw">final Pattern generalPattern;
@Nonnull
class="kw">private class="kw">final RngField rngField;
@Nonnull
class="kw">private class="kw">final Bounds3i bounds_voxelGrid;
class="kw">public PatternDirectionality(
@Nonnull OrthogonalDirection var1, @Nonnull Pattern var2, @Nonnull Pattern var3, @Nonnull Pattern var4, @Nonnull Pattern var5, int var6
) {
this.southPattern = var2;
this.northPattern = var3;
this.eastPattern = var4;
this.westPattern = var5;
this.generalPattern = new OrPattern(List.of(var3, var2, var4, var5));
this.rngField = new RngField(var6);
this.bounds_voxelGrid = this.generalPattern.getBounds_voxelGrid().clone();
this.bounds_voxelGrid.encompass(var2.getBounds_voxelGrid());
this.bounds_voxelGrid.encompass(var3.getBounds_voxelGrid());
this.bounds_voxelGrid.encompass(var4.getBounds_voxelGrid());
this.bounds_voxelGrid.encompass(var5.getBounds_voxelGrid());
class="kw">switch (var1) {
case S:
this.south = PrefabRotation.ROTATION_0;
this.west = PrefabRotation.ROTATION_270;
this.north = PrefabRotation.ROTATION_180;
this.east = PrefabRotation.ROTATION_90;
break;
case E:
this.east = PrefabRotation.ROTATION_180;
this.south = PrefabRotation.ROTATION_90;
this.west = PrefabRotation.ROTATION_0;
this.north = PrefabRotation.ROTATION_270;
break;
case W:
this.west = PrefabRotation.ROTATION_180;
this.north = PrefabRotation.ROTATION_90;
this.east = PrefabRotation.ROTATION_0;
this.south = PrefabRotation.ROTATION_270;
break;
class="kw">default:
this.north = PrefabRotation.ROTATION_0;
this.east = PrefabRotation.ROTATION_270;
this.south = PrefabRotation.ROTATION_180;
this.west = PrefabRotation.ROTATION_90;
}
this.rotations = Collections.unmodifiableList(List.of(this.north, this.south, this.east, this.west));
}
@Nonnull
@Override
class="kw">public Pattern getGeneralPattern() {
class="kw">return this.generalPattern;
}
@Nonnull
@Override
class="kw">public Bounds3i getBoundsWith_voxelGrid(@Nonnull Scanner var1) {
class="kw">return this.bounds_voxelGrid;
}
@Nonnull
@Override
class="kw">public List<PrefabRotation> getPossibleRotations() {
class="kw">return this.rotations;
}
@Override
class="kw">public PrefabRotation getRotationAt(@Nonnull Pattern.Context var1) {
ArrayList var2 = new ArrayList<>(4);
if (this.northPattern.matches(var1)) {
var2.add(this.north);
}
if (this.southPattern.matches(var1)) {
var2.add(this.south);
}
if (this.eastPattern.matches(var1)) {
var2.add(this.east);
}
if (this.westPattern.matches(var1)) {
var2.add(this.west);
}
if (var2.isEmpty()) {
class="kw">return null;
}
FastRandom var3 = new FastRandom(this.rngField.get(var1.position.x, var1.position.y, var1.position.z));
class="kw">return var2.get(var3.nextInt(var2.size()));
}
}