mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-21 20:42:28 +00:00
Replace fields for tickDelay and isBoundTool as well as the drain cost and bound tool right click cost with overridable methods. Removed parameters from various methods and made some static methods instance methods as a consequence.
Improved the check for valid sigils to put in the Sigil of Holding by using an overridable method instead of checking if it's a SigilOfHolding.
This commit is contained in:
1 parent
3e40aa9708
commit
fc589690d0
24 files changed
+204
-101
No files matched your search
@@ -12,23 +12,28 @@ 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.
|
||||
*/
|
||||
static boolean toggleSigil(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int energyUsed,
|
||||
int tickDelay) {
|
||||
default boolean toggleSigil(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode
|
||||
&& !EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, energyUsed)) {
|
||||
&& !EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, this.drainCost())) {
|
||||
IBindable.setActive(par1ItemStack, false);
|
||||
}
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, energyUsed)) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
IBindable.setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
this.setDrainTick(par1ItemStack, par2World);
|
||||
return true;
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user