Interface WorldGameRules

All Superinterfaces:
GameRules

public interface WorldGameRules extends GameRules
The game rules as one world sees them: the overworld's base values, except for the rules this world overrides
Since:
0.1.0
  • Method Details

    • world

      @Contract(pure=true) World world()
      Gets the world these rules apply to.
      Returns:
      the world
      Since:
      0.1.0
    • holdsBaseValues

      @Contract(pure=true) boolean holdsBaseValues()
      Checks whether this world holds the base values, that is whether it is the overworld.
      Returns:
      true for the overworld, whose setters change the base values
      Since:
      0.1.0
    • isOverridden

      @Contract(pure=true) boolean isOverridden(TypedKey<GameRule> rule)
      Checks whether this world overrides a rule.
      Parameters:
      rule - any rule
      Returns:
      true when the value in effect here comes from this world, not from the base value
      Throws:
      IllegalArgumentException - if the rule is unknown
      Since:
      0.1.0
    • overrides

      Gets the rules this world overrides.
      Returns:
      the overridden rules, sorted by identifier; always empty for the overworld
      Since:
      0.1.0
    • removeOverride

      boolean removeOverride(TypedKey<GameRule> rule)
      Drops the override of a rule, so this world follows the base value again.
      Parameters:
      rule - any rule
      Returns:
      true when an override was actually removed, false when there was none or a listener cancelled the change
      Throws:
      IllegalArgumentException - if the rule is unknown
      Since:
      0.1.0