HyCodeYourTale
classpublicPriority 3

HorizontalMaterialProvider

com.hypixel.hytale.builtin.hytalegenerator.materialproviders.HorizontalMaterialProvider

extends MaterialProvider

1

Methods

1

Public Methods

3

Fields

1

Constructors

Constructors

public
HorizontalMaterialProvider(MaterialProvider<V> materialProvider, DoubleFunctionXZ topY, DoubleFunctionXZ bottomY)

Methods

Public Methods (1)

public
V getVoxelTypeAt(MaterialProvider.Context context)
@Nullable@Override

Fields

Private/Package Fields (3)

privateDoubleFunctionXZ bottomY
privateMaterialProvider<V> materialProvider
privateDoubleFunctionXZ topY

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.builtin.hytalegenerator.materialproviders;

import com.hypixel.hytale.builtin.hytalegenerator.materialproviders.functions.DoubleFunctionXZ;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class HorizontalMaterialProvider<V> extends MaterialProvider<V> {
   @Nonnull
   private final MaterialProvider<V> materialProvider;
   @Nonnull
   private final DoubleFunctionXZ topY;
   @Nonnull
   private final DoubleFunctionXZ bottomY;

   public HorizontalMaterialProvider(@Nonnull MaterialProvider<V> materialProvider, @Nonnull DoubleFunctionXZ topY, @Nonnull DoubleFunctionXZ bottomY) {
      this.materialProvider = materialProvider;
      this.topY = topY;
      this.bottomY = bottomY;
   }

   @Nullable
   @Override
   public V getVoxelTypeAt(@Nonnull MaterialProvider.Context context) {
      double topY = this.topY.apply((double)context.position.x, (double)context.position.z);
      double bottomY = this.bottomY.apply((double)context.position.x, (double)context.position.z);
      return !((double)context.position.y >= topY) && !((double)context.position.y < bottomY) ? this.materialProvider.getVoxelTypeAt(context) : null;
   }
}