Class LinkedBlockPosHashSet

java.lang.Object
java.util.AbstractCollection<Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongSet
it.unimi.dsi.fastutil.longs.AbstractLongSortedSet
it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
net.minecraft.util.collection.LinkedBlockPosHashSet
All Implemented Interfaces:
it.unimi.dsi.fastutil.Hash, it.unimi.dsi.fastutil.longs.LongBidirectionalIterable, it.unimi.dsi.fastutil.longs.LongCollection, it.unimi.dsi.fastutil.longs.LongIterable, it.unimi.dsi.fastutil.longs.LongSet, it.unimi.dsi.fastutil.longs.LongSortedSet, Serializable, Cloneable, Iterable<Long>, Collection<Long>, SequencedCollection<Long>, SequencedSet<Long>, Set<Long>, SortedSet<Long>

public class LinkedBlockPosHashSet extends it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
Represents a set of block positions (long representation).

Uses a Long2LongLinkedOpenHashMap as its internal storage medium to facilitate the quick addition and removal of block positions.

Positions are index into a 2x cubed area that then stores as a long, a bitset representing which positions within that area are currently set.

This has two major advantages:

  1. Positions that are geometrically close together are grouped together in memory. This localizes adjacent reads and writes.
  2. A larger number of positions can be comprised together into one long allowing for a smaller memory footprint.
See Also:
Mappings:
Namespace Name
named net/minecraft/util/collection/LinkedBlockPosHashSet
intermediary net/minecraft/class_6136
official fkw
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Represents a three-dimensional mapping from a block position to a bitset of values set at that position.

    Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash

    it.unimi.dsi.fastutil.Hash.Strategy<K>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet

    containsNull, f, first, key, last, link, mask, maxFill, minN, n, size

    Fields inherited from interface it.unimi.dsi.fastutil.Hash

    DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinkedBlockPosHashSet(int expectedSize, float loadFactor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(long posLong)
    Marks a block position as "set".
    boolean
    Checks whether there are any block positions that have been "set".
    boolean
    rem(long posLong)
    Marks a block position as "not set".
    long
    Pops first block position off of this set.
    int
     

    Methods inherited from class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet

    addAll, addAll, addAndMoveToFirst, addAndMoveToLast, clear, clone, comparator, contains, ensureCapacity, firstLong, fixPointers, fixPointers, forEach, hashCode, headSet, iterator, iterator, lastLong, of, of, of, of, of, rehash, remove, removeLastLong, shiftKeys, spliterator, subSet, tailSet, toSet, toSetWithExpectedSize, trim, trim

    Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongSet

    equals

    Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection

    add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toArray, toLongArray, toLongArray, toString

    Methods inherited from class java.util.AbstractCollection

    toArray, toArray

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    toArray

    Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection

    containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toLongArray, toLongArray

    Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable

    forEach, forEach

    Methods inherited from interface it.unimi.dsi.fastutil.longs.LongSet

    add, contains, remove

    Methods inherited from interface it.unimi.dsi.fastutil.longs.LongSortedSet

    first, headSet, last, subSet, tailSet

    Methods inherited from interface java.util.Set

    add, contains, containsAll, equals, remove, removeAll, retainAll, toArray, toArray

    Methods inherited from interface java.util.SortedSet

    addFirst, addLast, getFirst, getLast, removeFirst, removeLast, reversed
  • Field Details

    • buffer

      private final LinkedBlockPosHashSet.Storage buffer
      Mappings:
      Namespace Name Mixin selector
      named buffer Lnet/minecraft/util/collection/LinkedBlockPosHashSet;buffer:Lnet/minecraft/util/collection/LinkedBlockPosHashSet$Storage;
      intermediary field_31715 Lnet/minecraft/class_6136;field_31715:Lnet/minecraft/class_6136$class_6137;
      official a Lfkw;a:Lfkw$a;
  • Constructor Details

    • LinkedBlockPosHashSet

      public LinkedBlockPosHashSet(int expectedSize, float loadFactor)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/collection/LinkedBlockPosHashSet;<init>(IF)V
      intermediary <init> Lnet/minecraft/class_6136;<init>(IF)V
      official <init> Lfkw;<init>(IF)V
  • Method Details

    • add

      public boolean add(long posLong)
      Marks a block position as "set".
      Specified by:
      add in interface it.unimi.dsi.fastutil.longs.LongCollection
      Overrides:
      add in class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
      Mappings:
      Namespace Name Mixin selector
      named add Lnet/minecraft/util/collection/LinkedBlockPosHashSet;add(J)Z
      intermediary add Lnet/minecraft/class_6136;add(J)Z
      official add Lfkw;add(J)Z
    • rem

      public boolean rem(long posLong)
      Marks a block position as "not set". Effectively removing it from this collection.
      Specified by:
      rem in interface it.unimi.dsi.fastutil.longs.LongCollection
      Specified by:
      rem in interface it.unimi.dsi.fastutil.longs.LongSet
      Overrides:
      rem in class it.unimi.dsi.fastutil.longs.AbstractLongSet
      Mappings:
      Namespace Name Mixin selector
      named rem Lnet/minecraft/util/collection/LinkedBlockPosHashSet;rem(J)Z
      intermediary rem Lnet/minecraft/class_6136;rem(J)Z
      official rem Lfkw;rem(J)Z
    • removeFirstLong

      public long removeFirstLong()
      Pops first block position off of this set.
      Overrides:
      removeFirstLong in class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
      Mappings:
      Namespace Name Mixin selector
      named removeFirstLong Lnet/minecraft/util/collection/LinkedBlockPosHashSet;removeFirstLong()J
      intermediary removeFirstLong Lnet/minecraft/class_6136;removeFirstLong()J
      official removeFirstLong Lfkw;removeFirstLong()J
    • size

      public int size()
      Specified by:
      size in interface Collection<Long>
      Specified by:
      size in interface Set<Long>
      Overrides:
      size in class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
      Throws:
      UnsupportedOperationException
      Mappings:
      Namespace Name Mixin selector
      named size Lnet/minecraft/util/collection/LinkedBlockPosHashSet;size()I
      intermediary size Lnet/minecraft/class_6136;size()I
      official size Lfkw;size()I
    • isEmpty

      public boolean isEmpty()
      Checks whether there are any block positions that have been "set".
      Specified by:
      isEmpty in interface Collection<Long>
      Specified by:
      isEmpty in interface Set<Long>
      Overrides:
      isEmpty in class it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet
      Returns:
      true is this collection is empty.
      Mappings:
      Namespace Name Mixin selector
      named isEmpty Lnet/minecraft/util/collection/LinkedBlockPosHashSet;isEmpty()Z
      intermediary isEmpty Lnet/minecraft/class_6136;isEmpty()Z
      official isEmpty Lfkw;isEmpty()Z