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-12-22 10:15:09 +01:00
NbtCompound tag = stack.getSubNbt("display");
2021-02-03 21:25:42 +01:00
return tag != null && tag.getBoolean("glowing");
}
default void setGlowing(ItemStack stack, boolean glowing) {
2021-12-22 10:15:09 +01:00
stack.getOrCreateSubNbt("display").putBoolean("glowing", glowing);
2021-02-03 21:25:42 +01:00
}
}