HyCodeYourTale
classpublicPriority 3

GrassTopMaterialProvider

com.hypixel.hytale.builtin.hytalegenerator.materialproviders.GrassTopMaterialProvider

extends MaterialProvider

1

Methods

1

Public Methods

4

Fields

1

Constructors

Constructors

public
GrassTopMaterialProvider(SolidMaterial grass, SolidMaterial dirt, SolidMaterial stone, SolidMaterial empty)

Methods

Public Methods (1)

public
SolidMaterial getVoxelTypeAt(MaterialProvider.Context context)

Fields

Private/Package Fields (4)

privateSolidMaterial dirt
privateSolidMaterial empty
privateSolidMaterial grass
privateSolidMaterial stone

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.material.SolidMaterial;
import javax.annotation.Nonnull;

public class GrassTopMaterialProvider extends MaterialProvider<SolidMaterial> {
   private final SolidMaterial grass;
   private final SolidMaterial dirt;
   private final SolidMaterial stone;
   private final SolidMaterial empty;

   public GrassTopMaterialProvider(@Nonnull SolidMaterial grass, @Nonnull SolidMaterial dirt, @Nonnull SolidMaterial stone, @Nonnull SolidMaterial empty) {
      this.grass = grass;
      this.dirt = dirt;
      this.stone = stone;
      this.empty = empty;
   }

   public SolidMaterial getVoxelTypeAt(@Nonnull MaterialProvider.Context context) {
      if (context.depthIntoFloor == 1) {
         return this.grass;
      } else if (context.depthIntoFloor > 1 && context.depthIntoFloor <= 3) {
         return this.dirt;
      } else {
         return context.depthIntoFloor > 3 ? this.stone : this.empty;
      }
   }
}