mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-19 19:49:51 +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
@@ -15,16 +15,11 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public interface IBindable {
|
||||
|
||||
// The number of ticks between passive drains
|
||||
int tickDelay = 200;
|
||||
// Set this to true if the right click function should be disabled with the config disableBoundToolsRightClick
|
||||
boolean isBoundTool = false;
|
||||
|
||||
/**
|
||||
* Used by bound tools and the energy blaster/bazooka to check if they should skip their right click function.
|
||||
* Drains the soul network by the amount returned by rightClickCost.
|
||||
*/
|
||||
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer,
|
||||
int rightClickCost) {
|
||||
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (toggle(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
return true;
|
||||
}
|
||||
@@ -37,7 +32,7 @@ public interface IBindable {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isBoundTool && AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
if (isBoundTool() && AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +41,7 @@ public interface IBindable {
|
||||
}
|
||||
|
||||
if (!(par3EntityPlayer.capabilities.isCreativeMode
|
||||
|| EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, rightClickCost))) {
|
||||
|| EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, rightClickCost()))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,33 +86,45 @@ public interface IBindable {
|
||||
return itemTag;
|
||||
}
|
||||
|
||||
static boolean toggle(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
default boolean toggle(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
setActive(par1ItemStack, !isActive(par1ItemStack));
|
||||
setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
setDrainTick(par1ItemStack, par2World);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void passiveDrain(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int delay,
|
||||
int cost) {
|
||||
/**
|
||||
* Checks if the current tick is the proper tick to do a passive drain based on getDrainTicks. If it is, it runs doPassiveDrain and returns true. Otherwise, returns false.
|
||||
*/
|
||||
default boolean checkPassiveDrain(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
if (par2World.getTotalWorldTime() % delay == itemTag.getInteger("worldTimeDelay")
|
||||
if (par2World.getTotalWorldTime() % this.drainTicks() == itemTag.getInteger("worldTimeDelay")
|
||||
&& itemTag.getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, cost)) {
|
||||
setActive(par1ItemStack, false);
|
||||
}
|
||||
this.doPassiveDrain(par1ItemStack, par3EntityPlayer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The action to take when checkPassiveDrain is run on the proper tick based on getDrainTicks.
|
||||
*/
|
||||
default void doPassiveDrain(ItemStack par1ItemStack, EntityPlayer par3EntityPlayer) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, drainCost())) {
|
||||
setActive(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the drain tick delay based on the current world age and the given modulus
|
||||
* Sets the drain tick delay based on the current world age and getDrainTicks().
|
||||
*/
|
||||
static void setDrainTick(ItemStack par1ItemStack, World par2World, int modulus) {
|
||||
getTag(par1ItemStack).setInteger("worldTimeDelay", (int) (par2World.getTotalWorldTime() - 1) % modulus);
|
||||
default void setDrainTick(ItemStack par1ItemStack, World par2World) {
|
||||
getTag(par1ItemStack)
|
||||
.setInteger("worldTimeDelay", (int) (par2World.getTotalWorldTime() - 1) % this.drainTicks());
|
||||
}
|
||||
|
||||
static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
|
||||
@@ -146,4 +153,32 @@ public interface IBindable {
|
||||
NBTTagCompound tag = IBindable.getTag(item);
|
||||
return tag.getString("ownerName");
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of ticks between passive drains from the soul network while the item is active.
|
||||
*/
|
||||
default int drainTicks() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the right click function should be disabled with the config disableBoundToolsRightClick.
|
||||
*/
|
||||
default boolean isBoundTool() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The cost to use the right click function of this item. Used by bound tools and the Energy Blaster/Bazooka.
|
||||
*/
|
||||
default int rightClickCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of LP drained from the soul network for each passive drain while the item is active.
|
||||
*/
|
||||
default int drainCost() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
IBindable.setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
this.setDrainTick(par1ItemStack, par2World);
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
@@ -92,10 +92,6 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
if (par2World.getTotalWorldTime() % tickDelay
|
||||
== par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {}
|
||||
|
||||
// TODO Do stuff
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
public boolean isBoundTool = true;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -61,6 +60,11 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainCost() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.boundaxe.desc"));
|
||||
@@ -86,7 +90,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -146,7 +150,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, 20);
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
@@ -220,4 +224,14 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTool() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rightClickCost() {
|
||||
return rightClickCost;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
public boolean isBoundTool = true;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -62,6 +61,11 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainCost() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc1"));
|
||||
@@ -88,7 +92,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
|
||||
@@ -163,7 +167,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, 20);
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
@@ -197,7 +201,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
EntityLivingBase par7EntityLivingBase) {
|
||||
|
||||
if (par7EntityLivingBase instanceof EntityPlayer) {
|
||||
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed());
|
||||
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, drainCost());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -244,4 +248,14 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTool() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rightClickCost() {
|
||||
return rightClickCost;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
public boolean isBoundTool = true;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -63,6 +62,11 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainCost() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.boundshovel.desc"));
|
||||
@@ -88,7 +92,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -148,7 +152,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, 20);
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
@@ -230,4 +234,14 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundTool() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rightClickCost() {
|
||||
return rightClickCost;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class EnergyBazooka extends EnergyBlast {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDelay() {
|
||||
public int getShotDelay() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBazookaMaxDelay;
|
||||
@@ -77,7 +77,7 @@ public class EnergyBazooka extends EnergyBlast {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDelayAfterActivation() {
|
||||
public int drainTicks() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBazookaMaxDelayAfterActivation;
|
||||
@@ -90,7 +90,7 @@ public class EnergyBazooka extends EnergyBlast {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivationCost() {
|
||||
public int drainCost() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBazookaLPPerActivation;
|
||||
|
||||
@@ -91,8 +91,8 @@ public class EnergyBlast extends EnergyItems {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed())) {
|
||||
setDelay(par1ItemStack, getMaxDelayAfterActivation());
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
setDelay(par1ItemStack, drainTicks());
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class EnergyBlast extends EnergyItems {
|
||||
|
||||
if (!par2World.isRemote) {
|
||||
shoot(par2World, par3EntityPlayer);
|
||||
this.setDelay(par1ItemStack, getMaxDelay());
|
||||
this.setDelay(par1ItemStack, getShotDelay());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
@@ -123,17 +123,15 @@ public class EnergyBlast extends EnergyItems {
|
||||
this.setDelay(par1ItemStack, delay - 1);
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(
|
||||
par1ItemStack,
|
||||
par2World,
|
||||
par3EntityPlayer,
|
||||
getMaxDelayAfterActivation(),
|
||||
getActivationCost());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
public int getMaxDelay() {
|
||||
/**
|
||||
* The delay between firing multiple shots.
|
||||
*/
|
||||
public int getShotDelay() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBlastMaxDelay;
|
||||
@@ -145,7 +143,11 @@ public class EnergyBlast extends EnergyItems {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getMaxDelayAfterActivation() {
|
||||
/**
|
||||
* Used for the warmup delay as well as for passive draining.
|
||||
*/
|
||||
@Override
|
||||
public int drainTicks() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBlastMaxDelayAfterActivation;
|
||||
@@ -157,7 +159,8 @@ public class EnergyBlast extends EnergyItems {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getActivationCost() {
|
||||
@Override
|
||||
public int drainCost() {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return AlchemicalWizardry.energyBlastLPPerActivation;
|
||||
@@ -169,6 +172,11 @@ public class EnergyBlast extends EnergyItems {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rightClickCost() {
|
||||
return getEnergyUsed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
|
||||
@@ -22,11 +22,16 @@ public class EnergyItems extends Item implements IBindable {
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
protected void setEnergyUsed(int par1int) {
|
||||
public void setEnergyUsed(int par1int) {
|
||||
this.energyUsed = par1int;
|
||||
}
|
||||
|
||||
protected int getEnergyUsed() {
|
||||
public int getEnergyUsed() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainCost() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@@ -89,9 +94,9 @@ public class EnergyItems extends Item implements IBindable {
|
||||
posY,
|
||||
posZ);
|
||||
world.playSoundEffect(
|
||||
(double) ((float) player.posX + 0.5F),
|
||||
(double) ((float) player.posY + 0.5F),
|
||||
(double) ((float) player.posZ + 0.5F),
|
||||
((float) player.posX + 0.5F),
|
||||
((float) player.posY + 0.5F),
|
||||
((float) player.posZ + 0.5F),
|
||||
"random.fizz",
|
||||
0.5F,
|
||||
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
@@ -180,21 +185,25 @@ public class EnergyItems extends Item implements IBindable {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Used by some addon mods like Blood Arsenal
|
||||
@Deprecated
|
||||
public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
|
||||
return IBindable.checkAndSetItemOwner(item, player);
|
||||
}
|
||||
|
||||
// Used by some addon mods like Blood Arsenal
|
||||
@Deprecated
|
||||
public static void setItemOwner(ItemStack item, String ownerName) {
|
||||
IBindable.setItemOwner(item, ownerName);
|
||||
}
|
||||
|
||||
// Used by some addon mods like Blood Arsenal
|
||||
@Deprecated
|
||||
public static void checkAndSetItemOwner(ItemStack item, String ownerName) {
|
||||
IBindable.checkAndSetItemOwner(item, ownerName);
|
||||
}
|
||||
|
||||
// Used by some addon mods like Blood Arsenal
|
||||
@Deprecated
|
||||
public static String getOwnerName(ItemStack item) {
|
||||
return IBindable.getOwnerName(item);
|
||||
|
||||
@@ -34,8 +34,6 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
private IIcon passiveIcon;
|
||||
|
||||
private int energyUsed;
|
||||
// The number of ticks between passive drains
|
||||
protected int tickDelay = 100;
|
||||
|
||||
public EnergySword() {
|
||||
super(AlchemicalWizardry.bloodBoundToolMaterial);
|
||||
@@ -54,6 +52,11 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainCost() {
|
||||
return this.energyUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
@@ -95,7 +98,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
if (par3EntityLivingBase instanceof EntityPlayer) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems
|
||||
.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed())) {
|
||||
.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.drainCost())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +111,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
IBindable.toggle(par1ItemStack, par2World, par3EntityPlayer);
|
||||
this.toggle(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -130,7 +133,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 100, 50);
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
@@ -60,13 +60,7 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null || itemTag.getString("ownerName").equals("")) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
String ownerName = itemTag.getString("ownerName");
|
||||
String ownerName = IBindable.getOwnerName(par1ItemStack);
|
||||
|
||||
MovingObjectPosition movingobjectposition = this
|
||||
.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
|
||||
}
|
||||
@@ -101,6 +101,6 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -76,7 +76,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -104,6 +104,6 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,6 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon passiveIcon;
|
||||
|
||||
private int tickDelay = 100;
|
||||
|
||||
public SigilOfGrowth() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
@@ -104,7 +102,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -121,7 +119,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, (EntityPlayer) par3Entity, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, (EntityPlayer) par3Entity);
|
||||
int range = 3;
|
||||
int verticalRange = 2;
|
||||
int posX = (int) Math.round(par3Entity.posX - 0.5f);
|
||||
@@ -174,6 +172,11 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainTicks() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {
|
||||
if (world.isRemote) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,8 +31,6 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon passiveIcon;
|
||||
|
||||
private int tickDelay = 300;
|
||||
|
||||
public SigilOfMagnetism() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
@@ -79,7 +77,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -98,7 +96,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
int range = 5;
|
||||
int verticalRange = 5;
|
||||
@@ -138,6 +136,11 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int drainTicks() {
|
||||
return 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {
|
||||
int range = 5;
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
}
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 200, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class InventoryHolding implements IInventory {
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof ISigil && !(itemStack.getItem() instanceof SigilOfHolding);
|
||||
return itemStack.getItem() instanceof ISigil && ((ISigil) itemStack.getItem()).canBeStored();
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
|
||||
+5
@@ -306,4 +306,9 @@ public class SigilOfHolding extends EnergyItems implements ISigil {
|
||||
inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeStored() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user