Browse Source

nbt types utils

shedaniel 4 years ago
parent
commit
44e0c60bc1
2 changed files with 47 additions and 0 deletions
  1. 3 0
      build.gradle
  2. 44 0
      common/src/main/java/me/shedaniel/architectury/utils/NbtType.java

+ 3 - 0
build.gradle

@@ -31,6 +31,9 @@ allprojects {
             year = 2020
             year = 2020
         }
         }
 
 
+        exclude "**/NbtType.java"
+        exclude "**/*.accessWidener"
+
         ignoreFailures = true
         ignoreFailures = true
     }
     }
 }
 }

+ 44 - 0
common/src/main/java/me/shedaniel/architectury/utils/NbtType.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, 2017, 2018, 2019 FabricMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package me.shedaniel.architectury.utils;
+
+import net.minecraft.nbt.CompoundTag;
+
+public final class NbtType {
+    public static final int END = 0;
+    public static final int BYTE = 1;
+    public static final int SHORT = 2;
+    public static final int INT = 3;
+    public static final int LONG = 4;
+    public static final int FLOAT = 5;
+    public static final int DOUBLE = 6;
+    public static final int BYTE_ARRAY = 7;
+    public static final int STRING = 8;
+    public static final int LIST = 9;
+    public static final int COMPOUND = 10;
+    public static final int INT_ARRAY = 11;
+    public static final int LONG_ARRAY = 12;
+    
+    /**
+     * Any numeric value: byte, short, int, long, float, double.
+     *
+     * @see CompoundTag#contains(String, int)
+     */
+    public static final int NUMBER = 99;
+    
+    private NbtType() {}
+}