Klasse Region

java.lang.Object
de.delinkedde.mobarenareborn.arena.Region

public final class Region extends Object
An axis-aligned cuboid region defined by two corners within a single world.

The region is normalised on construction so that the stored minimum and maximum coordinates are independent of the order in which the corners were supplied. It is used for boundary checks (anti-cheat, mob containment) and is immutable.

  • Konstruktordetails

    • Region

      public Region(@NotNull @NotNull String world, int x1, int y1, int z1, int x2, int y2, int z2)
      Creates a region from explicit, already known coordinates.
      Parameter:
      world - the world name
      x1 - first corner X
      y1 - first corner Y
      z1 - first corner Z
      x2 - second corner X
      y2 - second corner Y
      z2 - second corner Z
  • Methodendetails

    • fromCorners

      @NotNull public static @NotNull Region fromCorners(@NotNull @NotNull Location a, @NotNull @NotNull Location b)
      Creates a region from two corner locations.
      Parameter:
      a - the first corner
      b - the second corner
      Gibt zurück:
      the normalised region
      Löst aus:
      IllegalArgumentException - if the corners are in different (or null) worlds
    • contains

      public boolean contains(@NotNull @NotNull Location location)
      Tests whether the given location lies within this region.
      Parameter:
      location - the location to test
      Gibt zurück:
      true if the location is in the same world and within the bounds
    • world

      @NotNull public @NotNull String world()
      Gibt zurück:
      the world name
    • minX

      public int minX()
      Gibt zurück:
      the minimum X coordinate
    • minY

      public int minY()
      Gibt zurück:
      the minimum Y coordinate
    • minZ

      public int minZ()
      Gibt zurück:
      the minimum Z coordinate
    • maxX

      public int maxX()
      Gibt zurück:
      the maximum X coordinate
    • maxY

      public int maxY()
      Gibt zurück:
      the maximum Y coordinate
    • maxZ

      public int maxZ()
      Gibt zurück:
      the maximum Z coordinate