Class SpawnRule

java.lang.Object
org.bukkit.block.spawner.SpawnRule
All Implemented Interfaces:
Cloneable, ConfigurationSerializable

public class SpawnRule extends Object implements Cloneable, ConfigurationSerializable
Represents a spawn rule that controls what conditions an entity from a monster spawner can spawn.
Since:
1.20.4
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpawnRule(int minBlockLight, int maxBlockLight, int minSkyLight, int maxSkyLight)
    Constructs a new SpawnRule.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull SpawnRule
     
    static @NotNull SpawnRule
    deserialize(@NotNull Map<String,Object> args)
     
    boolean
     
    int
    Gets the maximum (inclusive) block light required for spawning to succeed.
    int
    Gets the maximum (inclusive) sky light required for spawning to succeed.
    int
    Gets the minimum (inclusive) block light required for spawning to succeed.
    int
    Gets the minimum (inclusive) sky light required for spawning to succeed.
    int
     
    @NotNull Map<String,Object>
    Creates a Map representation of this class.
    void
    setMaxBlockLight(int maxBlockLight)
    Sets the maximum (inclusive) block light required for spawning to succeed.
    void
    setMaxSkyLight(int maxSkyLight)
    Sets the maximum (inclusive) sky light required for spawning to succeed.
    void
    setMinBlockLight(int minBlockLight)
    Sets the minimum (inclusive) block light required for spawning to succeed.
    void
    setMinSkyLight(int minSkyLight)
    Sets the minimum (inclusive) sky light required for spawning to succeed.

    Methods inherited from class Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpawnRule

      public SpawnRule(int minBlockLight, int maxBlockLight, int minSkyLight, int maxSkyLight)
      Constructs a new SpawnRule.
      Parameters:
      minBlockLight - The minimum (inclusive) block light required for spawning to succeed.
      maxBlockLight - The maximum (inclusive) block light required for spawning to succeed.
      minSkyLight - The minimum (inclusive) sky light required for spawning to succeed.
      maxSkyLight - The maximum (inclusive) sky light required for spawning to succeed.
      Since:
      1.20.4
  • Method Details

    • getMinBlockLight

      public int getMinBlockLight()
      Gets the minimum (inclusive) block light required for spawning to succeed.
      Returns:
      minimum block light
      Since:
      1.20.4
    • setMinBlockLight

      public void setMinBlockLight(int minBlockLight)
      Sets the minimum (inclusive) block light required for spawning to succeed.
      Parameters:
      minBlockLight - minimum block light
      Since:
      1.20.4
    • getMaxBlockLight

      public int getMaxBlockLight()
      Gets the maximum (inclusive) block light required for spawning to succeed.
      Returns:
      maximum block light
      Since:
      1.20.4
    • setMaxBlockLight

      public void setMaxBlockLight(int maxBlockLight)
      Sets the maximum (inclusive) block light required for spawning to succeed.
      Parameters:
      maxBlockLight - maximum block light
      Since:
      1.20.4
    • getMinSkyLight

      public int getMinSkyLight()
      Gets the minimum (inclusive) sky light required for spawning to succeed.
      Returns:
      minimum sky light
      Since:
      1.20.4
    • setMinSkyLight

      public void setMinSkyLight(int minSkyLight)
      Sets the minimum (inclusive) sky light required for spawning to succeed.
      Parameters:
      minSkyLight - minimum sky light
      Since:
      1.20.4
    • getMaxSkyLight

      public int getMaxSkyLight()
      Gets the maximum (inclusive) sky light required for spawning to succeed.
      Returns:
      maximum sky light
      Since:
      1.20.4
    • setMaxSkyLight

      public void setMaxSkyLight(int maxSkyLight)
      Sets the maximum (inclusive) sky light required for spawning to succeed.
      Parameters:
      maxSkyLight - maximum sky light
      Since:
      1.20.4
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      @NotNull public @NotNull SpawnRule clone()
      Overrides:
      clone in class Object
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Description copied from interface: ConfigurationSerializable
      Creates a Map representation of this class.

      This class must provide a method to restore this class, as defined in the ConfigurationSerializable interface javadocs. nb: It is not intended for this method to be called directly, this will be called by the ConfigurationSerialization class.

      Specified by:
      serialize in interface ConfigurationSerializable
      Returns:
      Map containing the current state of this class
      Since:
      1.20.4
    • deserialize

      @NotNull public static @NotNull SpawnRule deserialize(@NotNull @NotNull Map<String,Object> args)
      Since:
      1.20.4