From a00c699024477b6393b9d0d3f222eedff8aebc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=ADSollace?= Date: Fri, 16 Apr 2021 16:20:36 +0200 Subject: [PATCH] Yet more obscure stuff (#2323) * Map some incidental fields * Map the very hard to understand (unused) class. Name is WIP. Mahjong pls. * ExpandingLongLinkedOpenHashSet -> LinkedBlockPosHashSet + docs * Fix typo * Apply suggestions from code review Co-authored-by: YanisBft * Update mappings/net/minecraft/util/collection/LinkedBlockPosHashSet.mapping Co-authored-by: YanisBft --- .../minecraft/util/collection/IdList.mapping | 1 + .../collection/LinkedBlockPosHashSet.mapping | 92 +++++++++++++++++++ .../util/collection/SortedArraySet.mapping | 6 ++ .../world/chunk/light/LevelPropagator.mapping | 1 + 4 files changed, 100 insertions(+) create mode 100644 mappings/net/minecraft/util/collection/LinkedBlockPosHashSet.mapping diff --git a/mappings/net/minecraft/util/collection/IdList.mapping b/mappings/net/minecraft/util/collection/IdList.mapping index 4909986034..265d47651e 100644 --- a/mappings/net/minecraft/util/collection/IdList.mapping +++ b/mappings/net/minecraft/util/collection/IdList.mapping @@ -2,6 +2,7 @@ CLASS net/minecraft/class_2361 net/minecraft/util/collection/IdList FIELD field_11098 list Ljava/util/List; FIELD field_11099 nextId I FIELD field_11100 idMap Ljava/util/IdentityHashMap; + FIELD field_33088 NULL_ID I METHOD (I)V ARG 1 initialSize METHOD method_10203 set (Ljava/lang/Object;I)V diff --git a/mappings/net/minecraft/util/collection/LinkedBlockPosHashSet.mapping b/mappings/net/minecraft/util/collection/LinkedBlockPosHashSet.mapping new file mode 100644 index 0000000000..462227b667 --- /dev/null +++ b/mappings/net/minecraft/util/collection/LinkedBlockPosHashSet.mapping @@ -0,0 +1,92 @@ +CLASS net/minecraft/class_6136 net/minecraft/util/collection/LinkedBlockPosHashSet + COMMENT Represents a set of block positions (long representation). + COMMENT

+ COMMENT Uses a {@link Long2LongLinkedOpenHashMap} as its internal storage medium + COMMENT to facilitate the quick addition and removal of block positions. + COMMENT

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

+ COMMENT This has two major advantages: + COMMENT

    + COMMENT
  1. Positions that are geometrically close together are grouped together in memory. This localises adjacent reads and writes.
  2. + COMMENT
  3. A larger number of positions can be comprised together into one long allowing for a smaller memory footprint.
  4. + COMMENT
+ COMMENT @see LevelPropagator + FIELD field_31715 buffer Lnet/minecraft/class_6136$class_6137; + METHOD (IF)V + ARG 1 expectedSize + ARG 2 loadFactor + METHOD add (J)Z + COMMENT Marks a block position as "set". + ARG 1 posLong + METHOD isEmpty ()Z + COMMENT Checks whether there are any block positions that have been "set". + COMMENT + COMMENT @return {@code true} is this collection is empty. + METHOD rem (J)Z + COMMENT Marks a block position as "not set". Effectively removing it from this collection. + ARG 1 posLong + METHOD removeFirstLong ()J + COMMENT Pops first block position off of this set. + METHOD size ()I + COMMENT @throws UnsupportedOperationException + CLASS class_6137 Storage + COMMENT Represents a three-dimensional mapping from a block position to a bitset + COMMENT of values set at that position. + FIELD field_31716 STARTING_OFFSET I + FIELD field_31717 HORIZONTAL_COLUMN_BIT_SEPARATION I + FIELD field_31718 FIELD_SPACING I + FIELD field_31719 Y_BIT_OFFSET I + FIELD field_31720 X_BIT_OFFSET I + FIELD field_31721 Z_BIT_OFFSET I + FIELD field_31722 MAX_POSITION J + FIELD field_31723 lastWrittenIndex I + FIELD field_31724 lastWrittenKey J + FIELD field_31725 expectedSize I + METHOD (IF)V + ARG 1 expectedSize + ARG 2 loadFactor + METHOD method_35481 removeFirstLong ()J + METHOD method_35482 setBits (IJ)Z + COMMENT Sets flags within a specific 2x cubed region represented by {@code index}. + COMMENT + COMMENT @return {@code true} if the map already contained set bits for the indicated mask + COMMENT (i.e. an overlap occurred) + ARG 1 index + COMMENT zero-based index of a 2x cubed area + ARG 2 mask + COMMENT mask of bits to set + METHOD method_35483 getKey (J)J + COMMENT Converts a individual position into a key + COMMENT representing the 2x cube region containing that position. + ARG 0 posLong + METHOD method_35484 getBlockPosLong (JI)J + ARG 0 key + ARG 2 valueLength + METHOD method_35485 unsetBitsAt (IJ)Z + COMMENT Unsets flags within a specific 2x cubed region contained within this map. + COMMENT + COMMENT @return {@code true} if the collection was changed as a result of this call + ARG 1 index + ARG 2 mask + METHOD method_35486 getBlockOffset (J)I + COMMENT Gets a position's index relative to its containing 2x cube region + ARG 0 posLong + METHOD method_35487 add (J)Z + COMMENT Ensures that this collection contains the specified element (optional operation). + COMMENT + COMMENT @see Collection#add(Object) + ARG 1 posLong + METHOD method_35488 rem (J)Z + COMMENT Removes a block position from this map. + ARG 1 posLong + METHOD method_35489 unsetBits (J)Z + COMMENT Unsets flags within the last 2x cubed region contained within this map. + COMMENT

+ COMMENT This is equivalent to the call {@code unsetBitsAt(this.n, mask)} + COMMENT + COMMENT @return {@code true} if the collection was changed as a result of this call + ARG 1 mask + METHOD rehash (I)V + ARG 1 newN diff --git a/mappings/net/minecraft/util/collection/SortedArraySet.mapping b/mappings/net/minecraft/util/collection/SortedArraySet.mapping index a875011c10..7af985b641 100644 --- a/mappings/net/minecraft/util/collection/SortedArraySet.mapping +++ b/mappings/net/minecraft/util/collection/SortedArraySet.mapping @@ -2,6 +2,7 @@ CLASS net/minecraft/class_4706 net/minecraft/util/collection/SortedArraySet FIELD field_21562 comparator Ljava/util/Comparator; FIELD field_21563 elements [Ljava/lang/Object; FIELD field_21564 size I + FIELD field_29860 DEFAULT_CAPACITY I METHOD (ILjava/util/Comparator;)V ARG 1 initialCapacity ARG 2 comparator @@ -25,6 +26,11 @@ CLASS net/minecraft/class_4706 net/minecraft/util/collection/SortedArraySet ARG 1 index METHOD method_23871 get (I)Ljava/lang/Object; ARG 1 index + METHOD method_34958 create ()Lnet/minecraft/class_4706; + METHOD method_34959 create (Ljava/util/Comparator;)Lnet/minecraft/class_4706; + METHOD method_34960 create (Ljava/util/Comparator;I)Lnet/minecraft/class_4706; + ARG 1 initialCapacity + METHOD method_34961 getIfContains (Ljava/lang/Object;)Ljava/lang/Object; METHOD method_34962 last ()Ljava/lang/Object; CLASS class_4707 SetIterator FIELD field_21566 nextIndex I diff --git a/mappings/net/minecraft/world/chunk/light/LevelPropagator.mapping b/mappings/net/minecraft/world/chunk/light/LevelPropagator.mapping index e06418f4bb..9aab3df3cc 100644 --- a/mappings/net/minecraft/world/chunk/light/LevelPropagator.mapping +++ b/mappings/net/minecraft/world/chunk/light/LevelPropagator.mapping @@ -4,6 +4,7 @@ CLASS net/minecraft/class_3554 net/minecraft/world/chunk/light/LevelPropagator FIELD field_15783 levelCount I FIELD field_15784 pendingUpdates Lit/unimi/dsi/fastutil/longs/Long2ByteMap; FIELD field_15785 pendingIdUpdatesByLevel [Lit/unimi/dsi/fastutil/longs/LongLinkedOpenHashSet; + FIELD field_31706 MAX_LEVEL I METHOD (III)V ARG 1 levelCount ARG 2 expectedLevelSize