Files
BloodMagic/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ISigil.java
T
koolkrafter5andgithub-actions[bot] 3b2b31f733 Spring Cleaning (#127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-12 20:52:29 +02:00

39 lines
1.2 KiB
Java

package WayofTime.alchemicalWizardry.api.items.interfaces;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public interface ISigil extends IBindable {
/**
* Toggles the state of the sigil. Returns true if the sigil is active after the toggle or false if it is inactive
* after the toggle.
*/
default boolean toggleSigil(ItemStack item, World world, EntityPlayer player) {
IBindable.setActive(item, !IBindable.isActive(item));
if (!player.capabilities.isCreativeMode && !EnergyItems.syphonBatteries(item, player, this.drainCost())) {
IBindable.setActive(item, false);
}
if (IBindable.isActive(item)) {
item.setItemDamage(1);
this.setDrainTick(item, world);
return true;
} else {
item.setItemDamage(item.getMaxDamage());
return false;
}
}
/**
* Return false if this sigil should not be able to be put in the Sigil of Holding.
*/
default boolean canBeStored() {
return true;
}
}