Class IntRange

java.lang.Object
net.minecraft.world.level.storage.loot.IntRange

public class IntRange extends Object
A possibly unbounded range of integers based on LootContext. Minimum and maximum are given in the form of NumberProviders. Minimum and maximum are both optional. If given, they are both inclusive.
  • Field Details

  • Constructor Details

  • Method Details

    • getReferencedContextParams

      public Set<LootContextParam<?>> getReferencedContextParams()
    • exact

      public static IntRange exact(int p_165010_)
      Create an IntRange that contains only exactly the given value.
    • range

      public static IntRange range(int pMin, int pMax)
      Create an IntRange that ranges from min to max, both inclusive.
    • lowerBound

      public static IntRange lowerBound(int pMin)
      Create an IntRange with the given minimum (inclusive) and no upper bound.
    • upperBound

      public static IntRange upperBound(int pMax)
      Create an IntRange with the given maximum (inclusive) and no lower bound.
    • clamp

      public int clamp(LootContext pLootContext, int pValue)
      Clamp the given value so that it falls within this IntRange.
    • test

      public boolean test(LootContext pLootContext, int pValue)
      Check whether the given value falls within this IntRange.
    • unpackExact

      private OptionalInt unpackExact()