mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Remove deprecated ItemTag
This commit is contained in:
parent
d4398bda5b
commit
a61ff53189
@ -15,7 +15,6 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ItemMeta implements TagReadable, Writeable {
|
||||
|
||||
@ -157,21 +156,4 @@ public class ItemMeta implements TagReadable, Writeable {
|
||||
writer.write(cachedBuffer);
|
||||
this.cachedBuffer.resetReaderIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getTag(Tag)} with {@link Tag#defaultValue(Supplier)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Contract(pure = true)
|
||||
public <T> T getOrDefault(@NotNull Tag<T> tag, @Nullable T defaultValue) {
|
||||
return tag.defaultValue(defaultValue).read(toNBT());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getTag(Tag)}
|
||||
*/
|
||||
@Deprecated
|
||||
public <T> @Nullable T get(@NotNull Tag<T> tag) {
|
||||
return getTag(tag);
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ public final class ItemStack implements TagReadable, HoverEventSource<HoverEvent
|
||||
private final int amount;
|
||||
private final ItemMeta meta;
|
||||
|
||||
protected ItemStack(@NotNull Material material, int amount,
|
||||
@NotNull ItemMeta meta,
|
||||
@Nullable StackingRule stackingRule) {
|
||||
ItemStack(@NotNull Material material, int amount,
|
||||
@NotNull ItemMeta meta,
|
||||
@Nullable StackingRule stackingRule) {
|
||||
this.material = material;
|
||||
this.amount = amount;
|
||||
this.meta = meta;
|
||||
@ -186,13 +186,6 @@ public final class ItemStack implements TagReadable, HoverEventSource<HoverEvent
|
||||
return result;
|
||||
}
|
||||
|
||||
@Contract(value = "-> new", pure = true)
|
||||
protected @NotNull ItemStackBuilder builder() {
|
||||
return new ItemStackBuilder(material, meta.builder())
|
||||
.amount(amount)
|
||||
.stackingRule(stackingRule);
|
||||
}
|
||||
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
public <T> @NotNull ItemStack withTag(@NotNull Tag<T> tag, @Nullable T value) {
|
||||
return builder().meta(metaBuilder -> metaBuilder.set(tag, value)).build();
|
||||
@ -209,4 +202,11 @@ public final class ItemStack implements TagReadable, HoverEventSource<HoverEvent
|
||||
this.amount,
|
||||
NBTUtils.asBinaryTagHolder(this.meta.toNBT().getCompound("tag")))));
|
||||
}
|
||||
|
||||
@Contract(value = "-> new", pure = true)
|
||||
private @NotNull ItemStackBuilder builder() {
|
||||
return new ItemStackBuilder(material, meta.builder())
|
||||
.amount(amount)
|
||||
.stackingRule(stackingRule);
|
||||
}
|
||||
}
|
||||
|
@ -1,65 +0,0 @@
|
||||
package net.minestom.server.item;
|
||||
|
||||
import net.minestom.server.tag.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBT;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Tag}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ItemTag<T> extends Tag<T> {
|
||||
|
||||
protected ItemTag(@NotNull String key, @NotNull Function<NBTCompound, T> readFunction, @NotNull BiConsumer<NBTCompound, T> writeConsumer) {
|
||||
super(key, readFunction, writeConsumer);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Byte> Byte(@NotNull String key) {
|
||||
return Tag.Byte(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Short> Short(@NotNull String key) {
|
||||
return Tag.Short(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Integer> Integer(@NotNull String key) {
|
||||
return Tag.Integer(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Long> Long(@NotNull String key) {
|
||||
return Tag.Long(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Float> Float(@NotNull String key) {
|
||||
return Tag.Float(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<Double> Double(@NotNull String key) {
|
||||
return Tag.Double(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<byte[]> ByteArray(@NotNull String key) {
|
||||
return Tag.ByteArray(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<String> String(@NotNull String key) {
|
||||
return Tag.String(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<NBT> NBT(@NotNull String key) {
|
||||
return Tag.NBT(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<int[]> IntArray(@NotNull String key) {
|
||||
return Tag.IntArray(key);
|
||||
}
|
||||
|
||||
public static @NotNull Tag<long[]> LongArray(@NotNull String key) {
|
||||
return Tag.LongArray(key);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user