Class LinkedBlockPosHashSet

All Implemented Interfaces:
Hash, LongBidirectionalIterable, LongCollection, LongIterable, LongSet, LongSortedSet, Serializable, Cloneable, Iterable<Long>, Collection<Long>, Set<Long>, SortedSet<Long>

public class LinkedBlockPosHashSet extends 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
official dot
intermediary net/minecraft/class_6136
named net/minecraft/util/collection/LinkedBlockPosHashSet
  • Field Details

    • buffer

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

    • LinkedBlockPosHashSet

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

    • add

      public boolean add(long posLong)
      Marks a block position as "set".
      Specified by:
      add in interface LongCollection
      Overrides:
      add in class LongLinkedOpenHashSet
      Mappings:
      Namespace Name Mixin selector
      official add Ldot;add(J)Z
      intermediary add Lnet/minecraft/class_6136;add(J)Z
      named add Lnet/minecraft/util/collection/LinkedBlockPosHashSet;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 LongCollection
      Specified by:
      rem in interface LongSet
      Overrides:
      rem in class AbstractLongSet
      Mappings:
      Namespace Name Mixin selector
      official rem Ldot;rem(J)Z
      intermediary rem Lnet/minecraft/class_6136;rem(J)Z
      named rem Lnet/minecraft/util/collection/LinkedBlockPosHashSet;rem(J)Z
    • removeFirstLong

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

      public int size()
      Specified by:
      size in interface Collection<Long>
      Specified by:
      size in interface Set<Long>
      Overrides:
      size in class LongLinkedOpenHashSet
      Throws:
      UnsupportedOperationException
      Mappings:
      Namespace Name Mixin selector
      official size Ldot;size()I
      intermediary size Lnet/minecraft/class_6136;size()I
      named size Lnet/minecraft/util/collection/LinkedBlockPosHashSet;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 LongLinkedOpenHashSet
      Returns:
      true is this collection is empty.
      Mappings:
      Namespace Name Mixin selector
      official isEmpty Ldot;isEmpty()Z
      intermediary isEmpty Lnet/minecraft/class_6136;isEmpty()Z
      named isEmpty Lnet/minecraft/util/collection/LinkedBlockPosHashSet;isEmpty()Z