Nbt type ids unpicked (#2201)

* Nbt type ids

* liach's suggestions

* Update mappings/net/minecraft/nbt/NbtElement.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
Joseph Burton 2021-03-30 22:22:42 +01:00 committed by GitHub
parent 934ac5fc6a
commit 73a389a5e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 158 additions and 47 deletions

View File

@ -1,7 +1,7 @@
CLASS net/minecraft/class_2514 net/minecraft/nbt/AbstractNbtNumber CLASS net/minecraft/class_2514 net/minecraft/nbt/AbstractNbtNumber
COMMENT Represents an NBT number. COMMENT Represents an NBT number.
COMMENT <p> COMMENT <p>
COMMENT The type value {@code 99} can be used to COMMENT The type {@linkplain net.fabricmc.yarn.constants.NbtTypeIds#NUMBER NbtTypeIds.NUMBER} can be used to
COMMENT {@linkplain NbtCompound#contains check for the existence of any numeric element in a NBT compound object}. COMMENT {@linkplain NbtCompound#contains check for the existence of any numeric element in a NBT compound object}.
METHOD method_10696 shortValue ()S METHOD method_10696 shortValue ()S
COMMENT Gets the value as a 16-bit integer. COMMENT Gets the value as a 16-bit integer.

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2481 net/minecraft/nbt/NbtByte CLASS net/minecraft/class_2481 net/minecraft/nbt/NbtByte
COMMENT Represents an NBT byte. COMMENT Represents an NBT byte.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 1}.
FIELD field_11498 value B FIELD field_11498 value B
FIELD field_21025 TYPE Lnet/minecraft/class_4614; FIELD field_21025 TYPE Lnet/minecraft/class_4614;
FIELD field_21026 ZERO Lnet/minecraft/class_2481; FIELD field_21026 ZERO Lnet/minecraft/class_2481;

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2479 net/minecraft/nbt/NbtByteArray CLASS net/minecraft/class_2479 net/minecraft/nbt/NbtByteArray
COMMENT Represents an NBT byte array. COMMENT Represents an NBT byte array.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 7}.
FIELD field_11493 value [B FIELD field_11493 value [B
FIELD field_21024 TYPE Lnet/minecraft/class_4614; FIELD field_21024 TYPE Lnet/minecraft/class_4614;
METHOD <init> (Ljava/util/List;)V METHOD <init> (Ljava/util/List;)V

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2487 net/minecraft/nbt/NbtCompound CLASS net/minecraft/class_2487 net/minecraft/nbt/NbtCompound
COMMENT Represents an NBT compound object which holds unordered key-value pairs with distinct case-sensitive string keys. COMMENT Represents an NBT compound object which holds unordered key-value pairs with distinct case-sensitive string keys.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 10}.
FIELD field_11515 entries Ljava/util/Map; FIELD field_11515 entries Ljava/util/Map;
FIELD field_21029 TYPE Lnet/minecraft/class_4614; FIELD field_21029 TYPE Lnet/minecraft/class_4614;
FIELD field_25128 CODEC Lcom/mojang/serialization/Codec; FIELD field_25128 CODEC Lcom/mojang/serialization/Codec;
@ -20,7 +18,7 @@ CLASS net/minecraft/class_2487 net/minecraft/nbt/NbtCompound
METHOD method_10540 getType (Ljava/lang/String;)B METHOD method_10540 getType (Ljava/lang/String;)B
COMMENT Gets the {@linkplain NbtElement#getType NBT type} of the element stored at the specified key. COMMENT Gets the {@linkplain NbtElement#getType NBT type} of the element stored at the specified key.
COMMENT COMMENT
COMMENT @return the element NBT type, or {@linkplain NbtNull 0} if it does not exist COMMENT @return the element NBT type, or {@linkplain net.fabricmc.yarn.constants.NbtTypeIds#NULL NbtTypeIds.NULL} if it does not exist
ARG 1 key ARG 1 key
METHOD method_10541 getKeys ()Ljava/util/Set; METHOD method_10541 getKeys ()Ljava/util/Set;
METHOD method_10542 readByte (Ljava/io/DataInput;Lnet/minecraft/class_2505;)B METHOD method_10542 readByte (Ljava/io/DataInput;Lnet/minecraft/class_2505;)B
@ -98,7 +96,7 @@ CLASS net/minecraft/class_2487 net/minecraft/nbt/NbtCompound
METHOD method_10573 contains (Ljava/lang/String;I)Z METHOD method_10573 contains (Ljava/lang/String;I)Z
COMMENT Returns whether the NBT compound object contains an element of the specified type at the specified key. COMMENT Returns whether the NBT compound object contains an element of the specified type at the specified key.
COMMENT <p> COMMENT <p>
COMMENT The type restriction can also be {@code 99}, which only allows any type of number. COMMENT The type restriction can also be {@linkplain net.fabricmc.yarn.constants.NbtTypeIds#NUMBER NbtTypeIds.NUMBER}, which only allows any type of number.
COMMENT COMMENT
COMMENT @return {@code true} if the key exists and the element type is equivalent to the given {@code type}, else {@code false} COMMENT @return {@code true} if the key exists and the element type is equivalent to the given {@code type}, else {@code false}
ARG 1 key ARG 1 key

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2489 net/minecraft/nbt/NbtDouble CLASS net/minecraft/class_2489 net/minecraft/nbt/NbtDouble
COMMENT Represents an NBT 64-bit floating-point number. COMMENT Represents an NBT 64-bit floating-point number.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 6}.
FIELD field_11520 value D FIELD field_11520 value D
FIELD field_21030 ZERO Lnet/minecraft/class_2489; FIELD field_21030 ZERO Lnet/minecraft/class_2489;
FIELD field_21031 TYPE Lnet/minecraft/class_4614; FIELD field_21031 TYPE Lnet/minecraft/class_4614;

View File

@ -1,22 +1,5 @@
CLASS net/minecraft/class_2520 net/minecraft/nbt/NbtElement CLASS net/minecraft/class_2520 net/minecraft/nbt/NbtElement
COMMENT Represents an NBT element. COMMENT Represents an NBT element.
COMMENT <p>
COMMENT Each type of NBT element has an associated integer {@linkplain NbtElement#getType NBT type}. The following is a list of possible types:
COMMENT <ul>
COMMENT <li>{@code 0} - null</li>
COMMENT <li>{@code 1} - byte</li>
COMMENT <li>{@code 2} - short</li>
COMMENT <li>{@code 3} - int</li>
COMMENT <li>{@code 4} - long</li>
COMMENT <li>{@code 5} - float</li>
COMMENT <li>{@code 6} - double</li>
COMMENT <li>{@code 7} - byte array</li>
COMMENT <li>{@code 8} - string</li>
COMMENT <li>{@code 9} - list</li>
COMMENT <li>{@code 10} - compound object</li>
COMMENT <li>{@code 11} - int array</li>
COMMENT <li>{@code 12} - long array</li>
COMMENT </ul>
METHOD method_10707 copy ()Lnet/minecraft/class_2520; METHOD method_10707 copy ()Lnet/minecraft/class_2520;
COMMENT Copies this NBT element. COMMENT Copies this NBT element.
COMMENT COMMENT
@ -25,6 +8,8 @@ CLASS net/minecraft/class_2520 net/minecraft/nbt/NbtElement
COMMENT Gets the type of this NBT element. COMMENT Gets the type of this NBT element.
COMMENT COMMENT
COMMENT @return the type COMMENT @return the type
COMMENT
COMMENT @see net.fabricmc.yarn.constants.NbtTypeIds a list of valid types
METHOD method_10713 write (Ljava/io/DataOutput;)V METHOD method_10713 write (Ljava/io/DataOutput;)V
ARG 1 output ARG 1 output
METHOD method_10714 asString ()Ljava/lang/String; METHOD method_10714 asString ()Ljava/lang/String;

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2494 net/minecraft/nbt/NbtFloat CLASS net/minecraft/class_2494 net/minecraft/nbt/NbtFloat
COMMENT Represents an NBT 32-bit floating-point number. COMMENT Represents an NBT 32-bit floating-point number.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 5}.
FIELD field_11523 value F FIELD field_11523 value F
FIELD field_21034 ZERO Lnet/minecraft/class_2494; FIELD field_21034 ZERO Lnet/minecraft/class_2494;
FIELD field_21035 TYPE Lnet/minecraft/class_4614; FIELD field_21035 TYPE Lnet/minecraft/class_4614;

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2497 net/minecraft/nbt/NbtInt CLASS net/minecraft/class_2497 net/minecraft/nbt/NbtInt
COMMENT Represents an NBT 32-bit integer. COMMENT Represents an NBT 32-bit integer.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 3}.
FIELD field_11525 value I FIELD field_11525 value I
FIELD field_21037 TYPE Lnet/minecraft/class_4614; FIELD field_21037 TYPE Lnet/minecraft/class_4614;
METHOD <init> (I)V METHOD <init> (I)V

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2495 net/minecraft/nbt/NbtIntArray CLASS net/minecraft/class_2495 net/minecraft/nbt/NbtIntArray
COMMENT Represents an NBT 32-bit integer array. COMMENT Represents an NBT 32-bit integer array.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 11}.
FIELD field_11524 value [I FIELD field_11524 value [I
FIELD field_21036 TYPE Lnet/minecraft/class_4614; FIELD field_21036 TYPE Lnet/minecraft/class_4614;
METHOD <init> (Ljava/util/List;)V METHOD <init> (Ljava/util/List;)V

View File

@ -3,9 +3,7 @@ CLASS net/minecraft/class_2499 net/minecraft/nbt/NbtList
COMMENT <p> COMMENT <p>
COMMENT An NBT list holds values of the same {@linkplain NbtElement#getType NBT type}. COMMENT An NBT list holds values of the same {@linkplain NbtElement#getType NBT type}.
COMMENT The {@linkplain AbstractNbtList#getHeldType NBT type} of an NBT list is determined COMMENT The {@linkplain AbstractNbtList#getHeldType NBT type} of an NBT list is determined
COMMENT once its first element is inserted; empty NBT lists return {@code 0} as their held {@linkplain AbstractNbtList#getHeldType NBT type}. COMMENT once its first element is inserted; empty NBT lists return {@linkplain net.fabricmc.yarn.constants.NbtTypeIds#NULL NbtTypeIds.NULL} as their held {@linkplain AbstractNbtList#getHeldType NBT type}.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 9}.
FIELD field_11550 value Ljava/util/List; FIELD field_11550 value Ljava/util/List;
FIELD field_11551 type B FIELD field_11551 type B
FIELD field_21039 TYPE Lnet/minecraft/class_4614; FIELD field_21039 TYPE Lnet/minecraft/class_4614;

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2503 net/minecraft/nbt/NbtLong CLASS net/minecraft/class_2503 net/minecraft/nbt/NbtLong
COMMENT Represents an NBT 64-bit integer. COMMENT Represents an NBT 64-bit integer.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 4}.
FIELD field_11553 value J FIELD field_11553 value J
FIELD field_21041 TYPE Lnet/minecraft/class_4614; FIELD field_21041 TYPE Lnet/minecraft/class_4614;
METHOD <init> (J)V METHOD <init> (J)V

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2501 net/minecraft/nbt/NbtLongArray CLASS net/minecraft/class_2501 net/minecraft/nbt/NbtLongArray
COMMENT Represents an NBT 64-bit integer array. COMMENT Represents an NBT 64-bit integer array.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 12}.
FIELD field_11552 value [J FIELD field_11552 value [J
FIELD field_21040 TYPE Lnet/minecraft/class_4614; FIELD field_21040 TYPE Lnet/minecraft/class_4614;
METHOD <init> (Lit/unimi/dsi/fastutil/longs/LongSet;)V METHOD <init> (Lit/unimi/dsi/fastutil/longs/LongSet;)V

View File

@ -3,7 +3,5 @@ CLASS net/minecraft/class_2491 net/minecraft/nbt/NbtNull
COMMENT Defines the end of an NBT compound object, COMMENT Defines the end of an NBT compound object,
COMMENT represents nonexistent values in an NBT compound object, COMMENT represents nonexistent values in an NBT compound object,
COMMENT and is the type of empty NBT lists. COMMENT and is the type of empty NBT lists.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 0}.
FIELD field_21032 TYPE Lnet/minecraft/class_4614; FIELD field_21032 TYPE Lnet/minecraft/class_4614;
FIELD field_21033 INSTANCE Lnet/minecraft/class_2491; FIELD field_21033 INSTANCE Lnet/minecraft/class_2491;

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2516 net/minecraft/nbt/NbtShort CLASS net/minecraft/class_2516 net/minecraft/nbt/NbtShort
COMMENT Represents an NBT 16-bit integer. COMMENT Represents an NBT 16-bit integer.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 2}.
FIELD field_11588 value S FIELD field_11588 value S
FIELD field_21043 TYPE Lnet/minecraft/class_4614; FIELD field_21043 TYPE Lnet/minecraft/class_4614;
METHOD <init> (S)V METHOD <init> (S)V

View File

@ -1,7 +1,5 @@
CLASS net/minecraft/class_2519 net/minecraft/nbt/NbtString CLASS net/minecraft/class_2519 net/minecraft/nbt/NbtString
COMMENT Represents an NBT string. COMMENT Represents an NBT string.
COMMENT <p>
COMMENT This class uses the {@linkplain NbtElement#getType NBT type} {@code 8}.
FIELD field_11590 value Ljava/lang/String; FIELD field_11590 value Ljava/lang/String;
FIELD field_21045 TYPE Lnet/minecraft/class_4614; FIELD field_21045 TYPE Lnet/minecraft/class_4614;
FIELD field_21046 EMPTY Lnet/minecraft/class_2519; FIELD field_21046 EMPTY Lnet/minecraft/class_2519;

View File

@ -0,0 +1,114 @@
/*
* This file is free for everyone to use under the Creative Commons Zero license.
*/
package net.fabricmc.yarn.constants;
/**
* Constants representing the type of an {@linkplain net.minecraft.nbt.NbtElement NbtElement}.
*
* @see net.minecraft.nbt.NbtElement#getType()
*/
public final class NbtTypeIds {
/**
* An NBT null value.
*
* @see net.minecraft.nbt.NbtNull
*/
public static final int NULL = 0;
/**
* An NBT byte value.
*
* @see net.minecraft.nbt.NbtByte
*/
public static final int BYTE = 1;
/**
* An NBT short value.
*
* @see net.minecraft.nbt.NbtShort
*/
public static final int SHORT = 2;
/**
* An NBT integer value.
*
* @see net.minecraft.nbt.NbtInt
*/
public static final int INT = 3;
/**
* An NBT long value.
*
* @see net.minecraft.nbt.NbtLong
*/
public static final int LONG = 4;
/**
* An NBT float value.
*
* @see net.minecraft.nbt.NbtFloat
*/
public static final int FLOAT = 5;
/**
* An NBT double value.
*
* @see net.minecraft.nbt.NbtDouble
*/
public static final int DOUBLE = 6;
/**
* An NBT byte array value.
*
* @see net.minecraft.nbt.NbtByteArray
*/
public static final int BYTE_ARRAY = 7;
/**
* An NBT string value.
*
* @see net.minecraft.nbt.NbtString
*/
public static final int STRING = 8;
/**
* An NBT list value.
*
* @see net.minecraft.nbt.NbtList
*/
public static final int LIST = 9;
/**
* An NBT compound value.
*
* @see net.minecraft.nbt.NbtCompound
*/
public static final int COMPOUND = 10;
/**
* An NBT integer array value.
*
* @see net.minecraft.nbt.NbtIntArray
*/
public static final int INT_ARRAY = 11;
/**
* An NBT long array value.
*
* @see net.minecraft.nbt.NbtLongArray
*/
public static final int LONG_ARRAY = 12;
/**
* A wildcard value that can be used for <i>testing</i> whether an {@linkplain net.minecraft.nbt.NbtElement NbtElement} is an {@linkplain net.minecraft.nbt.AbstractNbtNumber AbstractNbtNumber}.
*
* @see net.minecraft.nbt.NbtCompound#getType(String)
* @see net.minecraft.nbt.NbtCompound#contains(String, int)
*/
public static final int NUMBER = 99;
private NbtTypeIds() {
}
}

View File

@ -0,0 +1,38 @@
v2
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds NULL
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds BYTE
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds SHORT
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds INT
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds LONG
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds FLOAT
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds DOUBLE
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds BYTE_ARRAY
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds STRING
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds LIST
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds COMPOUND
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds INT_ARRAY
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds LONG_ARRAY
constant nbt_type_ids net/fabricmc/yarn/constants/NbtTypeIds NUMBER
target_method net/minecraft/nbt/NbtElement getType ()B
return nbt_type_ids
target_method net/minecraft/nbt/NbtOps method_29144 (BB)Lnet/minecraft/nbt/AbstractNbtList;
param 0 nbt_type_ids
param 1 nbt_type_ids
target_method net/minecraft/nbt/NbtOps method_29145 (BBB)Z
param 0 nbt_type_ids
param 1 nbt_type_ids
param 2 nbt_type_ids
target_method net/minecraft/nbt/NbtCompound getType (Ljava/lang/String;)B
return nbt_type_ids
target_method net/minecraft/nbt/NbtCompound contains (Ljava/lang/String;I)Z
param 1 nbt_type_ids
target_method net/minecraft/nbt/NbtCompound getList (Ljava/lang/String;I)Lnet/minecraft/nbt/NbtList;
param 1 nbt_type_ids
target_method net/minecraft/nbt/AbstractNbtList getHeldType ()B
return nbt_type_ids
target_method net/minecraft/nbt/NbtList <init> (Ljava/util/List;B)V
param 1 nbt_type_ids
target_method net/minecraft/nbt/NbtTypes byId (I)Lnet/minecraft/nbt/NbtType;
param 0 nbt_type_ids