CuboidProp class

Пакет: com.hypixel.hytale.builtin.hytalegenerator.props

Файл: com/hypixel/hytale/builtin/hytalegenerator/props/CuboidProp.java

extends: Prop

Поля (4)

МодификаторыТипИмя
int var2
int var3
Vector3i var4
Material var5

Методы (3)

МодификаторыВозвратСигнатура
for for(var4.x = this.rIntersectingBounds.min.x; var4.x < this.rIntersectingBounds.max.x; var4.x++)
for for(var4.z = this.rIntersectingBounds.min.z; var4.z < this.rIntersectingBounds.max.z; var4.z++)
for for(var4.y = this.rIntersectingBounds.min.y; var4.y < this.rIntersectingBounds.max.y; var4.y++)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.hytalegenerator.props;

class="kw">import com.hypixel.hytale.builtin.hytalegenerator.bounds.Bounds3i;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.material.Material;
class="kw">import com.hypixel.hytale.builtin.hytalegenerator.materialproviders.MaterialProvider;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3i;

class="kw">public class CuboidProp class="kw">extends Prop {
   @Nonnull
   class="kw">private class="kw">final Bounds3i bounds;
   @Nonnull
   class="kw">private class="kw">final MaterialProvider<Material> materialProvider;
   @Nonnull
   class="kw">private class="kw">final Bounds3i rIntersectingBounds;
   @Nonnull
   class="kw">private class="kw">final MaterialProvider.Context rContext;

   class="kw">public CuboidProp(@Nonnull Bounds3i var1, @Nonnull MaterialProvider<Material> var2) {
      this.bounds = var1.clone();
      this.materialProvider = var2;
      this.rIntersectingBounds = new Bounds3i();
      this.rContext = new MaterialProvider.Context(new Vector3i(), 1.0, 0, 0, 0, 0, null, Double.MAX_VALUE, null, null);
   }

   @Override
   class="kw">public boolean generate(@Nonnull Prop.Context var1) {
      this.rIntersectingBounds.assign(this.bounds);
      this.rIntersectingBounds.offset(var1.position);
      int var2 = this.rIntersectingBounds.min.y;
      int var3 = this.rIntersectingBounds.max.y;
      this.rIntersectingBounds.intersect(var1.materialWriteSpace.getBounds());
      Vector3i var4 = this.rContext.position;
      this.rContext.density = 1.0;

      for (var4.x = this.rIntersectingBounds.min.x; var4.x < this.rIntersectingBounds.max.x; var4.x++) {
         for (var4.z = this.rIntersectingBounds.min.z; var4.z < this.rIntersectingBounds.max.z; var4.z++) {
            for (var4.y = this.rIntersectingBounds.min.y; var4.y < this.rIntersectingBounds.max.y; var4.y++) {
               this.rContext.depthIntoFloor = var3 - var4.y;
               this.rContext.depthIntoCeiling = var4.y - var2;
               this.rContext.spaceAboveFloor = Integer.MAX_VALUE;
               this.rContext.spaceBelowCeiling = Integer.MAX_VALUE;
               Material var5 = this.materialProvider.getVoxelTypeAt(this.rContext);
               var1.materialWriteSpace.set(var5, var4);
            }
         }
      }

      class="kw">return true;
   }

   @Nonnull
   @Override
   class="kw">public Bounds3i getReadBounds_voxelGrid() {
      class="kw">return Bounds3i.ZERO;
   }

   @Nonnull
   @Override
   class="kw">public Bounds3i getWriteBounds_voxelGrid() {
      class="kw">return this.bounds;
   }
}