This commit is contained in:
WayofTime 2014-04-02 19:07:11 -04:00
parent a1ca81423b
commit d229da6272
75 changed files with 1868 additions and 1866 deletions

View file

@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;

View file

@ -20,8 +20,8 @@ import thaumcraft.api.IGoggles;
import thaumcraft.api.nodes.IRevealer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.relauncher.Side;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import com.google.common.collect.Multimap;

View file

@ -1,8 +1,8 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.common.network.PacketDispatcher;

View file

@ -1,6 +1,10 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.*;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
@ -20,7 +24,7 @@ import net.minecraftforge.common.FakePlayer;
import java.util.List;
public class EnergyBattery extends Item implements ArmourUpgrade, IBindable
public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBloodOrb
{
private int maxEssence;
protected int orbLevel;
@ -194,14 +198,6 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable
@Override
public ItemStack getContainerItemStack(ItemStack itemStack)
{
//if(!syphonBatteries(itemStack, null, 10))
{
//syphonWhileInContainer(itemStack, this.getEnergyUsed());
// ItemStack copiedStack = itemStack.copy();
// copiedStack.setItemDamage(copiedStack.getItemDamage());
// copiedStack.stackSize = 1;
// return copiedStack;
}
return itemStack;
}

View file

@ -1,11 +1,5 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -13,6 +7,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.common.network.PacketDispatcher;
public class EnergyItems extends Item implements IBindable
{
@ -21,7 +21,6 @@ public class EnergyItems extends Item implements IBindable
public EnergyItems(int id)
{
super(id);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
protected void setEnergyUsed(int par1int)
@ -33,40 +32,6 @@ public class EnergyItems extends Item implements IBindable
{
return this.energyUsed;
}
//Heals the player using the item. If the player is at full health, or if the durability cannot be used any more,
//the item is not used.
protected void damagePlayer(World world, EntityPlayer player, int damage)
{
if (world != null)
{
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F;
for (int l = 0; l < 8; ++l)
{
world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
}
}
for (int i = 0; i < damage; i++)
{
//player.setEntityHealth((player.getHealth()-1));
player.setHealth((player.getHealth() - 1));
if (player.getHealth() <= 0.0005)
{
player.inventory.dropAllItems();
break;
}
}
}
public static boolean syphonBatteriesWithoutParticles(ItemStack ist, EntityPlayer player, int damageToBeDone, boolean particles)
{
@ -107,6 +72,9 @@ public class EnergyItems extends Item implements IBindable
}
}
/**
* Master method to syphon from the Soul Network.
*/
public static boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if (!player.worldObj.isRemote)
@ -135,161 +103,29 @@ public class EnergyItems extends Item implements IBindable
public static boolean syphonWhileInContainer(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = ist.getTagCompound().getString("ownerName");
if (MinecraftServer.getServer() == null)
{
return false;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
if (data.currentEssence >= damageToBeDone)
{
data.currentEssence -= damageToBeDone;
data.markDirty();
return true;
}
// EntityPlayer ownerEntity = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(ist.getTagCompound().getString("ownerName"));
// if(ownerEntity==null){return false;}
// NBTTagCompound tag = ownerEntity.getEntityData();
// int currentEssence = tag.getInteger("currentEssence");
// if(currentEssence>=damageToBeDone)
// {
// tag.setInteger("currentEssence", currentEssence-damageToBeDone);
// return true;
// }
}
return false;
}
public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = ist.getTagCompound().getString("ownerName");
if (MinecraftServer.getServer() == null)
{
return false;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
return data.currentEssence >= damageToBeDone;
// EntityPlayer ownerEntity = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(ist.getTagCompound().getString("ownerName"));
// if(ownerEntity==null){return false;}
// NBTTagCompound tag = ownerEntity.getEntityData();
// int currentEssence = tag.getInteger("currentEssence");
// if(currentEssence>=damageToBeDone)
// {
// tag.setInteger("currentEssence", currentEssence-damageToBeDone);
// return true;
// }
}
return false;
}
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
{
if (energySyphoned < 100 && energySyphoned > 0)
{
if (!user.capabilities.isCreativeMode)
{
//player.setEntityHealth((player.getHealth()-1));
user.setHealth((user.getHealth() - 1));
if (user.getHealth() <= 0.0005f)
{
user.onDeath(DamageSource.generic);
}
}
} else if (energySyphoned >= 100)
{
if (!user.capabilities.isCreativeMode)
{
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
{
//player.setEntityHealth((player.getHealth()-1));
user.setHealth((user.getHealth() - 1));
if (user.getHealth() <= 0.0005f)
{
user.onDeath(DamageSource.generic);
break;
}
}
}
}
}
public static boolean syphonAndDamageWhileInContainer(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if (!syphonWhileInContainer(ist, damageToBeDone))
{
hurtPlayer(player, damageToBeDone);
}
SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
return true;
}
//Global static methods
public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone)
{
return SoulNetworkHandler.canSyphonFromOnlyNetwork(ist, damageToBeDone);
}
public static boolean syphonAndDamageWhileInContainer(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
return SoulNetworkHandler.syphonAndDamageFromNetwork(ist, player, damageToBeDone);
}
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
{
item.stackTagCompound.setString("ownerName", player.getEntityName());
}
initializePlayer(player);
SoulNetworkHandler.checkAndSetItemOwner(item, player);
}
public static void checkAndSetItemOwner(ItemStack item, String ownerName)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
{
item.stackTagCompound.setString("ownerName", ownerName);
}
}
public static void initializePlayer(EntityPlayer player)
{
NBTTagCompound tag = player.getEntityData();
if (tag.getInteger("currentEssence") == 0)
{
tag.setInteger("currentEssence", 0);
}
SoulNetworkHandler.checkAndSetItemOwner(item, ownerName);
}
public String getOwnerName(ItemStack item)

View file

@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.common.network.PacketDispatcher;

View file

@ -3,8 +3,8 @@ package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.common.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.relauncher.Side;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.forestry;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;

View file

@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;

View file

@ -16,7 +16,7 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.nodes.IRevealer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;