From 44e0c60bc149c480af19084b9658a04cf6ae9e98 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 7 Nov 2020 15:35:40 +0800 Subject: [PATCH] nbt types utils --- build.gradle | 3 ++ .../shedaniel/architectury/utils/NbtType.java | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 common/src/main/java/me/shedaniel/architectury/utils/NbtType.java diff --git a/build.gradle b/build.gradle index 02e6b09b..5a0ca6b5 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,9 @@ allprojects { year = 2020 } + exclude "**/NbtType.java" + exclude "**/*.accessWidener" + ignoreFailures = true } } diff --git a/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java b/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java new file mode 100644 index 00000000..0a9161b6 --- /dev/null +++ b/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() {} +}