Unicopia/src/main/java/com/minelittlepony/unicopia/item/GlowableItem.java

16 lines
465 B
Java
Raw Normal View History

2021-02-03 21:25:42 +01:00
package com.minelittlepony.unicopia.item;
import net.minecraft.item.ItemStack;
2021-08-04 15:38:03 +02:00
import net.minecraft.nbt.NbtCompound;
2021-02-03 21:25:42 +01:00
public interface GlowableItem {
default boolean isGlowing(ItemStack stack) {
2021-08-04 15:38:03 +02:00
NbtCompound tag = stack.getSubTag("display");
2021-02-03 21:25:42 +01:00
return tag != null && tag.getBoolean("glowing");
}
default void setGlowing(ItemStack stack, boolean glowing) {
stack.getOrCreateSubTag("display").putBoolean("glowing", glowing);
}
}