HyCodeYourTale
classpublicPriority 3

RandomCoordinateCondition

com.hypixel.hytale.server.worldgen.util.condition.RandomCoordinateCondition

implements ICoordinateCondition

3

Methods

3

Public Methods

1

Fields

1

Constructors

Constructors

public
RandomCoordinateCondition(double chance)

Methods

Public Methods (3)

public
boolean eval(int seed, int x, int y)
@Override
public
boolean eval(int seed, int x, int y, int z)
@Override
public
String toString()
@Nonnull@Override

Fields

Private/Package Fields (1)

privatedouble chance

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.server.worldgen.util.condition;

import com.hypixel.hytale.math.util.HashUtil;
import com.hypixel.hytale.procedurallib.condition.ICoordinateCondition;
import javax.annotation.Nonnull;

public class RandomCoordinateCondition implements ICoordinateCondition {
   private final double chance;

   public RandomCoordinateCondition(double chance) {
      this.chance = chance;
   }

   @Override
   public boolean eval(int seed, int x, int y) {
      return HashUtil.random((long)seed, (long)x, (long)y) <= this.chance;
   }

   @Override
   public boolean eval(int seed, int x, int y, int z) {
      return HashUtil.random((long)seed, (long)x, (long)y, (long)z) <= this.chance;
   }

   @Nonnull
   @Override
   public String toString() {
      return "RandomCoordinateCondition{chance=" + this.chance + "}";
   }
}