2018-02-15 18:49:01 -08:00
|
|
|
package WayofTime.bloodmagic.iface;
|
2016-02-04 02:45:19 -08:00
|
|
|
|
2018-02-27 16:59:51 -08:00
|
|
|
import WayofTime.bloodmagic.util.Constants;
|
2016-02-04 02:45:19 -08:00
|
|
|
import net.minecraft.item.ItemStack;
|
2018-02-27 16:59:51 -08:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
|
|
|
import javax.annotation.Nonnull;
|
2016-02-04 02:45:19 -08:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public interface IActivatable {
|
2016-02-04 02:45:19 -08:00
|
|
|
|
2018-02-27 16:59:51 -08:00
|
|
|
default boolean getActivated(ItemStack stack) {
|
|
|
|
return !stack.isEmpty() && stack.hasTagCompound() && stack.getTagCompound().getBoolean(Constants.NBT.ACTIVATED);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nonnull
|
|
|
|
default ItemStack setActivatedState(ItemStack stack, boolean activated) {
|
|
|
|
if (!stack.isEmpty()) {
|
|
|
|
if (!stack.hasTagCompound())
|
|
|
|
stack.setTagCompound(new NBTTagCompound());
|
|
|
|
|
|
|
|
stack.getTagCompound().setBoolean(Constants.NBT.ACTIVATED, activated);
|
|
|
|
}
|
|
|
|
|
|
|
|
return stack;
|
|
|
|
}
|
2016-02-04 02:45:19 -08:00
|
|
|
}
|