mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-19 19:49:51 +00:00
Replace a bunch of duplicated checks done for various items with methods in IBindable.
Replace a bunch of duplicated checks for toggling sigils in ISigil. Move static methods from EnergyItems to IBindable so they are more relevant for the bound tools (they don't extend EnergyItems because they need to extend the tool classes).
This commit is contained in:
1 parent
46a8c566d7
commit
b14aded91f
57 files changed
+382
-759
No files matched your search
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -13,21 +14,133 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public interface IBindable {
|
||||
default void addBindingInformation(ItemStack par1ItemStack, List par3List) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
if (!(itemTag == null)) {
|
||||
if (itemTag.getBoolean("isActive")) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
|
||||
} else if (itemTag.hasKey("isActive")) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
|
||||
}
|
||||
|
||||
if (!itemTag.getString("ownerName").equals("")) {
|
||||
par3List.add(
|
||||
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
|
||||
+ itemTag.getString("ownerName"));
|
||||
// The number of ticks between passive drains
|
||||
int tickDelay = 200;
|
||||
|
||||
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer,
|
||||
int rightClickCost, boolean isBoundTool) {
|
||||
if (toggle(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (par2World.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isActive(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isBoundTool && AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(par3EntityPlayer.capabilities.isCreativeMode
|
||||
|| EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, rightClickCost))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
default void addBindingInformation(ItemStack par1ItemStack, List par3List) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
if (itemTag.getBoolean("isActive")) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
|
||||
} else if (itemTag.hasKey("isActive")) { // Only if present and set to false rather than not present at all
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
|
||||
}
|
||||
|
||||
if (!itemTag.getString("ownerName").equals("")) {
|
||||
par3List.add(
|
||||
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
|
||||
+ itemTag.getString("ownerName"));
|
||||
}
|
||||
}
|
||||
|
||||
static void setActive(ItemStack par1ItemStack, boolean state) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
itemTag.setBoolean("isActive", state);
|
||||
}
|
||||
|
||||
static boolean isActive(ItemStack par1ItemStack) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
static NBTTagCompound getTag(ItemStack par1ItemStack) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
itemTag = par1ItemStack.getTagCompound();
|
||||
}
|
||||
return itemTag;
|
||||
}
|
||||
|
||||
static boolean toggle(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
setActive(par1ItemStack, !isActive(par1ItemStack));
|
||||
setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void passiveDrain(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int delay,
|
||||
int cost) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
if (par2World.getTotalWorldTime() % delay == itemTag.getInteger("worldTimeDelay")
|
||||
&& itemTag.getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, cost)) {
|
||||
setActive(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the drain tick delay based on the current world age and the given modulus
|
||||
*/
|
||||
static void setDrainTick(ItemStack par1ItemStack, World par2World, int modulus) {
|
||||
getTag(par1ItemStack).setInteger("worldTimeDelay", (int) (par2World.getTotalWorldTime() - 1) % modulus);
|
||||
}
|
||||
|
||||
// Global static methods
|
||||
static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
|
||||
return !SpellHelper.isFakePlayer(player) && SoulNetworkHandler.checkAndSetItemPlayer(item, player);
|
||||
}
|
||||
|
||||
static void setItemOwner(ItemStack item, String ownerName) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
item.getTagCompound().setString("ownerName", ownerName);
|
||||
}
|
||||
|
||||
static void checkAndSetItemOwner(ItemStack item, String ownerName) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
NBTTagCompound tag = IBindable.getTag(item);
|
||||
|
||||
if (item.getTagCompound().getString("ownerName").isEmpty()) {
|
||||
item.getTagCompound().setString("ownerName", ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
static String getOwnerName(ItemStack item) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return item.getTagCompound().getString("ownerName");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,33 @@
|
||||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface ISigil {
|
||||
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.
|
||||
*/
|
||||
static boolean toggleSigil(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int energyUsed,
|
||||
int tickDelay) {
|
||||
IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode
|
||||
&& !EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, energyUsed)) {
|
||||
IBindable.setActive(par1ItemStack, false);
|
||||
}
|
||||
|
||||
if (IBindable.isActive(par1ItemStack) && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, energyUsed)) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
IBindable.setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
return true;
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -79,7 +80,7 @@ public class BlockMasterStone extends BlockContainer {
|
||||
acItem.getCrystalLevel(playerItem),
|
||||
playerItem,
|
||||
player,
|
||||
acItem.getOwnerName(playerItem));
|
||||
IBindable.getOwnerName(playerItem));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
|
||||
public class CommandBind extends CommandBase {
|
||||
|
||||
@@ -38,8 +37,8 @@ public class CommandBind extends CommandBase {
|
||||
}
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable) {
|
||||
if (EnergyItems.getOwnerName(item).isEmpty()) {
|
||||
EnergyItems.checkAndSetItemOwner(item, targetPlayer);
|
||||
if (IBindable.getOwnerName(item).isEmpty()) {
|
||||
IBindable.checkAndSetItemOwner(item, targetPlayer);
|
||||
func_152373_a(iCommandSender, this, "commands.bind.success");
|
||||
} else {
|
||||
throw new CommandException("commands.bind.failed.alreadyBound");
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
|
||||
public class CommandUnbind extends CommandBase {
|
||||
|
||||
@@ -30,7 +29,7 @@ public class CommandUnbind extends CommandBase {
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable) {
|
||||
if (!EnergyItems.getOwnerName(item).isEmpty()) {
|
||||
if (!IBindable.getOwnerName(item).isEmpty()) {
|
||||
item.getTagCompound().removeTag("ownerName");
|
||||
func_152373_a(iCommandSender, this, "commands.unbind.success");
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.command.SubCommandBase;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
|
||||
public class SubCommandBind extends SubCommandBase {
|
||||
|
||||
@@ -56,10 +55,10 @@ public class SubCommandBind extends SubCommandBase {
|
||||
}
|
||||
|
||||
if (bind) {
|
||||
EnergyItems.setItemOwner(held, playerName);
|
||||
IBindable.setItemOwner(held, playerName);
|
||||
commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.success"));
|
||||
} else {
|
||||
if (!EnergyItems.getOwnerName(held).isEmpty()) {
|
||||
if (!IBindable.getOwnerName(held).isEmpty()) {
|
||||
held.stackTagCompound.removeTag("ownerName");
|
||||
commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.remove.success"));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -97,7 +98,7 @@ public class ActivationCrystal extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -24,8 +24,6 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon passiveIcon;
|
||||
|
||||
private int tickDelay = 200;
|
||||
|
||||
public ArmourInhibitor() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
@@ -50,13 +48,7 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -75,20 +67,15 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
IBindable.setDrainTick(par1ItemStack, par2World, tickDelay);
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
@@ -104,11 +91,7 @@ public class ArmourInhibitor extends EnergyItems {
|
||||
|
||||
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
if (par2World.getTotalWorldTime() % tickDelay
|
||||
== par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -52,7 +53,7 @@ public class BlankSpell extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -75,13 +76,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -90,29 +85,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
|
||||
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par2World.isRemote) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -172,45 +145,18 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
|
||||
this.setActivated(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 200, 20);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemTag.setBoolean("isActive", newActivated);
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack par1ItemStack) {
|
||||
if (!par1ItemStack.hasTagCompound()) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
|
||||
* sword
|
||||
*/
|
||||
@Override
|
||||
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) {
|
||||
if (!getActivated(par1ItemStack)) {
|
||||
if (!IBindable.isActive(par1ItemStack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -223,7 +169,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
*/
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
return getActivated(par1ItemStack);
|
||||
return IBindable.isActive(par1ItemStack);
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6,
|
||||
@@ -253,7 +199,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
*/
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if (!getActivated(stack)) {
|
||||
if (!IBindable.isActive(stack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -266,11 +212,11 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
return !getActivated(stack);
|
||||
return !IBindable.isActive(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -77,13 +78,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -92,32 +87,9 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
|
||||
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par2World.isRemote) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
|
||||
int posX = (int) (blockVec.xCoord);
|
||||
int posY = (int) (blockVec.yCoord);
|
||||
@@ -190,38 +162,11 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
|
||||
this.setActivated(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 200, 20);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemTag.setBoolean("isActive", newActivated);
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack par1ItemStack) {
|
||||
if (!par1ItemStack.hasTagCompound()) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
|
||||
* sword
|
||||
@@ -229,7 +174,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
@Override
|
||||
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) // getStrVsBlock
|
||||
{
|
||||
if (!getActivated(par1ItemStack)) {
|
||||
if (!IBindable.isActive(par1ItemStack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -240,9 +185,10 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
|
||||
* the damage on the stack.
|
||||
*/
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
return getActivated(par1ItemStack);
|
||||
return IBindable.isActive(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,7 +223,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
*/
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if (!getActivated(stack)) {
|
||||
if (!IBindable.isActive(stack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -290,11 +236,11 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
return !getActivated(stack);
|
||||
return !IBindable.isActive(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
|
||||
public float efficiencyOnProperMaterial = 12.0F;
|
||||
public float damageVsEntity;
|
||||
public int rightClickCost = 10000;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
@@ -77,13 +78,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -92,29 +87,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
|
||||
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par2World.isRemote) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (AlchemicalWizardry.disableBoundToolsRightClick) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
|
||||
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -173,45 +146,19 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
|
||||
this.setActivated(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 200, 20);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemTag.setBoolean("isActive", newActivated);
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack par1ItemStack) {
|
||||
if (!par1ItemStack.hasTagCompound()) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
|
||||
* sword
|
||||
*/
|
||||
@Override
|
||||
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) {
|
||||
if (!getActivated(par1ItemStack)) {
|
||||
if (!IBindable.isActive(par1ItemStack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -224,7 +171,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
*/
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
return getActivated(par1ItemStack);
|
||||
return IBindable.isActive(par1ItemStack);
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6,
|
||||
@@ -262,7 +209,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
*/
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if (!getActivated(stack)) {
|
||||
if (!IBindable.isActive(stack)) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@@ -275,11 +222,11 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
return !getActivated(stack);
|
||||
return !IBindable.isActive(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class CheatyItem extends Item implements IBindable {
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
World world = par3EntityPlayer.worldObj;
|
||||
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
|| par3EntityPlayer instanceof FakePlayer) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -70,7 +70,7 @@ public class EnergyBlast extends EnergyItems {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (isActive(stack)) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
switch (this.tier) {
|
||||
case 1:
|
||||
return this.activeIcon;
|
||||
@@ -87,7 +87,7 @@ public class EnergyBlast extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (getDelay(par1ItemStack) > 0 && isActive(par1ItemStack) && !par3EntityPlayer.isSneaking()) {
|
||||
if (getDelay(par1ItemStack) > 0 && IBindable.isActive(par1ItemStack) && !par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class EnergyBlast extends EnergyItems {
|
||||
this.setDelay(par1ItemStack, delay - 1);
|
||||
}
|
||||
|
||||
passiveDrain(par1ItemStack, par2World, par3EntityPlayer, getMaxDelayAfterActivation(), getActivationCost());
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, getMaxDelayAfterActivation(), getActivationCost());
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
@@ -175,10 +175,10 @@ public class EnergyBlast extends EnergyItems {
|
||||
}
|
||||
|
||||
public void setDelay(ItemStack par1ItemStack, int delay) {
|
||||
getTag(par1ItemStack).setInteger("delay", delay);
|
||||
IBindable.getTag(par1ItemStack).setInteger("delay", delay);
|
||||
}
|
||||
|
||||
public int getDelay(ItemStack par1ItemStack) {
|
||||
return getTag(par1ItemStack).getInteger("delay");
|
||||
return IBindable.getTag(par1ItemStack).getInteger("delay");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -181,37 +180,6 @@ public class EnergyItems extends Item implements IBindable {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Global static methods
|
||||
public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
|
||||
return !SpellHelper.isFakePlayer(player) && SoulNetworkHandler.checkAndSetItemPlayer(item, player);
|
||||
}
|
||||
|
||||
public static void setItemOwner(ItemStack item, String ownerName) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
item.getTagCompound().setString("ownerName", ownerName);
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, String ownerName) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (item.getTagCompound().getString("ownerName").equals("")) {
|
||||
item.getTagCompound().setString("ownerName", ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getOwnerName(ItemStack item) {
|
||||
if (item.getTagCompound() == null) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return item.getTagCompound().getString("ownerName");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void drainPlayerNetwork(EntityPlayer player, int damageToBeDone) {
|
||||
String ownerName = SpellHelper.getUsername(player);
|
||||
|
||||
@@ -34,6 +34,8 @@ 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);
|
||||
@@ -62,13 +64,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -81,7 +77,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
boolean isActive = getActivated(stack);
|
||||
boolean isActive = IBindable.isActive(stack);
|
||||
if (isActive && !player.worldObj.isRemote) {
|
||||
OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player);
|
||||
|
||||
@@ -98,7 +94,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
if (par3EntityLivingBase instanceof EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems
|
||||
.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed())) {
|
||||
return false;
|
||||
}
|
||||
@@ -111,15 +107,8 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
|
||||
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (!getActivated(par1ItemStack)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
IBindable.toggle(par1ItemStack, par2World, par3EntityPlayer);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -141,38 +130,11 @@ public class EnergySword extends ItemSword implements IBindable {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 100 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50)) {
|
||||
this.setActivated(par1ItemStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 100, 50);
|
||||
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemTag.setBoolean("isActive", newActivated);
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack par1ItemStack) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
public float func_82803_g() {
|
||||
return 4.0F;
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -52,7 +53,7 @@ public class ItemComplexSpellCrystal extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ItemDiabloKey extends EnergyItems {
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
World world = par3EntityPlayer.worldObj;
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
|| par3EntityPlayer instanceof FakePlayer) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class ItemDiabloKey extends EnergyItems {
|
||||
}
|
||||
|
||||
if (item instanceof IBindable) {
|
||||
EnergyItems.checkAndSetItemOwner(itemStack, ownerName);
|
||||
IBindable.checkAndSetItemOwner(itemStack, ownerName);
|
||||
}
|
||||
}
|
||||
par3EntityPlayer.inventoryContainer.detectAndSendChanges();
|
||||
@@ -114,7 +114,7 @@ public class ItemDiabloKey extends EnergyItems {
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
|
||||
list.add(new ItemStack(ModItems.itemKeyOfDiablo));
|
||||
ItemStack boundKey = new ItemStack(ModItems.itemKeyOfDiablo);
|
||||
EnergyItems.checkAndSetItemOwner(boundKey, "Server-wide Soul Network");
|
||||
IBindable.checkAndSetItemOwner(boundKey, "Server-wide Soul Network");
|
||||
list.add(boundKey);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -42,7 +43,7 @@ public class ItemRitualDismantler extends EnergyItems {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7,
|
||||
float par8, float par9, float par10) {
|
||||
return EnergyItems.checkAndSetItemOwner(stack, player)
|
||||
return IBindable.checkAndSetItemOwner(stack, player)
|
||||
&& breakRitualStoneAtMasterStone(stack, player, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -189,7 +190,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7,
|
||||
float par8, float par9, float par10) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(stack, player)) return false;
|
||||
if (!IBindable.checkAndSetItemOwner(stack, player)) return false;
|
||||
|
||||
if (placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) {
|
||||
this.setStoredLocation(stack, new Int3(x, y, z));
|
||||
@@ -367,7 +368,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) {
|
||||
rotateRituals(par2World, par3EntityPlayer, stack, true);
|
||||
}
|
||||
|
||||
@@ -379,7 +380,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
|
||||
if (!EnergyItems.checkAndSetItemOwner(stack, player)) return true;
|
||||
if (!IBindable.checkAndSetItemOwner(stack, player)) return true;
|
||||
|
||||
if (!player.isSwingInProgress) {
|
||||
if (player.isSneaking()) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -52,7 +53,7 @@ public class LavaCrystal extends EnergyItems {
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -25,17 +26,12 @@ public class ScribeTool extends EnergyItems {
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.scribetool.desc"));
|
||||
|
||||
if (!(par1ItemStack.getTagCompound() == null)) {
|
||||
par3List.add(
|
||||
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
|
||||
+ par1ItemStack.getTagCompound().getString("ownerName"));
|
||||
}
|
||||
addBindingInformation(par1ItemStack, par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (par1ItemStack.getItemDamage() > 0) {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -53,7 +54,7 @@ public class TelepositionFocus extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class BoundArmour extends ItemArmor
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EnergyItems.checkAndSetItemOwner(stack, (EntityPlayer) entity);
|
||||
IBindable.checkAndSetItemOwner(stack, (EntityPlayer) entity);
|
||||
|
||||
if (((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||
return;
|
||||
@@ -327,7 +327,7 @@ public class BoundArmour extends ItemArmor
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ public class BoundArmour extends ItemArmor
|
||||
|
||||
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (itemStack.getItemDamage() > 0) {
|
||||
EnergyItems.checkAndSetItemOwner(itemStack, player);
|
||||
IBindable.checkAndSetItemOwner(itemStack, player);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -41,7 +42,7 @@ public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -45,7 +46,7 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
|
||||
int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)
|
||||
|| !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) {
|
||||
return true;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -51,13 +52,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -76,29 +71,11 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
tag.setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -115,7 +92,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
int range = 3;
|
||||
int verticalRange = 1;
|
||||
int posX = (int) Math.round(par3Entity.posX - 0.5f);
|
||||
@@ -130,14 +107,8 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
}
|
||||
}
|
||||
}
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -75,7 +76,7 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil {
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+6
-30
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -51,13 +52,7 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -76,25 +71,13 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
@@ -112,19 +95,12 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par3EntityPlayer.fallDistance = 0;
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
}
|
||||
+6
-37
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -52,13 +53,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -77,29 +72,11 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
tag.setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -116,7 +93,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
List<Entity> list = SpellHelper
|
||||
.getEntitiesInRange(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5);
|
||||
for (Entity entity : list) {
|
||||
@@ -126,15 +103,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
|
||||
}
|
||||
}
|
||||
}
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -58,13 +59,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -84,7 +79,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
|
||||
int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
|
||||
if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) {
|
||||
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
|
||||
|
||||
@@ -101,7 +96,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -109,20 +104,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -137,12 +119,9 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, (EntityPlayer) par3Entity, tickDelay, getEnergyUsed());
|
||||
int range = 3;
|
||||
int verticalRange = 2;
|
||||
int posX = (int) Math.round(par3Entity.posX - 0.5f);
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -50,13 +51,7 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -75,24 +70,12 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
@@ -110,18 +93,11 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-28
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -55,13 +56,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -80,24 +75,11 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -114,12 +96,9 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
|
||||
int range = 5;
|
||||
int verticalRange = 5;
|
||||
|
||||
+8
-41
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -57,16 +58,10 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
return activeIcon;
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return passiveIcon;
|
||||
return this.passiveIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +77,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
int tickDelay = 200;
|
||||
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|
||||
|| SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -93,25 +86,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
tag.setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -132,7 +107,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive") && (!par2World.isRemote)) {
|
||||
if (IBindable.isActive(par1ItemStack) && (!par2World.isRemote)) {
|
||||
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
|
||||
int x = (int) blockVec.xCoord;
|
||||
int y = (int) blockVec.yCoord;
|
||||
@@ -162,15 +137,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -69,7 +70,7 @@ public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, IS
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
+6
-33
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -30,8 +31,6 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon passiveIcon;
|
||||
|
||||
private int tickDelay = 200;
|
||||
|
||||
public SigilOfTheBridge() {
|
||||
super();
|
||||
this.maxStackSize = 1;
|
||||
@@ -56,13 +55,7 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -81,24 +74,11 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -115,15 +95,8 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {
|
||||
if (EnergyItems
|
||||
.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, this.getLPUsed(par1ItemStack))) {
|
||||
this.setLPUsed(par1ItemStack, 0);
|
||||
} else {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-30
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -51,13 +52,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -76,24 +71,12 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
@@ -111,18 +94,11 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -50,13 +51,7 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -75,24 +70,12 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")
|
||||
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
if (ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
@@ -110,18 +93,11 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
|
||||
}
|
||||
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, 200, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -52,13 +53,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (stack.getTagCompound() == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
if (IBindable.isActive(stack)) {
|
||||
return this.activeIcon;
|
||||
} else {
|
||||
return this.passiveIcon;
|
||||
@@ -77,29 +72,11 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound() == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.getTagCompound();
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive")) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
tag.setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
ISigil.toggleSigil(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), tickDelay);
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
@@ -116,7 +93,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
ItemStack stack = CompressionRegistry
|
||||
.compressInventory(par3EntityPlayer.inventory.mainInventory, par2World);
|
||||
if (stack != null) {
|
||||
@@ -129,14 +106,8 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
|
||||
par2World.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
|
||||
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
|
||||
par1ItemStack.getTagCompound().setBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IBindable.passiveDrain(par1ItemStack, par2World, par3EntityPlayer, tickDelay, getEnergyUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -14,7 +15,6 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
@@ -69,7 +70,7 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil {
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -73,7 +74,7 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil {
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class InventoryHolding implements IInventory {
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof ISigil;
|
||||
return itemStack.getItem() instanceof ISigil && !(itemStack.getItem() instanceof SigilOfHolding);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
|
||||
+6
-4
@@ -2,6 +2,8 @@ package WayofTime.alchemicalWizardry.common.items.sigil.holding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -18,7 +20,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SigilOfHolding extends EnergyItems {
|
||||
public class SigilOfHolding extends EnergyItems implements ISigil {
|
||||
|
||||
private static int invSize = 5;
|
||||
|
||||
@@ -90,7 +92,7 @@ public class SigilOfHolding extends EnergyItems {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
|
||||
int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
|
||||
int currentSlot = getCurrentItem(par1ItemStack);
|
||||
ItemStack[] inv = getInternalInventory(par1ItemStack);
|
||||
|
||||
@@ -117,7 +119,7 @@ public class SigilOfHolding extends EnergyItems {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
|
||||
if (par3EntityPlayer.isSneaking()) {
|
||||
InventoryHolding.setUUID(par1ItemStack);
|
||||
par3EntityPlayer.openGui(
|
||||
@@ -152,7 +154,7 @@ public class SigilOfHolding extends EnergyItems {
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
if (checkAndSetItemOwner(stack, player)) {
|
||||
if (IBindable.checkAndSetItemOwner(stack, player)) {
|
||||
int currentSlot = getCurrentItem(stack);
|
||||
ItemStack[] inv = getInternalInventory(stack);
|
||||
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
|
||||
|
||||
@@ -74,7 +73,7 @@ public class RitualEffectExpulsion extends RitualEffect {
|
||||
for (int i = 0; i < inventoryTile.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventoryTile.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IBindable
|
||||
&& EnergyItems.getOwnerName(stack).equals(playerString)) {
|
||||
&& IBindable.getOwnerName(stack).equals(playerString)) {
|
||||
test = true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
@@ -65,13 +64,13 @@ public class RitualEffectUnbinding extends RitualEffect {
|
||||
boolean hasSanctus = this
|
||||
.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
if (hasSanctus) {
|
||||
if (itemStack.getItem() instanceof IBindable && !EnergyItems.getOwnerName(itemStack).equals("")) {
|
||||
if (itemStack.getItem() instanceof IBindable && !IBindable.getOwnerName(itemStack).equals("")) {
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z - 5));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z + 5));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x - 5, y + 1, z));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + 5, y + 1, z));
|
||||
|
||||
EnergyItems.setItemOwner(itemStack, "");
|
||||
IBindable.setItemOwner(itemStack, "");
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
|
||||
drain = true;
|
||||
ritualStone.setActive(false);
|
||||
|
||||
+5
-4
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.simple;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -24,7 +25,7 @@ public class SpellEarthBender extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ public class SpellEarthBender extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ public class SpellEarthBender extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -143,7 +144,7 @@ public class SpellEarthBender extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.simple;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -21,7 +22,7 @@ public class SpellExplosions extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ public class SpellExplosions extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ public class SpellExplosions extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ public class SpellExplosions extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -27,7 +28,7 @@ public class SpellFireBurst extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@ public class SpellFireBurst extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ public class SpellFireBurst extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ public class SpellFireBurst extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.simple;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -23,7 +24,7 @@ public class SpellFrozenWater extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ public class SpellFrozenWater extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -184,7 +185,7 @@ public class SpellFrozenWater extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -27,7 +28,7 @@ public class SpellHolyBlast extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ public class SpellHolyBlast extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ public class SpellHolyBlast extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ public class SpellHolyBlast extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.simple;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -23,7 +24,7 @@ public class SpellLightningBolt extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ public class SpellLightningBolt extends HomSpell {
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
// TODO Make it work better...?
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ public class SpellLightningBolt extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ public class SpellLightningBolt extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,7 +32,7 @@ public class SpellTeleport extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ public class SpellTeleport extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ public class SpellTeleport extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ public class SpellTeleport extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -30,7 +31,7 @@ public class SpellWateryGrave extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ public class SpellWateryGrave extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ public class SpellWateryGrave extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ public class SpellWateryGrave extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -27,7 +28,7 @@ public class SpellWindGust extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ public class SpellWindGust extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -107,7 +108,7 @@ public class SpellWindGust extends HomSpell {
|
||||
|
||||
@Override
|
||||
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ public class SpellWindGust extends HomSpell {
|
||||
@Override
|
||||
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user