BloodMagic/src/main/java/WayofTime/bloodmagic/iface/IActivatable.java
WayofTime d617911d7a Creation of 1.16.3 branch
Initial publishing of the 1.16.3 branch of the mod. A lot of systems are missing (such as Rituals and Living Armour), but enough is present for a decent Alpha release.
2020-10-24 08:59:04 -04:00

30 lines
644 B
Java

package wayoftime.bloodmagic.iface;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import wayoftime.bloodmagic.util.Constants;
public interface IActivatable
{
default boolean getActivated(ItemStack stack)
{
return !stack.isEmpty() && stack.hasTag() && stack.getTag().getBoolean(Constants.NBT.ACTIVATED);
}
@Nonnull
default ItemStack setActivatedState(ItemStack stack, boolean activated)
{
if (!stack.isEmpty())
{
if (!stack.hasTag())
stack.setTag(new CompoundNBT());
stack.getTag().putBoolean(Constants.NBT.ACTIVATED, activated);
}
return stack;
}
}