Joshie comment!

This commit is contained in:
WayofTime 2014-06-02 15:16:36 -04:00
parent 1c0deadfc6
commit ac943e9d38
753 changed files with 8715 additions and 1184 deletions

View file

@ -0,0 +1,44 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
public class AWBaseItems extends Item
{
public AWBaseItems()
{
super();
setMaxStackSize(64);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
public void registerIcons(IIconRegister iconRegister)
{
if (this.equals(ModItems.blankSlate))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankSlate");
} else if (this.equals(ModItems.reinforcedSlate))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ReinforcedSlate");
} else if (this.equals(ModItems.imbuedSlate))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:InfusedSlate");
} else if (this.equals(ModItems.demonicSlate))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonSlate");
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Infused stone inside of");
par3List.add("a blood altar");
}
}

View file

@ -0,0 +1,135 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import javax.swing.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ActivationCrystal extends EnergyItems
{
private static final String[] ACTIVATION_CRYSTAL_NAMES = new String[]{"Weak", "Awakened"};
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public ActivationCrystal()
{
super();
this.maxStackSize = 1;
setEnergyUsed(100);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
icons = new IIcon[ACTIVATION_CRYSTAL_NAMES.length];
for (int i = 0; i < ACTIVATION_CRYSTAL_NAMES.length; ++i)
{
icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "activationCrystal" + ACTIVATION_CRYSTAL_NAMES[i]);
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
switch (par1ItemStack.getItemDamage())
{
case 0:
{
par3List.add("Activates low-level rituals");
break;
}
case 1:
{
par3List.add("Activates more powerful rituals");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
break;
}
}
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
return par1ItemStack;
}
public int getCrystalLevel(ItemStack itemStack)
{
return itemStack.getItemDamage() + 1;
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
//This is what will do all the localisation things on the alchemy components so you dont have to set it :D
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ACTIVATION_CRYSTAL_NAMES.length - 1);
return ("" + "item.activationCrystal" + ACTIVATION_CRYSTAL_NAMES[meta]);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)
{
int j = MathHelper.clamp_int(meta, 0, ACTIVATION_CRYSTAL_NAMES.length - 1);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < ACTIVATION_CRYSTAL_NAMES.length; ++meta)
{
list.add(new ItemStack(id, 1, meta));
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AirScribeTool extends ScribeTool
{
public AirScribeTool()
{
super(4);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AirScribeTool");
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ApprenticeBloodOrb extends EnergyBattery
{
public ApprenticeBloodOrb(int damage)
{
super(damage);
orbLevel = 2;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ApprenticeBloodOrb");
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ArchmageBloodOrb extends EnergyBattery
{
public ArchmageBloodOrb(int damage)
{
super(damage);
orbLevel = 5;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ArchmageBloodOrb");
}
}

View file

@ -0,0 +1,215 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import javax.swing.Icon;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ArmourInhibitor extends EnergyItems
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int tickDelay = 200;
public ArmourInhibitor()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(0);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used to suppress a soul's");
par3List.add("unnatural abilities.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
// @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(applyBonemeal(par1ItemStack,par3World,par4,par5,par6,par2EntityPlayer))
// {
// if (par3World.isRemote)
// {
// par3World.playAuxSFX(2005, par4, par5, par6, 0);
// EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
// return true;
// }
// return true;
// }
// return false;
// }
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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)
{
//EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (par2World.getWorldTime() % tickDelay == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par3Entity instanceof EntityPlayer)
{
//EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer)par3Entity, getEnergyUsed());
}
//TODO Do stuff
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 2, 0));
}
return;
}
// @Override
// public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {
//
// int range = 5;
// int verticalRange = 2;
// int posX = (int)Math.round(player.posX-0.5f);
// int posY = (int)player.posY;
// int posZ = (int)Math.round(player.posZ-0.5f);
//
// for(int ix=posX-range;ix<=posX+range;ix++)
// {
// for(int iz=posZ-range;iz<=posZ+range;iz++)
// {
// for(int iy=posY-verticalRange;iy<=posY+verticalRange;iy++)
// {
// int id = world.getBlockId(ix, iy, iz);
// Block block = Block.blocksList[id];
// if(block instanceof IPlantable)
// {
// if(world.rand.nextInt(10)==0)
// block.updateTick(world, ix, iy, iz, world.rand);
// }
// }
// }
// }
//
// }
// @Override
// public boolean isUpgrade() {
// // TODO Auto-generated method stub
// return true;
// }
//
// @Override
// public int getEnergyForTenSeconds() {
// // TODO Auto-generated method stub
// return 50;
// }
}

View file

@ -0,0 +1,114 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlankSpell extends EnergyItems
{
public BlankSpell()
{
super();
this.setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankSpell");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Crystal of infinite possibilities.");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par2World.isRemote)
{
//World world = MinecraftServer.getServer().worldServers[getDimensionID(par1ItemStack)];
World world = DimensionManager.getWorld(getDimensionID(par1ItemStack));
if (world != null)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
TileEntity tileEntity = world.getTileEntity(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord"));
if (tileEntity instanceof TEHomHeart)
{
TEHomHeart homHeart = (TEHomHeart) tileEntity;
if (homHeart.canCastSpell(par1ItemStack, par2World, par3EntityPlayer))
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, homHeart.castSpell(par1ItemStack, par2World, par3EntityPlayer));
} else
{
return par1ItemStack;
}
} else
{
return par1ItemStack;
}
} else
{
return par1ItemStack;
}
} else
{
return par1ItemStack;
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
// if (!par2World.isRemote)
// {
// //par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
// par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 10));
// }
return par1ItemStack;
}
public int getDimensionID(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemStack.stackTagCompound.getInteger("dimensionId");
}
}

View file

@ -0,0 +1,73 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BloodShard extends Item implements ArmourUpgrade
{
public BloodShard()
{
super();
this.maxStackSize = 64;
//setEnergyUsed(100);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
if (this.equals(ModItems.weakBloodShard))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakBloodShard");
return;
}
if (this.equals(ModItems.demonBloodShard))
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonBloodShard");
return;
}
}
public int getBloodShardLevel()
{
if (this.equals(ModItems.weakBloodShard))
{
return 1;
} else if (this.equals(ModItems.demonBloodShard))
{
return 2;
}
return 0;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
// TODO Auto-generated method stub
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return false;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,103 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BloodboundSword extends EnergyItems
{
private float weaponDamage;
//private int maxMode = 3;
private NBTTagCompound data;
public BloodboundSword(int id)
{
super();
this.maxStackSize = 1;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setEnergyUsed(100);
setFull3D();
weaponDamage = 10.0F;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergySword");
}
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase);
if (!this.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed()))
{
//this.damagePlayer(null, (EntityPlayer)par3EntityLivingBase, (this.getEnergyUsed() + 99) / 100);
}
}
return true;
}
/*
public int getDamageVsEntity(Entity par1Entity)
{
return this.weaponDamage;
}
*/
public float func_82803_g()
{
return 4.0F;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution: may cause");
par3List.add("a bad day...");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public float getDigSpeed(ItemStack par1ItemStack, Block par2Block, int meta)
{
if (par2Block.equals(Blocks.web))
{
return 15.0F;
} else
{
Material material = par2Block.getMaterial();
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F;
}
}
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return false;
}
// public Multimap func_111205_h()
// {
// Multimap multimap = super.func_111205_h();
// multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
// return multimap;
// }
}

View file

@ -0,0 +1,594 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.util.Constants;
import thaumcraft.api.IGoggles;
import thaumcraft.api.nodes.IRevealer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
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;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.InterfaceList(value = {@Interface(iface="thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IGoggles", modid = "Thaumcraft")})
public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,IRevealer, IGoggles
{
private static int invSize = 9;
private static IIcon helmetIcon;
private static IIcon plateIcon;
private static IIcon leggingsIcon;
private static IIcon bootsIcon;
public BoundArmour(int armorType)
{
super(ItemArmor.ArmorMaterial.GOLD, 0, armorType);
setMaxDamage(1000);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundHelmet");
this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPlate");
this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundLeggings");
this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundBoots");
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (this.equals(ModItems.boundHelmet))
{
return this.helmetIcon;
}
if (this.equals(ModItems.boundPlate))
{
return this.plateIcon;
}
if (this.equals(ModItems.boundLeggings))
{
return this.leggingsIcon;
}
if (this.equals(ModItems.boundBoots))
{
return this.bootsIcon;
}
return this.itemIcon;
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return false;
}
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
{
if (source.equals(DamageSource.drown))
{
return new ArmorProperties(-1, 0, 0);
}
if (source.equals(DamageSource.outOfWorld))
{
if (isImmuneToVoid(armor))
{
return new ArmorProperties(-1, 3, 100000);
} else
{
return new ArmorProperties(-1, 0, 0);
}
}
ItemStack helmet = player.getEquipmentInSlot(4);
ItemStack plate = player.getEquipmentInSlot(3);
ItemStack leggings = player.getEquipmentInSlot(2);
ItemStack boots = player.getEquipmentInSlot(1);
if (helmet == null || plate == null || leggings == null || boots == null)
{
return new ArmorProperties(-1, 0, 0);
}
if (helmet.getItem().equals(ModItems.boundHelmet) || plate.getItem().equals(ModItems.boundPlate) || leggings.getItem().equals(ModItems.boundLeggings) || boots.getItem().equals(ModItems.boundBoots))
{
if (source.isUnblockable())
{
return new ArmorProperties(-1, 3, 4);
}
return new ArmorProperties(-1, 3, 100000);
}
return new ArmorProperties(-1, 0, 0);
}
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot)
{
if (armor.equals(ModItems.boundHelmet))
{
return 3;
}
if (armor.equals(ModItems.boundPlate))
{
return 8;
}
if (armor.equals(ModItems.boundLeggings))
{
return 6;
}
if (armor.equals(ModItems.boundBoots))
{
return 3;
}
return 5;
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
{
if (entity instanceof EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(stack, (EntityPlayer) entity);
if (((EntityPlayer) entity).capabilities.isCreativeMode)
{
return;
}
//EnergyItems.syphonBatteries(stack, (EntityPlayer)entity, 200);
}
stack.setItemDamage(stack.getItemDamage() + damage);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Devilish Protection");
if (!(par1ItemStack.stackTagCompound == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
{
return;
}
for (int i = 0; i < invSize; i++)
{
if (inv[i] != null)
{
par3List.add("Item in slot " + i + ": " + inv[i].getDisplayName());
}
}
}
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
//TODO Make the armour invisible when the player has Invisibility on.
if (entity instanceof EntityLivingBase)
{
if (((EntityLivingBase) entity).isPotionActive(Potion.invisibility.id))
{
if (this== ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots)
{
return "alchemicalwizardry:models/armor/boundArmour_invisible_layer_1.png";
}
if (this == ModItems.boundLeggings)
{
return "alchemicalwizardry:models/armor/boundArmour_invisible_layer_2.png";
}
}
}
if (this == ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots)
{
return "alchemicalwizardry:models/armor/boundArmour_layer_1.png";
}
if (this == ModItems.boundLeggings)
{
return "alchemicalwizardry:models/armor/boundArmour_layer_2.png";
} else
{
return null;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
int maxBloodLevel = getMaxBloodShardLevel(itemStack);
ItemStack[] inv = getInternalInventory(itemStack);
if (inv != null)
{
int iSize = 0;
int iBlood = 0;
}
if (!player.isPotionActive(AlchemicalWizardry.customPotionInhibit))
{
tickInternalInventory(itemStack, world, player, 0, false);
}
if (itemStack.getItemDamage() > 0)
{
EnergyItems.checkAndSetItemOwner(itemStack, player);
if (!player.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75);
itemStack.setItemDamage(0);
}
}
return;
}
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, EntityPlayer par3Entity, int par4, boolean par5)
{
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
{
return;
}
int blood = getMaxBloodShardLevel(par1ItemStack);
//int blood = 1;
for (int i = 0; i < invSize; i++)
{
if (inv[i] == null)
{
continue;
}
if (inv[i].getItem() instanceof ArmourUpgrade && blood > 0)
{
if (((ArmourUpgrade) inv[i].getItem()).isUpgrade())
{
((ArmourUpgrade) inv[i].getItem()).onArmourUpdate(par2World, par3Entity, inv[i]);
blood--;
}
if (par2World.getWorldTime() % 200 == 0)
{
if (getUpgradeCostMultiplier(par1ItemStack) > 0.02f)
{
EnergyItems.syphonBatteries(par1ItemStack, par3Entity, (int) (((ArmourUpgrade) inv[i].getItem()).getEnergyForTenSeconds() * getUpgradeCostMultiplier(par1ItemStack)));
}
}
}
}
}
public int getMaxBloodShardLevel(ItemStack armourStack)
{
ItemStack[] inv = getInternalInventory(armourStack);
if (inv == null)
{
return 0;
}
int max = 0;
for (int i = 0; i < invSize; i++)
{
ItemStack itemStack = inv[i];
if (itemStack != null)
{
if (itemStack.getItem().equals(ModItems.weakBloodShard))
{
max = Math.max(max, 1);
}
if (itemStack.getItem().equals(ModItems.demonBloodShard))
{
max = Math.max(max, 2);
}
}
}
return max;
}
public boolean hasAddedToInventory(ItemStack sigilItemStack, ItemStack addedItemStack)
{
ItemStack[] inv = getInternalInventory(sigilItemStack);
if (inv == null)
{
return false;
}
if (addedItemStack == null)
{
return false;
}
Item item = addedItemStack.getItem();
int candidateSlot = -1;
for (int i = invSize - 1; i >= 0; i--)
{
ItemStack nextItem = inv[i];
if (nextItem == null)
{
candidateSlot = i;
continue;
}
}
if (candidateSlot == -1)
{
return false;
}
if (addedItemStack.getItem() instanceof ArmourUpgrade)
{
inv[candidateSlot] = addedItemStack;
saveInternalInventory(sigilItemStack, inv);
return true;
}
return false;
}
public ItemStack[] getInternalInventory(ItemStack itemStack)
{
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
ItemStack[] inv = new ItemStack[9];
NBTTagList tagList = itemTag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
if (tagList == null)
{
return null;
}
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
int slot = tag.getByte("Slot");
if (slot >= 0 && slot < invSize)
{
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
}
}
return inv;
}
public void saveInternalInventory(ItemStack itemStack, ItemStack[] inventory)
{
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < invSize; i++)
{
ItemStack stack = inventory[i];
if (inventory[i] != null)
{
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("Slot", (byte) i);
inventory[i].writeToNBT(tag);
itemList.appendTag(tag);
}
}
itemTag.setTag("Inventory", itemList);
}
public boolean isImmuneToVoid(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
if (inv == null)
{
return false;
}
for (ItemStack item : inv)
{
if (item == null)
{
continue;
}
if (item.getItem().equals(ModItems.voidSigil))
{
return true;
}
}
return false;
}
@Optional.Method(modid = "Thaumcraft")
public boolean hasIRevealer(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
if (inv == null)
{
return false;
}
for (ItemStack item : inv)
{
if (item == null)
{
continue;
}
if (item.getItem() instanceof IRevealer)
{
return true;
}
}
return false;
}
@Optional.Method(modid = "Thaumcraft")
public boolean hasIGoggles(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
if (inv == null)
{
return false;
}
for (ItemStack item : inv)
{
if (item == null)
{
continue;
}
if (item.getItem() instanceof IGoggles)
{
return true;
}
}
return false;
}
public float getUpgradeCostMultiplier(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
if (inv == null)
{
return 1.0f;
}
for (ItemStack item : inv)
{
if (item == null)
{
continue;
}
if (item.getItem().equals(ModItems.weakBloodOrb))
{
return 0.75f;
}
if (item.getItem().equals(ModItems.apprenticeBloodOrb))
{
return 0.50f;
}
if (item.getItem().equals(ModItems.magicianBloodOrb))
{
return 0.25f;
}
if (item.getItem().equals(ModItems.masterBloodOrb))
{
return 0.0f;
}
if (item.getItem().equals(ModItems.archmageBloodOrb))
{
return 0.0f;
}
}
return 1.0f;
}
public int getItemEnchantability()
{
return 0;
}
@Override
@Optional.Method(modid = "Thaumcraft")
public boolean showNodes(ItemStack itemstack, EntityLivingBase player)
{
return this.hasIRevealer(itemstack);
}
@Override
@Optional.Method(modid = "Thaumcraft")
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player)
{
return this.hasIGoggles(itemstack);
}
}

View file

@ -0,0 +1,384 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundAxe extends ItemAxe implements IBindable
{
/**
* Array of blocks the tool has extra effect against.
*/
public static final Block[] blocksEffectiveAgainst = new Block[]{Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.chest, Blocks.stone_slab, Blocks.pumpkin, Blocks.lit_pumpkin};
public float efficiencyOnProperMaterial = 12.0F;
/**
* Damage versus entities.
*/
public float damageVsEntity;
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int energyUsed;
public BoundAxe()
{
super(AlchemicalWizardry.bloodBoundToolMaterial);
this.maxStackSize = 1;
//this.setMaxDamage(par3EnumToolMaterial.getMaxUses());
this.efficiencyOnProperMaterial = 12.0F;
this.damageVsEntity = 5;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setEnergyUsed(5);
}
public void setEnergyUsed(int i)
{
energyUsed = i;
}
public int getEnergyUsed()
{
return this.energyUsed;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Axe me about my puns!");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundAxe_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundAxe_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit))
{
return par1ItemStack;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int posX = (int)(blockVec.xCoord);
int posY = (int)(blockVec.yCoord);
int posZ = (int)(blockVec.zCoord);
boolean silkTouch = false;
int so = Enchantment.silkTouch.effectId;
int fortune = Enchantment.fortune.effectId;
int fortuneLvl = 0;
NBTTagList enchants = par1ItemStack.getEnchantmentTagList();
if (enchants != null)
{
for (int i = 0; i < enchants.tagCount(); i++)
{
if (enchants.getCompoundTagAt(i) instanceof NBTTagCompound)
{
NBTTagCompound nbt = (NBTTagCompound) enchants.getCompoundTagAt(i);
int id = nbt.getShort("id");
if (id == so)
{
silkTouch = true;
}
if (id == fortune)
{
fortuneLvl = nbt.getShort("lvl");
}
}
}
}
for (int i = -5; i <= 5; i++)
{
for (int j = 0; j <= 10; j++)
{
for (int k = -5; k <= 5; k++)
{
Block block = par2World.getBlock(posX + i, posY + j, posZ + k);
int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k);
if (block != null)
{
float str = func_150893_a(par1ItemStack, block);
if (str > 1.1f || block instanceof BlockLeavesBase && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k))
{
//par1ItemStack.getEnchantmentTagList();
if (silkTouch)
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
}
}
par2World.setBlockToAir(posX + i, posY + j, posZ + k);
}
}
}
}
}
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000);
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20);
}
}
par1ItemStack.setItemDamage(0);
return;
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
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))
{
return 0.0F;
}
return super.func_150893_a(par1ItemStack, par2Block);
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (!getActivated(par1ItemStack))
{
return false;
}
//par1ItemStack.damageItem(2, par3EntityLivingBase);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
{
if ((double) par3.getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
//par1ItemStack.damageItem(1, par7EntityLivingBase);
}
return true;
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
@Override
public int getItemEnchantability()
{
return 30;
}
/**
* Return whether this item is repairable in an anvil.
*/
// public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
// {
// return true;
// }
/**
* FORGE: Overridden to allow custom tool effectiveness
*/
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if (!getActivated(stack))
{
return 0.0F;
}
if (ForgeHooks.isToolEffective(stack, block, meta))
{
return efficiencyOnProperMaterial;
}
return func_150893_a(stack, block);
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
return !getActivated(stack);
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
{
if("axe".equals(toolClass))
{
return 5;
}
return 0;
}
}

View file

@ -0,0 +1,395 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundPickaxe extends ItemPickaxe implements IBindable
{
/**
* Array of blocks the tool has extra effect against.
*/
// public static final Block[] blocksEffectiveAgainst = new Block[]{Blocks.cobblestone, Blocks.stoneDoubleSlab, Blocks.stoneSingleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail, Block.railDetector, Block.railPowered, Block.railActivator};
public float efficiencyOnProperMaterial = 12.0F;
/**
* Damage versus entities.
*/
public float damageVsEntity;
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int energyUsed;
public BoundPickaxe()
{
super(AlchemicalWizardry.bloodBoundToolMaterial);
this.maxStackSize = 1;
//this.setMaxDamage(par3EnumToolMaterial.getMaxUses());
this.efficiencyOnProperMaterial = 12.0F;
this.damageVsEntity = 5;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setEnergyUsed(5);
}
public void setEnergyUsed(int i)
{
energyUsed = i;
}
public int getEnergyUsed()
{
return this.energyUsed;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("The Souls of the Damned");
par3List.add("do not like stone...");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPickaxe_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPickaxe_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit))
{
return par1ItemStack;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int posX = (int)(blockVec.xCoord);
int posY = (int)(blockVec.yCoord);
int posZ = (int)(blockVec.zCoord);
boolean silkTouch = false;
int so = Enchantment.silkTouch.effectId;
int fortune = Enchantment.fortune.effectId;
int fortuneLvl = 0;
NBTTagList enchants = par1ItemStack.getEnchantmentTagList();
if (enchants != null)
{
for (int i = 0; i < enchants.tagCount(); i++)
{
if (enchants.getCompoundTagAt(i) instanceof NBTTagCompound)
{
NBTTagCompound nbt = (NBTTagCompound) enchants.getCompoundTagAt(i);
int id = nbt.getShort("id");
if (id == so)
{
silkTouch = true;
}
if (id == fortune)
{
fortuneLvl = nbt.getShort("lvl");
}
}
}
}
for (int i = -5; i <= 5; i++)
{
for (int j = -5; j <= 5; j++)
{
for (int k = -5; k <= 5; k++)
{
Block block = par2World.getBlock(posX + i, posY + j, posZ + k);
int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k);
if (block != null && block.getBlockHardness(par2World, posX + i, posY + j, posZ + k) != -1)
{
float str = func_150893_a(par1ItemStack, block);
if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k))
{
//par1ItemStack.getEnchantmentTagList();
if (silkTouch)
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
}
}
par2World.setBlockToAir(posX + i, posY + j, posZ + k);
}
}
}
}
}
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000);
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20);
}
}
par1ItemStack.setItemDamage(0);
return;
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
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) //getStrVsBlock
{
if (!getActivated(par1ItemStack))
{
return 0.0F;
}
return super.func_150893_a(par1ItemStack, par2Block);
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (!getActivated(par1ItemStack))
{
return false;
}
//par1ItemStack.damageItem(2, par3EntityLivingBase);
return true;
}
@Override
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
{
if (par7EntityLivingBase instanceof EntityPlayer)
{
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed());
}
//TODO Possibly add better functionality for the items?
//par7EntityLivingBase.getLookVec();
return true;
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
@Override
public int getItemEnchantability()
{
return 30;
}
/**
* Return whether this item is repairable in an anvil.
*/
// public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
// {
// return false;
// }
/**
* FORGE: Overridden to allow custom tool effectiveness
*/
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if (!getActivated(stack))
{
return 0.0F;
}
if (ForgeHooks.isToolEffective(stack, block, meta))
{
return efficiencyOnProperMaterial;
}
return func_150893_a(stack, block);
}
// @Override
//
// /**
// * Returns if the item (tool) can harvest results from the block type.
// */
// public boolean func_150897_b(Block par1Block) //canHarvestBlock
// {
// return par1Block == Blocks.obsidian ? true : (par1Block != Blocks.diamond_block && par1Block != Blocks.diamond_ore ? (par1Block != Blocks.emerald_ore && par1Block != Blocks.emerald_block ? (par1Block != Blocks.gold_block && par1Block != Blocks.gold_ore ? (par1Block != Blocks.iron_block && par1Block != Blocks.iron_ore ? (par1Block != Blocks.lapis_block && par1Block != Blocks.lapis_ore ? (par1Block != Blocks.redstone_ore && par1Block != Blocks.oreRedstoneGlowing ? (par1Block.getMaterial() == Material.rock ? true : (par1Block.blockMaterial == Material.iron ? true : par1Block.blockMaterial == Material.anvil)) : true) : true) : true) : true) : true) : true);
// }
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
return !getActivated(stack);
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
{
if("pickaxe".equals(toolClass))
{
return 5;
}
return 0;
}
}

View file

@ -0,0 +1,391 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundShovel extends ItemSpade implements IBindable
{
/**
* Array of blocks the tool has extra effect against.
*/
//public static final Block[] blocksEffectiveAgainst = new Block[]{Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium};
public float efficiencyOnProperMaterial = 12.0F;
/**
* Damage versus entities.
*/
public float damageVsEntity;
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int energyUsed;
public BoundShovel()
{
super(AlchemicalWizardry.bloodBoundToolMaterial);
this.maxStackSize = 1;
//this.setMaxDamage(par3EnumToolMaterial.getMaxUses());
this.efficiencyOnProperMaterial = 12.0F;
this.damageVsEntity = 5;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setEnergyUsed(5);
}
public void setEnergyUsed(int i)
{
energyUsed = i;
}
public int getEnergyUsed()
{
return this.energyUsed;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("No, not that type of spade.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundShovel_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundShovel_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit))
{
return par1ItemStack;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int posX = (int)(blockVec.xCoord);
int posY = (int)(blockVec.yCoord);
int posZ = (int)(blockVec.zCoord);
boolean silkTouch = false;
int so = Enchantment.silkTouch.effectId;
int fortune = Enchantment.fortune.effectId;
int fortuneLvl = 0;
NBTTagList enchants = par1ItemStack.getEnchantmentTagList();
if (enchants != null)
{
for (int i = 0; i < enchants.tagCount(); i++)
{
if (enchants.getCompoundTagAt(i) instanceof NBTTagCompound)
{
NBTTagCompound nbt = (NBTTagCompound) enchants.getCompoundTagAt(i);
int id = nbt.getShort("id");
if (id == so)
{
silkTouch = true;
}
if (id == fortune)
{
fortuneLvl = nbt.getShort("lvl");
}
}
}
}
for (int i = -5; i <= 5; i++)
{
for (int j = 0; j <= 10; j++)
{
for (int k = -5; k <= 5; k++)
{
Block block = par2World.getBlock(posX + i, posY + j, posZ + k);
int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k);
if (block != null)
{
float str = func_150893_a(par1ItemStack, block);
if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k))
{
//par1ItemStack.getEnchantmentTagList();
if (silkTouch)
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
}
}
par2World.setBlockToAir(posX + i, posY + j, posZ + k);
}
}
}
}
}
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000);
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20);
}
}
par1ItemStack.setItemDamage(0);
return;
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
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))
{
return 0.0F;
}
return super.func_150893_a(par1ItemStack, par2Block);
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (!getActivated(par1ItemStack))
{
return false;
}
//par1ItemStack.damageItem(2, par3EntityLivingBase);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
{
return true;
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return 30;
}
/**
* Return whether this item is repairable in an anvil.
*/
// public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
// {
// return false;
// }
@Override
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double) this.damageVsEntity, 0));
return multimap;
}
/**
* FORGE: Overridden to allow custom tool effectiveness
*/
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
if (!getActivated(stack))
{
return 0.0F;
}
if (ForgeHooks.isToolEffective(stack, block, meta))
{
return efficiencyOnProperMaterial;
}
return func_150893_a(stack, block);
}
//
// public boolean canHarvestBlock(Block par1Block)
// {
// return par1Block == Block.snow ? true : par1Block == Block.blockSnow;
// }
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
return !getActivated(stack);
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
{
if("shovel".equals(toolClass))
{
return 5;
}
return 0;
}
}

View file

@ -0,0 +1,254 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
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;
import net.minecraftforge.common.util.FakePlayer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CheatyItem extends Item implements IBindable
{
// private int maxEssence;
//protected int orbLevel;
public CheatyItem()
{
super();
DamageSource damageSource = DamageSource.generic;
setMaxStackSize(1);
//setMaxDamage(damage);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
//setFull3D();
//maxEssence = damage;
//orbLevel = 1;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBattery");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Creative only");
par3List.add("Right-click to fill network,");
par3List.add("shift-right to empty.");
//par3List.add("LP: " + (this.getMaxDamage() - this.getDamage(par1ItemStack)));
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
// EntityPlayer owner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par1ItemStack.stackTagCompound.getString("ownerName"));
// if(owner!=null)
// {
// NBTTagCompound tag = owner.getEntityData();
// par3List.add("LP: " + tag.getInteger("currentEssence"));
// }
}
//par3List.add("LP: " + par2EntityPlayer.getEntityData().getInteger("currentEssence"));
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
World world = par3EntityPlayer.worldObj;
if (par3EntityPlayer instanceof FakePlayer)
{
return par1ItemStack;
}
if (world != null)
{
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.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);
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
}
if (!par3EntityPlayer.worldObj.isRemote)
{
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
if (par3EntityPlayer.isSneaking())
{
EnergyItems.setCurrentEssence(itemTag.getString("ownerName"), 0);
} else
{
EnergyItems.addEssenceToMaximum(itemTag.getString("ownerName"), 1000000, Integer.MAX_VALUE);
}
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(itemTag.getString("ownerName")), (Player)par3EntityPlayer);
// EntityPlayer owner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(itemTag.getString("ownerName"));
// if(owner==null){return par1ItemStack;}
// NBTTagCompound ownerTag = owner.getEntityData();
// if(ownerTag.getInteger("currentEssence")<=this.maxEssence)
// {
// damagePlayer(par2World, par3EntityPlayer,2);
// ownerTag.setInteger("currentEssence", Math.min(this.maxEssence, ownerTag.getInteger("currentEssence")+200/2));
// }
return par1ItemStack;
}
/*
* @return the damage that was not deducted
*/
public int damageItem(ItemStack par1ItemStack, int par2int)
{
if (par2int == 0)
{
return 0;
}
int before = this.getDamage(par1ItemStack);
this.setDamage(par1ItemStack, this.getDamage(par1ItemStack) + par2int);
return par2int - (this.getDamage(par1ItemStack) - before);
}
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);
}
}
if (!player.capabilities.isCreativeMode)
{
for (int i = 0; i < damage; i++)
{
player.setHealth((player.getHealth() - 1));
//player.setEntityHealth(player.func_110143_aJ() - 1);
}
}
if (player.getHealth() <= 0)
{
player.inventory.dropAllItems();
}
}
// public int getMaxEssence()
// {
// return this.maxEssence;
// }
//
// public int getOrbLevel()
// {
// return orbLevel;
// }
//
// @Override
// public void onArmourUpdate(World world, EntityPlayer player,
// ItemStack thisItemStack) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public boolean isUpgrade()
// {
// // TODO Auto-generated method stub
// return false;
// }
//
// @Override
// public int getEnergyForTenSeconds()
// {
// // TODO Auto-generated method stub
// return 0;
// }
@Override
public ItemStack getContainerItem(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;
}
@Override
public boolean hasContainerItem()
{
return true;
}
//@SideOnly(Side.SERVER)
public int getCurrentEssence(ItemStack par1ItemStack)
{
if (par1ItemStack == null)
{
return 0;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return 0;
}
String owner = itemTag.getString("ownerName");
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
return (currentEssence);
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
{
return false;
}
}

View file

@ -0,0 +1,268 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DaggerOfSacrifice extends EnergyItems
{
private float weaponDamage;
public DaggerOfSacrifice()
{
super();
this.maxStackSize = 1;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setEnergyUsed(100);
setFull3D();
setMaxDamage(100);
weaponDamage = 1.0F;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DaggerOfSacrifice");
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase == null || par2EntityLivingBase == null || par3EntityLivingBase.worldObj.isRemote || !(par3EntityLivingBase.getClass().equals(EntityPlayerMP.class)))
{
return false;
}
//EntityWither d;
if (par2EntityLivingBase.isChild() || par2EntityLivingBase instanceof EntityWither || par2EntityLivingBase instanceof EntityDragon || par2EntityLivingBase instanceof EntityPlayer || par2EntityLivingBase instanceof IBossDisplayData)
{
return false;
}
World world = par2EntityLivingBase.worldObj;
if (par2EntityLivingBase.isDead || par2EntityLivingBase.getHealth() < 0.5f)
{
return false;
}
if (par2EntityLivingBase instanceof EntityVillager && !par2EntityLivingBase.isChild())
{
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 2000))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
}
par2EntityLivingBase.setHealth(-1);
par2EntityLivingBase.onDeath(DamageSource.generic);
return false;
}
}
if (par2EntityLivingBase instanceof EntitySlime && !par2EntityLivingBase.isChild())
{
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 150))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
}
par2EntityLivingBase.setHealth(-1);
par2EntityLivingBase.onDeath(DamageSource.generic);
return false;
}
}
if (par2EntityLivingBase instanceof EntityEnderman && !par2EntityLivingBase.isChild())
{
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 200))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
}
par2EntityLivingBase.setHealth(-1);
par2EntityLivingBase.onDeath(DamageSource.generic);
return false;
}
}
if (par2EntityLivingBase instanceof EntityAnimal && !par2EntityLivingBase.isChild())
{
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 250))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
}
par2EntityLivingBase.setHealth(-1);
par2EntityLivingBase.onDeath(DamageSource.generic);
return false;
}
}
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 500))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
}
par2EntityLivingBase.setHealth(-1);
par2EntityLivingBase.onDeath(DamageSource.generic);
return false;
}
return false;
}
public float func_82803_g()
{
return 4.0F;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution: may cause");
par3List.add("a bad day...");
}
@Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block == Blocks.web)
{
return 15.0F;
} else
{
Material material = par2Block.getMaterial();
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F;
}
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return false;
}
@Override
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", 1.0d, 0));
return multimap;
}
public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount)
{
int posX = (int) Math.round(sacrifice.posX - 0.5f);
int posY = (int) sacrifice.posY;
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
TEAltar altarEntity = this.getAltar(world, posX, posY, posZ);
if (altarEntity == null)
{
return false;
}
altarEntity.sacrificialDaggerCall(amount, true);
altarEntity.startCycle();
return true;
}
public TEAltar getAltar(World world, int x, int y, int z)
{
TileEntity tileEntity = null;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
for (int k = -2; k <= 1; k++)
{
tileEntity = world.getTileEntity(i + x, k + y, j + z);
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
return null;
}
}

View file

@ -0,0 +1,277 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityList.EntityEggInfo;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DemonPlacer extends Item
{
@SideOnly(Side.CLIENT)
private IIcon theIcon;
public DemonPlacer()
{
super();
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabs.tabMisc);
this.maxStackSize = 1;
}
public String getItemDisplayName(ItemStack par1ItemStack)
{
// String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
// String s1 = EntityList.getStringFromID(par1ItemStack.getItemDamage());
//
// if (s1 != null)
// {
// s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
// }
//
// return s;
return "Demon Crystal";
}
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
{
EntityEggInfo entityegginfo = (EntityEggInfo) EntityList.entityEggs.get(Integer.valueOf(par1ItemStack.getItemDamage()));
return entityegginfo != null ? (par2 == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par3World.isRemote)
{
return true;
} else
{
Block i1 = par3World.getBlock(par4, par5, par6);
par4 += Facing.offsetsXForSide[par7];
par5 += Facing.offsetsYForSide[par7];
par6 += Facing.offsetsZForSide[par7];
double d0 = 0.0D;
if (par7 == 1 && i1 != null && i1.getRenderType() == 11)
{
d0 = 0.5D;
}
Entity entity = spawnCreature(par3World, par1ItemStack.getItemDamage(), (double) par4 + 0.5D, (double) par5 + d0, (double) par6 + 0.5D, par1ItemStack);
if (entity != null)
{
if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName())
{
((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
}
if (!par2EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
}
return true;
}
}
/**
* 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 (par2World.isRemote)
{
return par1ItemStack;
} else
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
if (movingobjectposition == null)
{
return par1ItemStack;
} else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
{
return par1ItemStack;
}
if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack))
{
return par1ItemStack;
}
if (par2World.getBlock(i, j, k).getMaterial() == Material.water)
{
Entity entity = spawnCreature(par2World, par1ItemStack.getItemDamage(), (double) i, (double) j, (double) k, par1ItemStack);
if (entity != null)
{
if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName())
{
((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
}
}
}
return par1ItemStack;
}
}
}
/**
* Spawns the creature specified by the egg's type in the location specified by the last three parameters.
* Parameters: world, entityID, x, y, z.
*/
public static Entity spawnCreature(World par0World, int par1, double par2, double par4, double par6, ItemStack itemStack)
{
// if (!EntityList.entityEggs.containsKey(Integer.valueOf(par1)))
// {
// return null;
// }
// else
{
Entity entity = null;
for (int j = 0; j < 1; ++j)
{
entity = SummoningRegistry.getEntityWithID(par0World, par1);
if (entity != null && entity instanceof EntityLivingBase)
{
EntityLiving entityliving = (EntityLiving) entity;
entity.setLocationAndAngles(par2, par4, par6, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw;
//entityliving.onSpawnWithEgg((EntityLivingData)null);
if (entityliving instanceof EntityDemon)
{
((EntityDemon) entityliving).setOwner(DemonPlacer.getOwnerName(itemStack));
if (!DemonPlacer.getOwnerName(itemStack).equals(""))
{
((EntityDemon) entityliving).setTamed(true);
}
}
par0World.spawnEntityInWorld(entity);
entityliving.playLivingSound();
}
}
return entity;
}
}
// @SideOnly(Side.CLIENT)
// public boolean requiresMultipleRenderPasses()
// {
// return true;
// }
// @SideOnly(Side.CLIENT)
//
// /**
// * Gets an icon index based on an item's damage value and the given render pass
// */
// public Icon getIconFromDamageForRenderPass(int par1, int par2)
// {
// return par2 > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(par1, par2);
// }
// @SideOnly(Side.CLIENT)
//
// /**
// * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
// */
// public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
// {
// Iterator iterator = EntityList.entityEggs.values().iterator();
//
// while (iterator.hasNext())
// {
// EntityEggInfo entityegginfo = (EntityEggInfo)iterator.next();
// par3List.add(new ItemStack(par1, 1, entityegginfo.spawnedID));
// }
// }
public static void setOwnerName(ItemStack par1ItemStack, String ownerName)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setString("ownerName", ownerName);
}
public static String getOwnerName(ItemStack par1ItemStack)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.stackTagCompound.getString("ownerName");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used to spawn demons.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Demon's Owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonPlacer");
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DemonicTelepositionFocus extends TelepositionFocus
{
public DemonicTelepositionFocus()
{
super(4);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
//TODO
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonicTeleposerFocus");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("A stronger version of the focus,");
par3List.add("using a demonic shard");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DuskScribeTool extends ScribeTool
{
public DuskScribeTool()
{
super(5);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DuskScribeTool");
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EarthScribeTool extends ScribeTool
{
public EarthScribeTool()
{
super(3);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EarthScribeTool");
}
}

View file

@ -0,0 +1,252 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
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;
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.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBloodOrb
{
private int maxEssence;
protected int orbLevel;
public EnergyBattery(int damage)
{
super();
DamageSource damageSource = DamageSource.generic;
setMaxStackSize(1);
//setMaxDamage(damage);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
//setFull3D();
maxEssence = damage;
orbLevel = 1;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBattery");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Stores raw Life Essence");
//par3List.add("LP: " + (this.getMaxDamage() - this.getDamage(par1ItemStack)));
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
// EntityPlayer owner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par1ItemStack.stackTagCompound.getString("ownerName"));
// if(owner!=null)
// {
// NBTTagCompound tag = owner.getEntityData();
// par3List.add("LP: " + tag.getInteger("currentEssence"));
// }
}
//par3List.add("LP: " + par2EntityPlayer.getEntityData().getInteger("currentEssence"));
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
World world = par3EntityPlayer.worldObj;
// if (par3EntityPlayer instanceof FakePlayer || par3EntityPlayer instanceof EntityPlayerMP)
// {
// return par1ItemStack;
// }
if (world != null)
{
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.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);
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
}
// if (!(par3EntityPlayer.getClass().equals(EntityPlayerMP.class)))
// {
// return par1ItemStack;
// }
// if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
// {
// return par1ItemStack;
// }
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
if(world.isRemote)
{
return par1ItemStack;
}
EnergyItems.addEssenceToMaximum(itemTag.getString("ownerName"), 200, this.getMaxEssence());
EnergyItems.hurtPlayer(par3EntityPlayer, 200);
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(itemTag.getString("ownerName")), (Player)par3EntityPlayer);
// EntityPlayer owner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(itemTag.getString("ownerName"));
// if(owner==null){return par1ItemStack;}
// NBTTagCompound ownerTag = owner.getEntityData();
// if(ownerTag.getInteger("currentEssence")<=this.maxEssence)
// {
// damagePlayer(par2World, par3EntityPlayer,2);
// ownerTag.setInteger("currentEssence", Math.min(this.maxEssence, ownerTag.getInteger("currentEssence")+200/2));
// }
return par1ItemStack;
}
/*
* @return the damage that was not deducted
*/
public int damageItem(ItemStack par1ItemStack, int par2int)
{
if (par2int == 0)
{
return 0;
}
int before = this.getDamage(par1ItemStack);
this.setDamage(par1ItemStack, this.getDamage(par1ItemStack) + par2int);
return par2int - (this.getDamage(par1ItemStack) - before);
}
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);
}
}
if (!player.capabilities.isCreativeMode)
{
for (int i = 0; i < damage; i++)
{
player.setHealth((player.getHealth() - 1));
//player.setEntityHealth(player.func_110143_aJ() - 1);
}
}
if (player.getHealth() <= 0)
{
player.inventory.dropAllItems();
}
}
public int getMaxEssence()
{
return this.maxEssence;
}
public int getOrbLevel()
{
return orbLevel;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
}
@Override
public boolean isUpgrade()
{
return false;
}
@Override
public int getEnergyForTenSeconds()
{
return 0;
}
@Override
public ItemStack getContainerItem(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;
}
@Override
public boolean hasContainerItem()
{
return true;
}
//@SideOnly(Side.SERVER)
public int getCurrentEssence(ItemStack par1ItemStack)
{
if (par1ItemStack == null)
{
return 0;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return 0;
}
String owner = itemTag.getString("ownerName");
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
return (currentEssence);
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
{
return false;
}
}

View file

@ -0,0 +1,219 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
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.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnergyBazooka extends EnergyItems
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private static int damage;
//private static int delay;
private static final int maxDelay = 150;
public EnergyBazooka()
{
super();
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setFull3D();
setMaxDamage(250);
this.setEnergyUsed(20000);
damage = 12;
//delay = 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBazooka_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBazooka_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
if (this.getDelay(par1ItemStack) > 0)
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
this.syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, damage));
this.setDelay(par1ItemStack, maxDelay);
}
Vec3 vec = par3EntityPlayer.getLookVec();
double wantedVelocity = 3.0f;
par3EntityPlayer.motionX = -vec.xCoord * wantedVelocity;
par3EntityPlayer.motionY = -vec.yCoord * wantedVelocity;
par3EntityPlayer.motionZ = -vec.zCoord * wantedVelocity;
par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
par3EntityPlayer.fallDistance = 0;
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
int delay = this.getDelay(par1ItemStack);
if (!par2World.isRemote && delay > 0)
{
this.setDelay(par1ItemStack, delay - 1);
}
if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50);
}
}
par1ItemStack.setItemDamage(0);
return;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Boom.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getBoolean("isActive");
}
public void setDelay(ItemStack par1ItemStack, int newDelay)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setInteger("delay", newDelay);
}
public int getDelay(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getInteger("delay");
}
}

View file

@ -0,0 +1,214 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnergyBlast extends EnergyItems
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private static int damage;
//private static int delay;
private static final int maxDelay = 15;
public EnergyBlast()
{
super();
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setUnlocalizedName("energyBlaster");
setFull3D();
setMaxDamage(250);
this.setEnergyUsed(150);
damage = 12;
//delay = 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBlaster_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBlaster_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
if (this.getDelay(par1ItemStack) > 0)
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
this.syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
this.setDelay(par1ItemStack, maxDelay);
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
int delay = this.getDelay(par1ItemStack);
if (!par2World.isRemote && delay > 0)
{
this.setDelay(par1ItemStack, delay - 1);
}
if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50);
}
}
par1ItemStack.setItemDamage(0);
return;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used to fire devastating");
par3List.add("projectiles.");
par3List.add("Damage: " + damage);
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getBoolean("isActive");
}
public void setDelay(ItemStack par1ItemStack, int newDelay)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setInteger("delay", newDelay);
}
public int getDelay(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getInteger("delay");
}
}

View file

@ -0,0 +1,357 @@
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;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class EnergyItems extends Item implements IBindable
{
private int energyUsed;
public EnergyItems()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
protected void setEnergyUsed(int par1int)
{
this.energyUsed = par1int;
}
protected int getEnergyUsed()
{
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 syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if (!player.worldObj.isRemote)
{
return syphonAndDamageWhileInContainer(ist, player, damageToBeDone);
} else
{
World world = player.worldObj;
if (world != null)
{
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
//if(particles)
{
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
}
}
}
return true;
//return syphonBatteriesWithoutParticles(ist, player, damageToBeDone, true);
}
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);
}
return true;
}
//Global static methods
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", SpellHelper.getUsername(player));
}
initializePlayer(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);
}
}
public static String getOwnerName(ItemStack item)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
return item.stackTagCompound.getString("ownerName");
}
public static void drainPlayerNetwork(EntityPlayer player, int damageToBeDone)
{
String ownerName = SpellHelper.getUsername(player);
if (MinecraftServer.getServer() == null)
{
return;
}
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();
}else
{
hurtPlayer(player, damageToBeDone);
}
}
public static int getCurrentEssence(String ownerName)
{
if (MinecraftServer.getServer() == null)
{
return 0;
}
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;
}
public static void setCurrentEssence(String ownerName, int amount)
{
if (MinecraftServer.getServer() == null)
{
return;
}
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);
}
data.currentEssence = amount;
data.markDirty();
}
public static void addEssenceToMaximum(String ownerName, int amount, int maximum)
{
if (MinecraftServer.getServer() == null)
{
return;
}
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>=maximum)
{
return;
}
data.currentEssence = Math.min(maximum, data.currentEssence + amount);
data.markDirty();
}
}

View file

@ -0,0 +1,238 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnergySword extends ItemSword
{
//private float weaponDamaged;
//private int maxMode = 3;
private NBTTagCompound data;
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int energyUsed;
public EnergySword()
{
super(AlchemicalWizardry.bloodBoundToolMaterial);
this.maxStackSize = 1;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setEnergyUsed(50);
setFull3D();
setMaxDamage(100);
//weaponDamaged = 12.0F;
}
public void setEnergyUsed(int i)
{
energyUsed = i;
}
public int getEnergyUsed()
{
return this.energyUsed;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundSword_activated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundSword_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
return !getActivated(stack);
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase);
if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed()))
{
//this.damagePlayer(null, (EntityPlayer)par3EntityLivingBase, (this.getEnergyUsed() + 99) / 100);
}
}
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
return true;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100);
return par1ItemStack;
}
if (!getActivated(par1ItemStack))
{
return par1ItemStack;
}
return par1ItemStack;
}
@Override
public int getItemEnchantability()
{
return 30;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
// if(par1ItemStack.stackTagCompound.getBoolean("isActive"))
// {
// EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1);
// }
if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50);
}
}
par1ItemStack.setItemDamage(0);
return;
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getBoolean("isActive");
}
// public int getDamageVsEntity(Entity par1Entity)
// {
// return (int) this.weaponDamage;
// }
public float func_82803_g()
{
return 4.0F;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Caution: may cause");
par3List.add("a bad day...");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
@Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block == Blocks.web)
{
return 15.0F;
} else
{
Material material = par2Block.getMaterial();
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F;
}
}
// public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
// {
// return false;
// }
}

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnhancedTelepositionFocus extends TelepositionFocus
{
public EnhancedTelepositionFocus()
{
super(2);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
//TODO
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnhancedTeleposerFocus");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("A focus further enhanced in an altar");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class FireScribeTool extends ScribeTool
{
public FireScribeTool()
{
super(2);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:FireScribeTool");
}
}

View file

@ -0,0 +1,107 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemAlchemyBase extends Item
{
private static final String[] ITEM_NAMES = new String[]{"Offensa","Praesidium","OrbisTerrae","StrengthenedCatalyst","ConcentratedCatalyst","FracturedBone","Virtus","Reductus","Potentia"};
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public ItemAlchemyBase()
{
super();
this.maxStackSize = 64;
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
icons = new IIcon[ITEM_NAMES.length];
for (int i = 0; i < ITEM_NAMES.length; ++i)
{
icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseAlchemyItem" + ITEM_NAMES[i]);
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
//This is what will do all the localisation things on the alchemy components so you dont have to set it :D
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1);
return ("" + "item.bloodMagicAlchemyItem." + ITEM_NAMES[meta]);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)
{
int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < ITEM_NAMES.length; ++meta)
{
list.add(new ItemStack(id, 1, meta));
}
}
}

View file

@ -0,0 +1,59 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemBloodRuneBlock extends ItemBlock
{
public ItemBloodRuneBlock(Block block)
{
super(block);
setHasSubtypes(true);
// this.setUnlocalizedName("itemBloodRuneBlock");
// setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
{
name = "blank";
break;
}
case 1:
{
name = "fill";
break;
}
case 2:
name = "empty";
break;
case 3:
name = "test";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,108 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemComplexSpellCrystal extends EnergyItems
{
public ItemComplexSpellCrystal()
{
super();
this.setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ComplexCrystal");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Crystal of unimaginable power");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par2World.isRemote)
{
//World world = MinecraftServer.getServer().worldServers[getDimensionID(par1ItemStack)];
World world = DimensionManager.getWorld(getDimensionID(par1ItemStack));
if (world != null)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
TileEntity tileEntity = world.getTileEntity(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord"));
if (tileEntity instanceof TESpellParadigmBlock)
{
TESpellParadigmBlock tileParad = (TESpellParadigmBlock) tileEntity;
tileParad.castSpell(par2World, par3EntityPlayer, par1ItemStack);
} else
{
return par1ItemStack;
}
} else
{
return par1ItemStack;
}
} else
{
return par1ItemStack;
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
// if (!par2World.isRemote)
// {
// //par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
// par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 10));
// }
return par1ItemStack;
}
public int getDimensionID(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemStack.stackTagCompound.getInteger("dimensionId");
}
}

View file

@ -0,0 +1,80 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemComponents extends Item
{
private static final String[] ITEM_NAMES = new String[]{"QuartzRod", "EmptyCore", "MagicalesCable", "WoodBrace", "StoneBrace", "ProjectileCore", "SelfCore","MeleeCore","ParadigmBackPlate","OutputCable","FlameCore","IcyCore","GustCore","EarthenCore","InputCable","CrackedRunicPlate","RunicPlate","ScribedRunicPlate","DefaultCore","OffensiveCore","DefensiveCore","EnvironmentalCore","PowerCore","CostCore","PotencyCore","ObsidianBrace"};
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public ItemComponents()
{
super();
this.maxStackSize = 64;
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
icons = new IIcon[ITEM_NAMES.length];
for (int i = 0; i < ITEM_NAMES.length; ++i)
{
icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseItem" + ITEM_NAMES[i]);
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
//This is what will do all the localisation things on the alchemy components so you dont have to set it :D
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1);
return ("" + "item.bloodMagicBaseItem." + ITEM_NAMES[meta]);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)
{
int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < ITEM_NAMES.length; ++meta)
{
list.add(new ItemStack(id, 1, meta));
}
}
}

View file

@ -0,0 +1,128 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
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.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemDiabloKey extends EnergyItems
{
public ItemDiabloKey()
{
super();
DamageSource damageSource = DamageSource.generic;
setMaxStackSize(1);
//setMaxDamage(damage);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setEnergyUsed(1000);
this.hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DiabloKey");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Binds other items to the owner's network");
//par3List.add("LP: " + (this.getMaxDamage() - this.getDamage(par1ItemStack)));
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
//par3List.add("LP: " + par2EntityPlayer.getEntityData().getInteger("currentEssence"));
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
World world = par3EntityPlayer.worldObj;
if (par3EntityPlayer instanceof FakePlayer || par3EntityPlayer instanceof EntityPlayerMP)
{
return par1ItemStack;
}
if (world != null)
{
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.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);
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
}
if (!par3EntityPlayer.worldObj.isRemote && !(par3EntityPlayer.getClass().equals(EntityPlayerMP.class)))
{
return par1ItemStack;
}
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
ItemStack[] inv = par3EntityPlayer.inventory.mainInventory;
for (ItemStack itemStack : inv)
{
if (itemStack == null)
{
continue;
}
Item item = itemStack.getItem();
if (item instanceof ItemDiabloKey)
{
continue;
}
if (item instanceof IBindable)
{
EnergyItems.checkAndSetItemOwner(itemStack, ownerName);
}
}
return par1ItemStack;
}
@Override
@SideOnly(Side.CLIENT)
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");
list.add(boundKey);
}
}

View file

@ -0,0 +1,304 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemRitualDiviner extends EnergyItems
{
private int maxMetaData;
public ItemRitualDiviner()
{
super();
this.maxStackSize = 1;
setEnergyUsed(100);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.maxMetaData = 4;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualDiviner");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used to explore new types of rituals");
if (this.getMaxRuneDisplacement(par1ItemStack) == 1)
{
par3List.add("Can place Dusk runes");
} else
{
par3List.add("Can not place Dusk runes");
}
if (!(par1ItemStack.stackTagCompound == null))
{
String ritualID = this.getCurrentRitual(par1ItemStack);
//TODO
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
par3List.add("RitualID: " + ritualID);
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack));
if(ritualList == null)
{
return;
}
int blankStones = 0;
int airStones = 0;
int waterStones = 0;
int fireStones = 0;
int earthStones = 0;
int duskStones = 0;
for (RitualComponent rc : ritualList)
{
switch (rc.getStoneType())
{
case RitualComponent.BLANK:
blankStones++;
break;
case RitualComponent.AIR:
airStones++;
break;
case RitualComponent.WATER:
waterStones++;
break;
case RitualComponent.FIRE:
fireStones++;
break;
case RitualComponent.EARTH:
earthStones++;
break;
case RitualComponent.DUSK:
duskStones++;
break;
}
}
par3List.add("Blank stones: " + blankStones);
par3List.add(EnumChatFormatting.AQUA + "Air stones: " + airStones);
par3List.add(EnumChatFormatting.BLUE + "Water stones: " + waterStones);
par3List.add(EnumChatFormatting.RED + "Fire stones: " + fireStones);
par3List.add(EnumChatFormatting.DARK_GREEN + "Earth stones: " + earthStones);
par3List.add(EnumChatFormatting.BOLD + "Dusk stones: " + duskStones);
//par3List.add("Ritual Name: " + Rituals.getNameOfRitual(ritualID));
}
}
@Override
public String getItemStackDisplayName(ItemStack par1ItemStack)
{
if (!(par1ItemStack.stackTagCompound == null))
{
String ritualID = this.getCurrentRitual(par1ItemStack);
if(ritualID.equals(""))
{
return super.getItemStackDisplayName(par1ItemStack);
}
return "Ritual: " + Rituals.getNameOfRitual(ritualID);
//par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
} else
{
return super.getItemStackDisplayName(par1ItemStack);
}
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer);
ItemStack[] playerInventory = par2EntityPlayer.inventory.mainInventory;
TileEntity tileEntity = par3World.getTileEntity(par4, par5, par6);
if (tileEntity instanceof TEMasterStone)
{
TEMasterStone masterStone = (TEMasterStone) tileEntity;
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack));
int playerInvRitualStoneLocation = -1;
for (int i = 0; i < playerInventory.length; i++)
{
if (playerInventory[i] == null)
{
continue;
}
if (new ItemStack(ModBlocks.ritualStone).isItemEqual(playerInventory[i]))
{
playerInvRitualStoneLocation = i;
break;
}
}
for (RitualComponent rc : ritualList)
{
if (par3World.isAirBlock(par4 + rc.getX(), par5 + rc.getY(), par6 + rc.getZ()))
{
if (playerInvRitualStoneLocation >= 0)
{
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack))
{
par3World.playAuxSFX(200, par4, par5 + 1, par6, 0);
return true;
}
if (!par2EntityPlayer.capabilities.isCreativeMode)
{
par2EntityPlayer.inventory.decrStackSize(playerInvRitualStoneLocation, 1);
}
par3World.setBlock(par4 + rc.getX(), par5 + rc.getY(), par6 + rc.getZ(), ModBlocks.ritualStone, rc.getStoneType(), 3);
if (par3World.isRemote)
{
par3World.playAuxSFX(2005, par4, par5 + 1, par6, 0);
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
return true;
}
return true;
}
} else
{
Block block = par3World.getBlock(par4 + rc.getX(), par5 + rc.getY(), par6 + rc.getZ());
if (block == ModBlocks.ritualStone)
{
int metadata = par3World.getBlockMetadata(par4 + rc.getX(), par5 + rc.getY(), par6 + rc.getZ());
if (metadata != rc.getStoneType())
{
if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack))
{
par3World.playAuxSFX(200, par4, par5 + 1, par6, 0);
return true;
}
par3World.setBlockMetadataWithNotify(par4 + rc.getX(), par5 + rc.getY(), par6 + rc.getZ(), rc.getStoneType(), 3);
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
return true;
}
} else
{
par3World.playAuxSFX(0000, par4, par5 + 1, par6, 0);
return true;
}
}
}
// if (par3World.isRemote)
// {
// par3World.playAuxSFX(2005, par4, par5, par6, 0);
// EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
// return true;
// }
// return true;
}
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
int maxRitualID = Rituals.getNumberOfRituals();
String currentRitualID = this.getCurrentRitual(par1ItemStack);
this.setCurrentRitual(par1ItemStack, Rituals.getNextRitualKey(currentRitualID));
if (par2World.isRemote)
{
IChatComponent chatmessagecomponent = new ChatComponentText("Current Ritual: " + Rituals.getNameOfRitual(this.getCurrentRitual(par1ItemStack)));
//chatmessagecomponent.func_111072_b("Current Essence: " + data.currentEssence + "LP");
//chatmessagecomponent.addText("Current Ritual: " + Rituals.getNameOfRitual(this.getCurrentRitual(par1ItemStack)));
par3EntityPlayer.addChatComponentMessage(chatmessagecomponent);
}
}
return par1ItemStack;
}
public String getCurrentRitual(ItemStack par1ItemStack)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.stackTagCompound.getString("ritualID");
}
public void setCurrentRitual(ItemStack par1ItemStack, String ritualID)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setString("ritualID", ritualID);
}
public int getMaxRuneDisplacement(ItemStack par1ItemStack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.stackTagCompound.getInteger("maxRuneDisplacement");
}
public void setMaxRuneDisplacement(ItemStack par1ItemStack, int displacement)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setInteger("maxRuneDisplacement", displacement);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
list.add(new ItemStack(ModItems.itemRitualDiviner));
ItemStack duskRitualDivinerStack = new ItemStack(ModItems.itemRitualDiviner);
((ItemRitualDiviner) duskRitualDivinerStack.getItem()).setMaxRuneDisplacement(duskRitualDivinerStack, 1);
list.add(duskRitualDivinerStack);
}
}

View file

@ -0,0 +1,59 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemSpellEffectBlock extends ItemBlock
{
public ItemSpellEffectBlock(Block par1)
{
super(par1);
setHasSubtypes(true);
// this.setUnlocalizedName("itemSpellEffectBlock");
// setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
{
name = "fire";
break;
}
case 1:
{
name = "ice";
break;
}
case 2:
name = "wind";
break;
case 3:
name = "earth";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,99 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemSpellEnhancementBlock extends ItemBlock
{
public ItemSpellEnhancementBlock(Block par1)
{
super(par1);
setHasSubtypes(true);
// this.setUnlocalizedName("itemSpellEnhancementBlock");
// setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
name = "power1";
break;
case 1:
name = "power2";
break;
case 2:
name = "power3";
break;
case 3:
name = "power4";
break;
case 4:
name = "power5";
break;
case 5:
name = "cost1";
break;
case 6:
name = "cost2";
break;
case 7:
name = "cost3";
break;
case 8:
name = "cost4";
break;
case 9:
name = "cost5";
break;
case 10:
name = "potency1";
break;
case 11:
name = "potency2";
break;
case 12:
name = "potency3";
break;
case 13:
name = "potency4";
break;
case 14:
name = "potency5";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,59 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemSpellModifierBlock extends ItemBlock
{
public ItemSpellModifierBlock(Block par1)
{
super(par1);
setHasSubtypes(true);
// this.setUnlocalizedName("itemSpellModifierBlock");
// setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
{
name = "default";
break;
}
case 1:
{
name = "offensive";
break;
}
case 2:
name = "defensive";
break;
case 3:
name = "environmental";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,58 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemSpellParadigmBlock extends ItemBlock
{
public ItemSpellParadigmBlock(Block par1)
{
super(par1);
setHasSubtypes(true);
//this.setUnlocalizedName("itemSpellParadigmBlock");
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
{
name = "projectile";
break;
}
case 1:
{
name = "self";
break;
}
case 2:
name = "melee";
break;
case 3:
name = "tool";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
@Override
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,114 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LavaCrystal extends EnergyItems
{
public LavaCrystal()
{
super();
//setMaxDamage(1000);
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setUnlocalizedName("lavaCrystal");
setEnergyUsed(25);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LavaCrystal");
}
/*
* Used to have the item contain itself.
*/
@Override
public ItemStack getContainerItem(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;
}
@Override
public boolean hasContainerItem()
{
return true;
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
int damage = this.getDamage(par1ItemStack);
return par1ItemStack;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Store life to smelt");
par3List.add("stuff in the furnace.");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
public boolean hasEnoughEssence(ItemStack itemStack)
{
if (itemStack.getTagCompound() != null && !(itemStack.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = itemStack.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 >= this.getEnergyUsed())
{
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;
}
}

View file

@ -0,0 +1,23 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemBucket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LifeBucket extends ItemBucket
{
public LifeBucket(Block block)
{
super(block);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LifeBucket");
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MagicianBloodOrb extends EnergyBattery
{
public MagicianBloodOrb(int damage)
{
super(damage);
orbLevel = 3;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MagicianBloodOrb");
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MasterBloodOrb extends EnergyBattery
{
public MasterBloodOrb(int damage)
{
super(damage);
orbLevel = 4;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterBloodOrb");
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class OrbOfTesting extends EnergyItems
{
public OrbOfTesting()
{
super();
setMaxStackSize(1);
setCreativeTab(CreativeTabs.tabMisc);
setUnlocalizedName("orbOfTesting");
setMaxDamage(100);
setFull3D();
this.setEnergyUsed(100);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Untitled");
}
//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.
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.shouldHeal())
{
return par1ItemStack;
}
if (this.syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed()))
{
par3EntityPlayer.heal(1);
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ReinforcedTelepositionFocus extends TelepositionFocus
{
public ReinforcedTelepositionFocus()
{
super(3);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
//TODO
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ReinforcedTeleposerFocus");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("A stronger version of the focus,");
par3List.add("using a weak shard");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
}

View file

@ -0,0 +1,159 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SacrificialDagger extends Item
{
public SacrificialDagger()
{
super();
this.maxStackSize = 1;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setFull3D();
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
if(AlchemicalWizardry.wimpySettings)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
}else
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SacrificialDagger");
}
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if(AlchemicalWizardry.wimpySettings)
{
par3List.add("A slight draining feeling tickles your fingers");
}else
{
par3List.add("Just a prick of the");
par3List.add("finger will suffice...");
}
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
par3EntityPlayer.setHealth(par3EntityPlayer.getHealth() - 2);
}
if (par3EntityPlayer instanceof FakePlayer)
{
return par1ItemStack;
}
double posX = par3EntityPlayer.posX;
double posY = par3EntityPlayer.posY;
double posZ = par3EntityPlayer.posZ;
par2World.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.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)
{
par2World.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
}
if (!par2World.isRemote && !(par3EntityPlayer.getClass().equals(EntityPlayerMP.class)))
{
return par1ItemStack;
}
findAndFillAltar(par2World, par3EntityPlayer, 200);
if (par3EntityPlayer.getHealth() <= 0.001f)
{
//par3EntityPlayer.inventory.dropAllItems();
par3EntityPlayer.onDeath(DamageSource.generic);
}
return par1ItemStack;
}
public void findAndFillAltar(World world, EntityPlayer player, int amount)
{
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
TEAltar altarEntity = getAltar(world, posX, posY, posZ);
if (altarEntity == null)
{
return;
}
altarEntity.sacrificialDaggerCall(amount, false);
altarEntity.startCycle();
}
public TEAltar getAltar(World world, int x, int y, int z)
{
TileEntity tileEntity = null;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
for (int k = -2; k <= 1; k++)
{
tileEntity = world.getTileEntity(i + x, k + y, j + z);
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
}
if ((tileEntity instanceof TEAltar))
{
return (TEAltar) tileEntity;
}
return null;
}
@Override
public String getItemStackDisplayName(ItemStack par1ItemStack)
{
if(AlchemicalWizardry.wimpySettings)
{
return "Sacrificial Orb";
}
return super.getItemStackDisplayName(par1ItemStack);
}
}

View file

@ -0,0 +1,53 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.List;
public class ScribeTool extends EnergyItems
{
private int meta;
public ScribeTool(int inkType)
{
super();
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setMaxDamage(10);
setEnergyUsed(10);
this.meta = inkType;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("The writing is on the wall...");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par1ItemStack.getItemDamage() > 0)
{
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1);
syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed());
}
return par1ItemStack;
}
public int getType()
{
return this.meta;
}
}

View file

@ -0,0 +1,124 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TelepositionFocus extends EnergyItems
{
private int focusLevel;
public TelepositionFocus(int focusLevel)
{
super();
this.setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.focusLevel = focusLevel;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
//TODO
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:TeleposerFocus");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("An Enderpearl imbued with blood");
if (!(par1ItemStack.stackTagCompound == null))
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
par3List.add("Coords: " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord"));
par3List.add("Bound Dimension: " + getDimensionID(par1ItemStack));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
// if (!par2World.isRemote)
// {
// //par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
// par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 10));
// }
return par1ItemStack;
}
public int getDimensionID(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemStack.stackTagCompound.getInteger("dimensionId");
}
public World getWorld(ItemStack itemStack)
{
return DimensionManager.getWorld(getDimensionID(itemStack));
}
public int xCoord(ItemStack itemStack)
{
if (!(itemStack.stackTagCompound == null))
{
return itemStack.stackTagCompound.getInteger("xCoord");
} else
{
return 0;
}
}
public int yCoord(ItemStack itemStack)
{
if (!(itemStack.stackTagCompound == null))
{
return itemStack.stackTagCompound.getInteger("yCoord");
} else
{
return 0;
}
}
public int zCoord(ItemStack itemStack)
{
if (!(itemStack.stackTagCompound == null))
{
return itemStack.stackTagCompound.getInteger("zCoord");
} else
{
return 0;
}
}
public int getFocusLevel()
{
return this.focusLevel;
}
}

View file

@ -0,0 +1,22 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WaterScribeTool extends ScribeTool
{
public WaterScribeTool()
{
super(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterScribeTool");
}
}

View file

@ -0,0 +1,151 @@
package WayofTime.alchemicalWizardry.common.items.forestry;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBloodFrame extends EnergyItems //implements IHiveFrame
{
public ItemBloodFrame()
{
super();
this.maxStackSize = 1;
this.setMaxDamage(10);
//setMaxDamage(1000);
setEnergyUsed(3000);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Stirs bees into a frenzy.");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodFrame");
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if(par1ItemStack.getItemDamage()>0)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage()-1);
}
return par1ItemStack;
}
/**TODO Bee Stuff
@Override
public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
{
// TODO Auto-generated method stub
return 1;
}
@Override
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
{
// TODO Auto-generated method stub
return 1;
}
@Override
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
{
// TODO Auto-generated method stub
return 0.0001f;
}
@Override
public float getProductionModifier(IBeeGenome genome, float currentModifier)
{
// TODO Auto-generated method stub
return 0;
}
@Override
public float getFloweringModifier(IBeeGenome genome, float currentModifier)
{
// TODO Auto-generated method stub
return 1;
}
@Override
public float getGeneticDecay(IBeeGenome genome, float currentModifier)
{
// TODO Auto-generated method stub
return 1;
}
@Override
public boolean isSealed()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSelfLighted()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSunlightSimulated()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isHellish()
{
// TODO Auto-generated method stub
return false;
}
@Override
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear)
{
// TODO Auto-generated method stub
if(EnergyItems.canSyphonInContainer(frame, getEnergyUsed()*wear))
{
EnergyItems.syphonWhileInContainer(frame, getEnergyUsed()*wear);
return frame;
}else
{
frame.setItemDamage(frame.getItemDamage() + wear);
if(frame.getItemDamage()>=frame.getMaxDamage())
{
return null;
}
return frame;
}
}
*/
}

View file

@ -0,0 +1,435 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttribute;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper;
import com.google.common.collect.HashMultimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AlchemyFlask extends Item
{
private int maxPotionAmount = 20;
public AlchemyFlask()
{
super();
this.setMaxDamage(8);
this.setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:PotionFlask");
}
public static ArrayList<AlchemyPotionHelper> getEffects(ItemStack par1ItemStack)
{
if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("CustomFlaskEffects"))
{
ArrayList<AlchemyPotionHelper> arraylist = new ArrayList();
NBTTagList nbttaglist = par1ItemStack.getTagCompound().getTagList("CustomFlaskEffects", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
arraylist.add(AlchemyPotionHelper.readEffectFromNBT(nbttagcompound));
}
return arraylist;
} else
{
return null;
}
}
public static ArrayList<PotionEffect> getPotionEffects(ItemStack par1ItemStack)
{
ArrayList<AlchemyPotionHelper> list = AlchemyFlask.getEffects(par1ItemStack);
if (list != null)
{
ArrayList<PotionEffect> newList = new ArrayList();
for (AlchemyPotionHelper aph : list)
{
newList.add(aph.getPotionEffect());
}
return newList;
} else
{
return null;
}
}
public void setEffects(ItemStack par1ItemStack, ArrayList<AlchemyPotionHelper> list)
{
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagList nbttaglist = new NBTTagList();
for (AlchemyPotionHelper aph : list)
{
nbttaglist.appendTag(AlchemyPotionHelper.setEffectToNBT(aph));
}
par1ItemStack.stackTagCompound.setTag("CustomFlaskEffects", nbttaglist);
}
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() + 1);
}
if (!par2World.isRemote)
{
ArrayList<AlchemyPotionHelper> list = this.getEffects(par1ItemStack);
if (list != null)
{
for (AlchemyPotionHelper aph : list)
{
PotionEffect pe = aph.getPotionEffect();
if (pe != null)
{
//if(pe.get)
par3EntityPlayer.addPotionEffect(pe);
}
}
}
}
return par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 32;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
if (this.isPotionThrowable(par1ItemStack))
{
return EnumAction.none;
}
return EnumAction.drink;
}
/**
* 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(par3EntityPlayer.isSneaking())
// {
// this.setIsPotionThrowable(true, par1ItemStack);
// return par1ItemStack;
// }
if (par1ItemStack.getItemDamage() < par1ItemStack.getMaxDamage())
{
if (this.isPotionThrowable(par1ItemStack))
{
if (!par2World.isRemote)
{
EntityPotion entityPotion = this.getEntityPotion(par1ItemStack, par2World, par3EntityPlayer);
if (entityPotion != null)
{
float velocityChange = 2.0f;
entityPotion.motionX *= velocityChange;
entityPotion.motionY *= velocityChange;
entityPotion.motionZ *= velocityChange;
par2World.spawnEntityInWorld(entityPotion);
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() + 1);
}
}
return par1ItemStack;
}
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public void setConcentrationOfPotion(ItemStack par1ItemStack, int potionID, int concentration)
{
ArrayList<AlchemyPotionHelper> list = this.getEffects(par1ItemStack);
if (list != null)
{
for (AlchemyPotionHelper aph : list)
{
if (aph.getPotionID() == potionID)
{
aph.setConcentration(concentration);
break;
}
}
this.setEffects(par1ItemStack, list);
}
}
public void setDurationFactorOfPotion(ItemStack par1ItemStack, int potionID, int durationFactor)
{
ArrayList<AlchemyPotionHelper> list = this.getEffects(par1ItemStack);
if (list != null)
{
for (AlchemyPotionHelper aph : list)
{
if (aph.getPotionID() == potionID)
{
aph.setDurationFactor(durationFactor);
break;
}
}
this.setEffects(par1ItemStack, list);
}
}
public boolean hasPotionEffect(ItemStack par1ItemStack, int potionID)
{
return false;
}
public int getNumberOfPotionEffects(ItemStack par1ItemStack)
{
if (getEffects(par1ItemStack) != null)
{
return getEffects(par1ItemStack).size();
} else
{
return 0;
}
}
public boolean addPotionEffect(ItemStack par1ItemStack, int potionID, int tickDuration)
{
int i = 0;
ArrayList<AlchemyPotionHelper> list = this.getEffects(par1ItemStack);
if (list != null)
{
for (AlchemyPotionHelper aph : list)
{
if (aph.getPotionID() == potionID)
{
return false;
}
i++;
}
//if(i<this.maxPotionAmount)
{
list.add(new AlchemyPotionHelper(potionID, tickDuration, 0, 0));
this.setEffects(par1ItemStack, list);
return true;
}
} else
{
list = new ArrayList();
list.add(new AlchemyPotionHelper(potionID, tickDuration, 0, 0));
this.setEffects(par1ItemStack, list);
return true;
}
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add(EnumChatFormatting.BLUE + "Swigs left: " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage());
if (this.isPotionThrowable(par1ItemStack))
{
par3List.add(EnumChatFormatting.BLUE + "CAUTION: Contents are throwable");
}
List list1 = AlchemyFlask.getPotionEffects(par1ItemStack);
HashMultimap hashmultimap = HashMultimap.create();
Iterator iterator;
if (list1 != null && !list1.isEmpty())
{
iterator = list1.iterator();
while (iterator.hasNext())
{
PotionEffect potioneffect = (PotionEffect) iterator.next();
String s = StatCollector.translateToLocal(potioneffect.getEffectName()).trim();
Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
Map map = potion.func_111186_k();
if (map != null && map.size() > 0)
{
Iterator iterator1 = map.entrySet().iterator();
while (iterator1.hasNext())
{
Entry entry = (Entry) iterator1.next();
AttributeModifier attributemodifier = (AttributeModifier) entry.getValue();
AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
hashmultimap.put(((IAttribute)entry.getKey()).getAttributeUnlocalizedName(), attributemodifier1);
}
}
if (potioneffect.getAmplifier() > 0)
{
s = s + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
}
if (potioneffect.getDuration() > 20)
{
s = s + " (" + Potion.getDurationString(potioneffect) + ")";
}
if (potion.isBadEffect())
{
par3List.add(EnumChatFormatting.RED + s);
} else
{
par3List.add(EnumChatFormatting.GRAY + s);
}
}
} else
{
String s1 = StatCollector.translateToLocal("potion.empty").trim();
par3List.add(EnumChatFormatting.GRAY + s1);
}
if (!hashmultimap.isEmpty())
{
par3List.add("");
par3List.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank"));
iterator = hashmultimap.entries().iterator();
while (iterator.hasNext())
{
Entry entry1 = (Entry) iterator.next();
AttributeModifier attributemodifier2 = (AttributeModifier) entry1.getValue();
double d0 = attributemodifier2.getAmount();
double d1;
if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
{
d1 = attributemodifier2.getAmount();
} else
{
d1 = attributemodifier2.getAmount() * 100.0D;
}
if (d0 > 0.0D)
{
par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[]{ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey())}));
} else if (d0 < 0.0D)
{
d1 *= -1.0D;
par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[]{ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey())}));
}
}
}
}
public boolean isPotionThrowable(ItemStack par1ItemStack)
{
if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getBoolean("throwable"))
{
return true;
} else
{
return false;
}
//return false;
}
public void setIsPotionThrowable(boolean flag, ItemStack par1ItemStack)
{
if (!par1ItemStack.hasTagCompound())
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setBoolean("throwable", flag);
}
public EntityPotion getEntityPotion(ItemStack par1ItemStack, World worldObj, EntityLivingBase entityLivingBase)
{
ItemStack potionStack = new ItemStack(Items.potionitem, 1, 0);
potionStack.setTagCompound(new NBTTagCompound());
ArrayList<PotionEffect> potionList = this.getPotionEffects(par1ItemStack);
if (potionList == null)
{
return null;
}
NBTTagList nbttaglist = new NBTTagList();
for (PotionEffect pe : potionList)
{
NBTTagCompound d = new NBTTagCompound();
d.setByte("Id", (byte) pe.getPotionID());
d.setByte("Amplifier", (byte) pe.getAmplifier());
//byte b1 = par0NBTTagCompound.getByte("Amplifier");
d.setInteger("Duration", pe.getDuration());
//int i = par0NBTTagCompound.getInteger("Duration");
d.setBoolean("Ambient", pe.getIsAmbient());
// boolean flag = par0NBTTagCompound.getBoolean("Ambient");
nbttaglist.appendTag(d);
}
potionStack.stackTagCompound.setTag("CustomPotionEffects", nbttaglist);
EntityPotion entityPotion = new EntityPotion(worldObj, entityLivingBase, potionStack);
return entityPotion;
}
}

View file

@ -0,0 +1,120 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AlchemyReagent extends Item
{
public AlchemyReagent()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setMaxStackSize(64);
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
if (this == ModItems.incendium)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Incendium");
return;
}
if (this == ModItems.magicales)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Magicales");
return;
}
if (this == ModItems.sanctus)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Sanctus");
return;
}
if (this == ModItems.aether)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Aether");
return;
}
if (this == ModItems.simpleCatalyst)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleCatalyst");
return;
}
if (this == ModItems.crepitous)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Crepitous");
return;
}
if (this == ModItems.crystallos)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Crystallos");
return;
}
if (this == ModItems.terrae)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Terrae");
return;
}
if (this == ModItems.aquasalus)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Aquasalus");
return;
}
if (this == ModItems.tennebrae)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Tennebrae");
return;
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AverageLengtheningCatalyst extends LengtheningCatalyst
{
public AverageLengtheningCatalyst()
{
super(2);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AverageLengtheningCatalyst");
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AveragePowerCatalyst extends PowerCatalyst
{
public AveragePowerCatalyst()
{
super(2);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AveragePowerCatalyst");
}
}

View file

@ -0,0 +1,57 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnhancedFillingAgent extends WeakFillingAgent
{
public EnhancedFillingAgent()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public int getFilledAmountForPotionNumber(int potionEffects)
{
Random rand = new Random();
if (potionEffects == 0)
{
return 8;
}
//if(potionEffects >=1 && potionEffects<=5)
{
switch (potionEffects)
{
case 1:
return 6;
case 2:
return 4;
case 3:
return 3;
case 4:
return 2;
case 5:
return 2;
}
}
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnhancedFillingAgent");
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GreaterLengtheningCatalyst extends LengtheningCatalyst
{
public GreaterLengtheningCatalyst()
{
super(3);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GreaterLengtheningCatalyst");
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GreaterPowerCatalyst extends PowerCatalyst
{
public GreaterPowerCatalyst()
{
super(3);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GreaterPowerCatalyst");
}
}

View file

@ -0,0 +1,64 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.ICatalyst;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import java.util.List;
public class LengtheningCatalyst extends Item implements ICatalyst
{
private int catalystStrength;
public LengtheningCatalyst(int catalystStrength)
{
super();
this.catalystStrength = catalystStrength;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public int getCatalystLevel()
{
return catalystStrength;
}
@Override
public boolean isConcentration()
{
return false;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MundaneLengtheningCatalyst extends LengtheningCatalyst
{
public MundaneLengtheningCatalyst()
{
super(1);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MundaneLengtheningCatalyst");
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MundanePowerCatalyst extends PowerCatalyst
{
public MundanePowerCatalyst()
{
super(1);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MundanePowerCatalyst");
}
}

View file

@ -0,0 +1,64 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.ICatalyst;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import java.util.List;
public class PowerCatalyst extends Item implements ICatalyst
{
private int catalystStrength;
public PowerCatalyst(int catalystStrength)
{
super();
this.catalystStrength = catalystStrength;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public int getCatalystLevel()
{
return catalystStrength;
}
@Override
public boolean isConcentration()
{
return true;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
}

View file

@ -0,0 +1,66 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.IBindingAgent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class StandardBindingAgent extends Item implements IBindingAgent
{
public StandardBindingAgent()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public float getSuccessRateForPotionNumber(int potions)
{
return (float) Math.pow(0.65, potions);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:StandardBindingAgent");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
}

View file

@ -0,0 +1,39 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class StandardFillingAgent extends WeakFillingAgent
{
public StandardFillingAgent()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public int getFilledAmountForPotionNumber(int potionEffects)
{
//Random rand = new Random();
if (potionEffects == 0)
{
return 8;
}
if (potionEffects >= 1 && potionEffects <= 3)
{
return (int) (4 * (Math.pow(0.5f, potionEffects - 1) + 0.01f));
}
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:StandardFillingAgent");
}
}

View file

@ -0,0 +1,27 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WeakBindingAgent extends StandardBindingAgent
{
public WeakBindingAgent()
{
super();
// TODO Auto-generated constructor stub
}
@Override
public float getSuccessRateForPotionNumber(int potions)
{
return (float) Math.pow(0.4, potions);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakBindingAgent");
}
}

View file

@ -0,0 +1,85 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import java.util.List;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.common.IFillingAgent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WeakFillingAgent extends Item implements IFillingAgent
{
public WeakFillingAgent()
{
super();
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public int getFilledAmountForPotionNumber(int potionEffects)
{
Random rand = new Random();
if (potionEffects == 0)
{
return 8;
}
if (potionEffects == 1 || potionEffects == 2)
{
if (rand.nextFloat() > 0.5f)
{
return (4 - potionEffects);
} else
{
return 3 - potionEffects;
}
}
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakFillingAgent");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used in alchemy");
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack);
if (recipe != null)
{
par3List.add(EnumChatFormatting.BLUE + "Recipe:");
for (ItemStack item : recipe)
{
if (item != null)
{
par3List.add("" + item.getDisplayName());
}
}
}
} else
{
par3List.add("-Press " + EnumChatFormatting.BLUE + "shift" + EnumChatFormatting.GRAY + " for Recipe-");
}
}
}

View file

@ -0,0 +1,106 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class AirSigil extends EnergyItems implements ArmourUpgrade
{
private int energyUsed;
public AirSigil()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(50);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("I feel lighter already...");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AirSigil");
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
Vec3 vec = par3EntityPlayer.getLookVec();
double wantedVelocity = 1.7;
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost))
{
int i = par3EntityPlayer.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
wantedVelocity += (1 + i) * (0.35);
}
par3EntityPlayer.motionX = vec.xCoord * wantedVelocity;
par3EntityPlayer.motionY = vec.yCoord * wantedVelocity;
par3EntityPlayer.motionZ = vec.zCoord * wantedVelocity;
par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
par3EntityPlayer.fallDistance = 0;
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
} else
{
return par1ItemStack;
}
return par1ItemStack;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player,
ItemStack thisItemStack)
{
// TODO Auto-generated method stub
player.fallDistance = 0;
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 50;
}
}

View file

@ -0,0 +1,96 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DivinationSigil extends Item implements ArmourUpgrade
{
public DivinationSigil()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DivinationSigil");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Peer into the soul to");
par3List.add("get the current essence");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.worldObj.isRemote)
{
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
//PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(ownerName));
int currentEssence = EnergyItems.getCurrentEssence(ownerName);
par3EntityPlayer.addChatMessage(new ChatComponentText("Current Essence: " + EnergyItems.getCurrentEssence(ownerName) + "LP"));
return par1ItemStack;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
// TODO Auto-generated method stub
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9,true));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 25;
}
}

View file

@ -0,0 +1,144 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBloodLightSigil extends EnergyItems
{
private int tickDelay = 100;
public ItemBloodLightSigil()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(10);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
// TODO Auto-generated constructor stub
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("I see a light!");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodLightSigil");
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer);
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
if (par3World.isRemote)
{
return true;
}
if (par7 == 0 && par3World.isAirBlock(par4, par5 - 1, par6))
{
par3World.setBlock(par4, par5 - 1, par6, ModBlocks.blockBloodLight);
}
if (par7 == 1 && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlock(par4, par5 + 1, par6, ModBlocks.blockBloodLight);
}
if (par7 == 2 && par3World.isAirBlock(par4, par5, par6 - 1))
{
par3World.setBlock(par4, par5, par6 - 1, ModBlocks.blockBloodLight);
}
if (par7 == 3 && par3World.isAirBlock(par4, par5, par6 + 1))
{
par3World.setBlock(par4, par5, par6 + 1, ModBlocks.blockBloodLight);
}
if (par7 == 4 && par3World.isAirBlock(par4 - 1, par5, par6))
{
par3World.setBlock(par4 - 1, par5, par6, ModBlocks.blockBloodLight);
}
if (par7 == 5 && par3World.isAirBlock(par4 + 1, par5, par6))
{
par3World.setBlock(par4 + 1, par5, par6, ModBlocks.blockBloodLight);
}
return true;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed() * 5);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityBloodLightProjectile(par2World, par3EntityPlayer, 10));
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (par2World.getWorldTime() % tickDelay == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par3Entity instanceof EntityPlayer)
{
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed());
}
}
return;
}
}

View file

@ -0,0 +1,597 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemFluidSigil extends Item implements IFluidContainerItem
{
private int capacity = 128 * 1000;
private static final int STATE_SYPHON = 0;
private static final int STATE_FORCE_SYPHON = 1;
private static final int STATE_PLACE = 2;
private static final int STATE_INPUT_TANK = 3;
private static final int STATE_DRAIN_TANK = 4;
private static final int maxNumOfStates = 5;
public ItemFluidSigil()
{
super();
this.setMaxDamage(0);
this.setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("A sigil with a lovely affinity for fluids");
if (!(par1ItemStack.stackTagCompound == null))
{
//par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
switch(this.getActionState(par1ItemStack))
{
case STATE_SYPHON:
par3List.add("Syphoning Mode");
break;
case STATE_FORCE_SYPHON:
par3List.add("Force-syphon Mode");
break;
case STATE_PLACE:
par3List.add("Fluid Placement Mode");
break;
case STATE_INPUT_TANK:
par3List.add("Fill Tank Mode");
break;
case STATE_DRAIN_TANK:
par3List.add("Drain Tank Mode");
break;
}
FluidStack fluid = this.getFluid(par1ItemStack);
if(fluid!=null && fluid.amount>0)
{
String str = fluid.getFluid().getName();
int amount = fluid.amount;
par3List.add("" + amount + "mB of " + str);
}else
{
par3List.add("Empty");
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil");
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if(par3EntityPlayer.isSneaking())
{
int curState = this.cycleActionState(par1ItemStack);
this.sendMessageViaState(curState, par3EntityPlayer);
return par1ItemStack;
}
// if(par2World.isRemote)
// {
// return par1ItemStack;
// }
switch(this.getActionState(par1ItemStack))
{
case STATE_SYPHON:
return this.fillItemFromWorld(par1ItemStack, par2World, par3EntityPlayer,false);
case STATE_FORCE_SYPHON:
return this.fillItemFromWorld(par1ItemStack, par2World, par3EntityPlayer,true);
case STATE_PLACE:
return this.emptyItemToWorld(par1ItemStack, par2World, par3EntityPlayer);
case STATE_INPUT_TANK:
return this.fillSelectedTank(par1ItemStack, par2World, par3EntityPlayer);
case STATE_DRAIN_TANK:
return this.drainSelectedTank(par1ItemStack, par2World, par3EntityPlayer);
}
return par1ItemStack;
}
public int getActionState(ItemStack item)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
return item.stackTagCompound.getInteger("actionState");
}
public void setActionState(ItemStack item, int actionState)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
item.stackTagCompound.setInteger("actionState", actionState);
}
public int cycleActionState(ItemStack item)
{
int state = this.getActionState(item);
state++;
if(state>=maxNumOfStates)
{
state = 0;
}
this.setActionState(item, state);
return state;
}
public void sendMessageViaState(int state, EntityPlayer player)
{
if(player.worldObj.isRemote)
{
ChatComponentText cmc = new ChatComponentText("");
switch(state)
{
case STATE_SYPHON:
cmc.appendText("Now in Syphoning Mode");
break;
case STATE_FORCE_SYPHON:
cmc.appendText("Now in Force-syphon Mode");
break;
case STATE_PLACE:
cmc.appendText("Now in Fluid Placement Mode");
break;
case STATE_INPUT_TANK:
cmc.appendText("Now in Fill Tank Mode");
break;
case STATE_DRAIN_TANK:
cmc.appendText("Now in Drain Tank Mode");
break;
}
player.addChatComponentMessage(cmc);
}
}
public ItemStack fillItemFromWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill)
{
float f = 1.0F;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
boolean flag = true;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
if (movingobjectposition == null)
{
return container;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(player, i, j, k))
{
return container;
}
if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container))
{
return container;
}
if (world.getBlock(i, j, k) != null && world.getBlock(i, j, k).getMaterial() instanceof MaterialLiquid)
{
Block block = world.getBlock(i, j, k);
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
if(fluid==null)
{
return container;
}
FluidStack fillStack = new FluidStack(fluid,1000);
int amount = this.fill(container, fillStack, false);
if((amount > 0 && forceFill) || (amount >=1000 && !forceFill))
{
if(!player.capabilities.isCreativeMode)
{
world.setBlockToAir(i, j, k);
}
this.fill(container, new FluidStack(fluid,1000), true);
if (!player.capabilities.isCreativeMode)
{
// if (!EnergyItems.syphonBatteries(container, player, getEnergyUsed()))
// {
// }
}
else
{
return container;
}
}
}
}
return container;
}
}
public ItemStack emptyItemToWorld(ItemStack container, World world, EntityPlayer player)
{
FluidStack simStack = this.drain(container, 1000, false);
if(simStack!=null && simStack.amount>=1000)
{
Block fluidBlock = simStack.getFluid().getBlock();
float f = 1.0F;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
boolean flag = false;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
if (movingobjectposition == null)
{
return container;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(player, i, j, k))
{
return container;
}
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container))
{
return container;
}
if (this.tryPlaceContainedLiquid(world, fluidBlock, d0, d1, d2, i, j, k) && !player.capabilities.isCreativeMode)
{
this.drain(container, 1000, true);
return container;
}
}
return container;
}
}
return container;
}
public boolean tryPlaceContainedLiquid(World par1World, Block block, double par2, double par4, double par6, int par8, int par9, int par10)
{
if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).func_149730_j())
{
return false;
}
else if ((par1World.getBlock(par8, par9, par10).getMaterial() instanceof MaterialLiquid && (par1World.getBlockMetadata(par8, par9, par10) == 0)))
{
return false;
}
else
{
if ((block == Blocks.water || block == Blocks.flowing_water) && par1World.provider.isHellWorld)
{
par1World.playSoundEffect(par2 + 0.5D, par4 + 0.5D, par6 + 0.5D, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
{
par1World.spawnParticle("largesmoke", (double)par8 + Math.random(), (double)par9 + Math.random(), (double)par10 + Math.random(), 0.0D, 0.0D, 0.0D);
}
}
else
{
par1World.setBlock(par8, par9, par10, block, 0, 3);
}
return true;
}
}
public ItemStack fillSelectedTank(ItemStack container, World world, EntityPlayer player)
{
FluidStack fluid = this.getFluid(container);
if(fluid == null)
{
return container;
}
float f = 1.0F;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
boolean flag = false;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
if (movingobjectposition == null)
{
return container;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
TileEntity tile = world.getTileEntity(i, j, k);
if(tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, true);
this.drain(container, amount, true);
}
}
}
return container;
}
public ItemStack drainSelectedTank(ItemStack container, World world, EntityPlayer player)
{
float f = 1.0F;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
boolean flag = false;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
if (movingobjectposition == null)
{
return container;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
TileEntity tile = world.getTileEntity(i, j, k);
if(tile instanceof IFluidHandler)
{
FluidStack fluidAmount = ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), this.getCapacity(container), false);
int amount = this.fill(container, fluidAmount, false);
if(amount>0)
{
((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), this.getCapacity(container), true);
this.fill(container, fluidAmount, true);
}
}
}
}
return container;
}
/* IFluidContainerItem */
@Override
public FluidStack getFluid(ItemStack container)
{
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
{
return null;
}
return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
}
@Override
public int getCapacity(ItemStack container)
{
return capacity;
}
@Override
public int fill(ItemStack container, FluidStack resource, boolean doFill)
{
if (resource == null)
{
return 0;
}
if (!doFill)
{
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
{
return Math.min(capacity, resource.amount);
}
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
if (stack == null || stack.amount <= 0)
{
return Math.min(capacity, resource.amount);
}
if (!stack.isFluidEqual(resource))
{
return 0;
}
return Math.min(capacity - stack.amount, resource.amount);
}
if (container.stackTagCompound == null)
{
container.stackTagCompound = new NBTTagCompound();
}
if (!container.stackTagCompound.hasKey("Fluid"))
{
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
if (capacity < resource.amount)
{
fluidTag.setInteger("Amount", capacity);
container.stackTagCompound.setTag("Fluid", fluidTag);
return capacity;
}
container.stackTagCompound.setTag("Fluid", fluidTag);
return resource.amount;
}
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid");
FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag);
if(stack==null || stack.amount<=0)
{
NBTTagCompound fluidTag1 = resource.writeToNBT(new NBTTagCompound());
if (capacity < resource.amount)
{
fluidTag1.setInteger("Amount", capacity);
container.stackTagCompound.setTag("Fluid", fluidTag1);
return capacity;
}
container.stackTagCompound.setTag("Fluid", fluidTag1);
return resource.amount;
}
if (!stack.isFluidEqual(resource))
{
return 0;
}
int filled = capacity - stack.amount;
if (resource.amount < filled)
{
stack.amount += resource.amount;
filled = resource.amount;
}
else
{
stack.amount = capacity;
}
container.stackTagCompound.setTag("Fluid", stack.writeToNBT(fluidTag));
return filled;
}
@Override
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain)
{
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
{
return null;
}
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid"));
if (stack == null)
{
return null;
}
stack.amount = Math.min(stack.amount, maxDrain);
if (doDrain)
{
if (maxDrain >= capacity)
{
container.stackTagCompound.removeTag("Fluid");
if (container.stackTagCompound.hasNoTags())
{
container.stackTagCompound = null;
}
return stack;
}
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid");
fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain);
container.stackTagCompound.setTag("Fluid", fluidTag);
}
return stack;
}
}

View file

@ -0,0 +1,67 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSeerSigil extends Item implements IHolding
{
public ItemSeerSigil()
{
super();
this.maxStackSize = 1;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SeerSigil");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("When seeing all is not enough");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.worldObj.isRemote)
{
return par1ItemStack;
}
NBTTagCompound itemTag = par1ItemStack.stackTagCompound;
if (itemTag == null || itemTag.getString("ownerName").equals(""))
{
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
return par1ItemStack;
}
}

View file

@ -0,0 +1,171 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSigilOfEnderSeverance extends EnergyItems implements IHolding
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public ItemSigilOfEnderSeverance()
{
super();
this.maxStackSize = 1;
setEnergyUsed(200);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Put those endermen in a Dire situation!");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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()))
{
}
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
List<Entity> list = SpellHelper.getEntitiesInRange(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5);
for(Entity entity : list)
{
if(!entity.equals(par3Entity)&&entity instanceof EntityLiving)
{
((EntityLiving)entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id,5,0));
}
}
}
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
}
return;
}
}

View file

@ -0,0 +1,270 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import javax.swing.Icon;
import net.minecraft.block.Block;
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.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSigilOfSupression extends EnergyItems implements ArmourUpgrade
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int tickDelay = 200;
private int radius = 5;
private int refresh = 100;
public ItemSigilOfSupression()
{
super();
this.maxStackSize = 1;
setEnergyUsed(400);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Better than telekinesis");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if(SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
{
return par1ItemStack;
}
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
if(SpellHelper.isFakePlayer(par2World, (EntityPlayer)par3Entity))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive")&&(!par2World.isRemote))
{
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int x = (int)blockVec.xCoord;
int y = (int)blockVec.yCoord;
int z = (int)blockVec.zCoord;
for (int i = -radius; i <= radius; i++)
{
for (int j = -radius; j <= radius; j++)
{
for(int k = -radius; k <= radius; k++)
{
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
{
continue;
}
Block block = par2World.getBlock(x+i, y+j, z+k);
if(SpellHelper.isBlockFluid(block))
{
if(par2World.getTileEntity(x+i, y+j, z+k)!=null)
{
par2World.setBlockToAir(x+i, y+j, z+k);
}
TESpectralContainer.createSpectralBlockAtLocation(par2World, x+i, y+j, z+k, refresh);
}
else
{
TileEntity tile = par2World.getTileEntity(x+i, y+j, z+k);
if(tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).resetDuration(refresh);
}
}
}
}
}
}
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
}
return;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
Vec3 blockVec = SpellHelper.getEntityBlockVector(player);
int x = (int)blockVec.xCoord;
int y = (int)blockVec.yCoord;
int z = (int)blockVec.zCoord;
for (int i = -radius; i <= radius; i++)
{
for (int j = -radius; j <= radius; j++)
{
for(int k = -radius; k <= radius; k++)
{
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
{
continue;
}
Block block = world.getBlock(x+i, y+j, z+k);
if(SpellHelper.isBlockFluid(block))
{
if(world.getTileEntity(x+i, y+j, z+k)!=null)
{
world.setBlockToAir(x+i, y+j, z+k);
}
TESpectralContainer.createSpectralBlockAtLocation(world, x+i, y+j, z+k, refresh);
}
else
{
TileEntity tile = world.getTileEntity(x+i, y+j, z+k);
if(tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).resetDuration(refresh);
}
}
}
}
}
}
@Override
public boolean isUpgrade()
{
return true;
}
@Override
public int getEnergyForTenSeconds()
{
return 200;
}
}

View file

@ -0,0 +1,310 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LavaSigil extends ItemBucket implements ArmourUpgrade
{
/**
* field for checking if the bucket has been filled.
*/
private Block isFull = Blocks.lava;
private int energyUsed;
public LavaSigil()
{
super(Blocks.lava);
this.maxStackSize = 1;
//setMaxDamage(2000);
setEnergyUsed(1000);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LavaSigil");
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + getEnergyUsed());
copiedStack.stackSize = 1;
return copiedStack;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Contact with liquid is");
par3List.add("highly unrecommended.");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
/**
* 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)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
float f = 1.0F;
double d0 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double) f;
double d1 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double) f + 1.62D - (double) par3EntityPlayer.yOffset;
double d2 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double) f;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
if (movingobjectposition == null)
{
return par1ItemStack;
} else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
{
return par1ItemStack;
}
TileEntity tile = par2World.getTileEntity(i, j, k);
if(tile instanceof IFluidHandler)
{
FluidStack fluid = new FluidStack(FluidRegistry.LAVA,1000);
int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, false);
if(amount>0)
{
((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, true);
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return par1ItemStack;
}
//if (this.isFull == 0)
{
//Empty
} //else
{
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack))
{
return par1ItemStack;
}
if (this.tryPlaceContainedLiquid(par2World, d0, d1, d2, i, j, k) && !par3EntityPlayer.capabilities.isCreativeMode)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
} else
{
return par1ItemStack;
}
}
}
}
return par1ItemStack;
}
}
/**
* Attempts to place the liquid contained inside the bucket.
*/
public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10)
{
//if (this.isFull <= 0)
{
//return false;
} if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid())
{
return false;
} else if ((par1World.getBlock(par8, par9, par10) == Blocks.lava || par1World.getBlock(par8, par9, par10) == Blocks.flowing_lava) && par1World.getBlockMetadata(par8, par9, par10) == 0)
{
return false;
} else
{
par1World.setBlock(par8, par9, par10, this.isFull, 0, 3);
return true;
}
}
protected void setEnergyUsed(int par1int)
{
this.energyUsed = par1int;
}
protected int getEnergyUsed()
{
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.setEntityHealth(player.func_110143_aJ() - 1);
//
// if (player.func_110143_aJ() <= 0)
// {
// player.inventory.dropAllItems();
// }
// }
// }
protected boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if (!player.capabilities.isCreativeMode)
{
boolean usedBattery = false;
IInventory inventory = player.inventory;
for (int slot = 0; slot < inventory.getSizeInventory(); slot++)
{
ItemStack stack = inventory.getStackInSlot(slot);
if (stack == null)
{
continue;
}
if (stack.getItem() instanceof EnergyBattery && !usedBattery)
{
if (stack.getItemDamage() <= stack.getMaxDamage() - damageToBeDone)
{
stack.setItemDamage(stack.getItemDamage() + damageToBeDone);
usedBattery = true;
}
}
}
if (!usedBattery)
{
return false;
}
return true;
} else
{
return true;
}
}
@Override
public void onArmourUpdate(World world, EntityPlayer player,
ItemStack thisItemStack)
{
// TODO Auto-generated method stub
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 9,true));
player.extinguish();
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 100;
}
}

View file

@ -0,0 +1,171 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
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.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfElementalAffinity extends EnergyItems
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public SigilOfElementalAffinity()
{
super();
this.maxStackSize = 1;
setEnergyUsed(200);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Perfect for a fire-breathing fish");
par3List.add("who is afraid of heights!");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfTheFastMiner");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:ElementalSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:ElementalSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive"))
{
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
//Test with added health boost
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
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.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return;
}
}

View file

@ -0,0 +1,302 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockStem;
import net.minecraft.block.IGrowable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.BonemealEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int tickDelay = 100;
public SigilOfGrowth()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(150);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
// TODO Auto-generated constructor stub
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Who needs a green thumb when");
par3List.add("you have a green slate?");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer);
if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer))
{
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
if (par3World.isRemote)
{
par3World.playAuxSFX(2005, par4, par5, par6, 0);
return true;
}
return true;
}
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (par2World.getWorldTime() % tickDelay == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par3Entity instanceof EntityPlayer)
{
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed());
}
int range = 5;
int verticalRange = 2;
int posX = (int) Math.round(par3Entity.posX - 0.5f);
int posY = (int) par3Entity.posY;
int posZ = (int) Math.round(par3Entity.posZ - 0.5f);
for (int ix = posX - range; ix <= posX + range; ix++)
{
for (int iz = posZ - range; iz <= posZ + range; iz++)
{
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++)
{
Block block = par2World.getBlock(ix, iy, iz);
if (block instanceof IPlantable)
{
if (par2World.rand.nextInt(20) == 0)
{
block.updateTick(par2World, ix, iy, iz, par2World.rand);
}
}
}
}
}
}
return;
}
public static boolean applyBonemeal(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_, EntityPlayer player)
{
Block block = p_150919_1_.getBlock(p_150919_2_, p_150919_3_, p_150919_4_);
BonemealEvent event = new BonemealEvent(player, p_150919_1_, block, p_150919_2_, p_150919_3_, p_150919_4_);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if (event.getResult() == Result.ALLOW)
{
if (!p_150919_1_.isRemote)
{
}
return true;
}
if (block instanceof IGrowable)
{
IGrowable igrowable = (IGrowable)block;
if (igrowable.func_149851_a(p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, p_150919_1_.isRemote))
{
if (!p_150919_1_.isRemote)
{
if (igrowable.func_149852_a(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_))
{
igrowable.func_149853_b(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_);
}
}
return true;
}
}
return false;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
int range = 5;
int verticalRange = 2;
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
for (int ix = posX - range; ix <= posX + range; ix++)
{
for (int iz = posZ - range; iz <= posZ + range; iz++)
{
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++)
{
Block block = world.getBlock(ix, iy, iz);
if (block instanceof IPlantable)
{
if (world.rand.nextInt(10) == 0)
{
block.updateTick(world, ix, iy, iz, world.rand);
}
}
}
}
}
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 50;
}
}

View file

@ -0,0 +1,198 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import javax.swing.Icon;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class SigilOfHaste extends EnergyItems implements ArmourUpgrade
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public SigilOfHaste()
{
super();
this.maxStackSize = 1;
//setMaxDamage(100);
setEnergyUsed(250);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("One dose of caffeine later...");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive"))
{
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 2));
//Test with added health boost
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
}
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 205, 1));
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 205, 2));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1,true));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 150;
}
}

View file

@ -0,0 +1,371 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfHolding extends EnergyItems
{
private int invSize = 4;
public static List<ItemStack> allowedSigils = new ArrayList();
public SigilOfHolding()
{
super();
this.maxStackSize = 1;
//setEnergyUsed(100);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfHolding");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (!(stack.stackTagCompound == null))
{
ItemStack[] inv = getInternalInventory(stack);
if (inv == null)
{
return this.itemIcon;
}
ItemStack item = inv[stack.stackTagCompound.getInteger("selectedSlot")];
if (item != null)
{
return item.getIconIndex();
}
}
return this.itemIcon;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Used to hold several Sigils!");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
// par3List.add("Current slot: " + par1ItemStack.stackTagCompound.getInteger("selectedSlot"));
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
{
return;
}
ItemStack item = inv[par1ItemStack.stackTagCompound.getInteger("selectedSlot")];
if (item != null)
{
par3List.add("Current item: " + item.getDisplayName());
}
for (int i = 0; i < invSize; i++)
{
if (inv[i] != null)
{
par3List.add("Item in slot " + i + ": " + inv[i].getDisplayName());
}
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
//TODO Might be a good idea to have this item need to be in the player's first slot
//for it to search and consume sigils on right click. Might avoid confusion? At least
//will avoid the need to add a button just for it...
this.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
if (this.addSigilToInventory(par1ItemStack, par3EntityPlayer))
{
return par1ItemStack;
}
selectNextSlot(par1ItemStack);
return par1ItemStack;
}
int currentSlot = this.getSelectedSlot(par1ItemStack);
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
{
return par1ItemStack;
}
ItemStack itemUsed = inv[currentSlot];
if (itemUsed == null)
{
return par1ItemStack;
}
itemUsed.getItem().onItemRightClick(itemUsed, par2World, par3EntityPlayer);
saveInternalInventory(par1ItemStack, inv);
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par1ItemStack.stackTagCompound == null))
{
this.tickInternalInventory(par1ItemStack, par2World, par3Entity, par4, par5);
}
}
public ItemStack[] getInternalInventory(ItemStack itemStack)
{
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
return null;
}
ItemStack[] inv = new ItemStack[9];
NBTTagList tagList = itemTag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
if (tagList == null)
{
return null;
}
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
int slot = tag.getByte("Slot");
if (slot >= 0 && slot < invSize)
{
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
}
}
return inv;
}
public void saveInternalInventory(ItemStack itemStack, ItemStack[] inventory)
{
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < invSize; i++)
{
ItemStack stack = inventory[i];
if (inventory[i] != null)
{
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("Slot", (byte) i);
inventory[i].writeToNBT(tag);
itemList.appendTag(tag);
}
}
itemTag.setTag("Inventory", itemList);
}
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
{
return;
}
for (int i = 0; i < invSize; i++)
{
if (inv[i] == null)
{
continue;
}
inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5);
}
}
public int getSelectedSlot(ItemStack itemStack)
{
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getInteger("selectedSlot");
}
public void selectNextSlot(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
int filledSlots = 0;
for (int i = 0; i < invSize; i++)
{
if (inv[i] != null)
{
filledSlots++;
} else
{
break;
}
}
NBTTagCompound itemTag = itemStack.stackTagCompound;
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
if (getSelectedSlot(itemStack) + 1 < filledSlots)
{
itemTag.setInteger("selectedSlot", itemTag.getInteger("selectedSlot") + 1);
} else
{
itemTag.setInteger("selectedSlot", 0);
}
}
public boolean hasAddedToInventory(ItemStack sigilItemStack, ItemStack addedItemStack)
{
ItemStack[] inv = getInternalInventory(sigilItemStack);
if (inv == null)
{
return false;
}
if (addedItemStack == null)
{
return false;
}
Item item = addedItemStack.getItem();
int candidateSlot = -1;
for (int i = invSize - 1; i >= 0; i--)
{
ItemStack nextItem = inv[i];
if (nextItem == null)
{
candidateSlot = i;
continue;
}
if (item == nextItem.getItem())
{
return false;
}
}
if (candidateSlot == -1)
{
return false;
}
if(addedItemStack.getItem() instanceof IHolding)
{
inv[candidateSlot] = addedItemStack;
saveInternalInventory(sigilItemStack, inv);
return true;
}
for (ItemStack i : allowedSigils)
{
if (i != null && i.getItem() == item)
{
inv[candidateSlot] = addedItemStack;
saveInternalInventory(sigilItemStack, inv);
return true;
}
}
return false;
}
public boolean addSigilToInventory(ItemStack sigilItemStack, EntityPlayer player)
{
ItemStack[] playerInventory = player.inventory.mainInventory;
for (int i = 0; i < 36; i++)
{
if (this.hasAddedToInventory(sigilItemStack, playerInventory[i]))
{
player.inventory.consumeInventoryItem(playerInventory[i].getItem());
//playerInventory[i].stackSize--;
return true;
}
}
return false;
}
public static void initiateSigilOfHolding()
{
allowedSigils.add(new ItemStack(ModItems.waterSigil));
allowedSigils.add(new ItemStack(ModItems.lavaSigil));
allowedSigils.add(new ItemStack(ModItems.voidSigil));
allowedSigils.add(new ItemStack(ModItems.airSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfTheFastMiner));
allowedSigils.add(new ItemStack(ModItems.divinationSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfElementalAffinity));
allowedSigils.add(new ItemStack(ModItems.growthSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfHaste));
allowedSigils.add(new ItemStack(ModItems.sigilOfWind));
}
public ItemStack getCurrentItem(ItemStack sigilItemStack)
{
ItemStack[] items = this.getInternalInventory(sigilItemStack);
if (items == null)
{
return null;
}
return items[this.getSelectedSlot(sigilItemStack)];
}
}

View file

@ -0,0 +1,222 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int tickDelay = 300;
public SigilOfMagnetism()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(50);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
// TODO Auto-generated constructor stub
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("I have a very magnetic personality!");
// par3List.add("you have a green slate?");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
// @Override
// public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
// {
// EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer);
// if(applyBonemeal(par1ItemStack,par3World,par4,par5,par6,par2EntityPlayer))
// {
// if (par3World.isRemote)
// {
// par3World.playAuxSFX(2005, par4, par5, par6, 0);
// EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
// return true;
// }
// return true;
// }
// return false;
// }
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (par2World.getWorldTime() % tickDelay == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par3Entity instanceof EntityPlayer)
{
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed());
}
int range = 5;
int verticalRange = 5;
float posX = Math.round(par3Entity.posX);
float posY = (float) (par3Entity.posY - par3Entity.getEyeHeight());
float posZ = Math.round(par3Entity.posZ);
List<EntityItem> entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
for (EntityItem entity : entities)
{
if (entity != null && !par2World.isRemote)
{
entity.onCollideWithPlayer(par3EntityPlayer);
}
}
}
return;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
int range = 5;
int verticalRange = 5;
float posX = Math.round(player.posX);
float posY = (float) (player.posY - player.getEyeHeight());
float posZ = Math.round(player.posZ);
List<EntityItem> entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range));
for (EntityItem entity : entities)
{
if (entity != null && !world.isRemote)
{
entity.onCollideWithPlayer(player);
}
}
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 25;
}
}

View file

@ -0,0 +1,312 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import javax.swing.Icon;
import net.minecraft.block.Block;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
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;
public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
private int tickDelay = 200;
public SigilOfTheBridge()
{
super();
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(100);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
// TODO Auto-generated constructor stub
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Activate to create a bridge");
par3List.add("beneath your feet.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
// @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(applyBonemeal(par1ItemStack,par3World,par4,par5,par6,par2EntityPlayer))
// {
// if (par3World.isRemote)
// {
// par3World.playAuxSFX(2005, par4, par5, par6, 0);
// EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
// return true;
// }
// return true;
// }
// return false;
// }
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
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)
{
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
if (par2World.getWorldTime() % tickDelay == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par3Entity instanceof EntityPlayer)
{
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, this.getLPUsed(par1ItemStack));
this.setLPUsed(par1ItemStack, 0);
}
// if(par2World.isRemote)
// {
// return;
// }
if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking())
{
return;
}
int range = 2;
int verticalOffset = -1;
if (par3EntityPlayer.isSneaking())
{
verticalOffset--;
}
if (par2World.isRemote)
{
verticalOffset--;
}
int posX = (int) Math.round(par3Entity.posX - 0.5f);
int posY = (int) par3Entity.posY;
int posZ = (int) Math.round(par3Entity.posZ - 0.5f);
int incremented = 0;
for (int ix = posX - range; ix <= posX + range; ix++)
{
for (int iz = posZ - range; iz <= posZ + range; iz++)
{
//for(int iy=posY-verticalRange;iy<=posY+verticalRange;iy++)
{
Block block = par2World.getBlock(ix, posY + verticalOffset, iz);
if (par2World.isAirBlock(ix, posY + verticalOffset, iz))
{
par2World.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3);
if (par2World.rand.nextInt(2) == 0)
{
incremented++;
}
}
}
}
}
this.incrimentLPUSed(par1ItemStack, incremented);
}
return;
}
public int getLPUsed(ItemStack par1ItemStack)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.stackTagCompound.getInteger("LPUsed");
}
public void incrimentLPUSed(ItemStack par1ItemStack, int addedLP)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setInteger("LPUsed", par1ItemStack.stackTagCompound.getInteger("LPUsed") + addedLP);
}
public void setLPUsed(ItemStack par1ItemStack, int newLP)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.stackTagCompound.setInteger("LPUsed", newLP);
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
if (!player.onGround && !player.isSneaking())
{
return;
}
int range = 2;
int verticalOffset = -1;
if (player.isSneaking())
{
verticalOffset--;
}
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
//int incremented = 0;
for (int ix = posX - range; ix <= posX + range; ix++)
{
for (int iz = posZ - range; iz <= posZ + range; iz++)
{
//for(int iy=posY-verticalRange;iy<=posY+verticalRange;iy++)
{
Block block = world.getBlock(ix, posY + verticalOffset, iz);
if (world.isAirBlock(ix, posY + verticalOffset, iz))
{
world.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3);
}
}
}
}
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 100;
}
}

View file

@ -0,0 +1,194 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
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.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public SigilOfTheFastMiner()
{
super();
this.maxStackSize = 1;
//setMaxDamage(100);
setEnergyUsed(100);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Keep going and going and going...");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfTheFastMiner");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive"))
{
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
//Test with added health boost
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
}
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 3, 1, true));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 50;
}
}

View file

@ -0,0 +1,196 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class SigilOfWind extends EnergyItems implements ArmourUpgrade
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public SigilOfWind()
{
super();
this.maxStackSize = 1;
//setMaxDamage(100);
setEnergyUsed(250);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Best not to wear a skirt.");
if (!(par1ItemStack.stackTagCompound == null))
{
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3List.add("Activated");
} else
{
par3List.add("Deactivated");
}
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_deactivated");
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.stackTagCompound;
if (tag.getBoolean("isActive"))
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 1)
{
return this.activeIcon;
} else
{
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.stackTagCompound;
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive"))
{
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 2));
//Test with added health boost
//par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400,99));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
} else
{
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par3Entity instanceof EntityPlayer))
{
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
}
if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive"))
{
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 205, 1));
//par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 205, 2));
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 3, 1));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 150;
}
}

View file

@ -0,0 +1,195 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class VoidSigil extends ItemBucket implements ArmourUpgrade
{
private int isFull;
private int energyUsed;
public VoidSigil()
{
super(null);
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(50);
isFull = 0;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:VoidSigil");
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Better than a Swiffer!");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + getEnergyUsed());
copiedStack.stackSize = 1;
return copiedStack;
}
protected void setEnergyUsed(int par1int)
{
this.energyUsed = par1int;
}
protected int getEnergyUsed()
{
return this.energyUsed;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
float f = 1.0F;
double d0 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double) f;
double d1 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double) f + 1.62D - (double) par3EntityPlayer.yOffset;
double d2 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double) f;
boolean flag = this.isFull == 0;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
if (movingobjectposition == null)
{
return par1ItemStack;
} else
{
FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, par1ItemStack, par2World, movingobjectposition);
if (MinecraftForge.EVENT_BUS.post(event))
{
return par1ItemStack;
}
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
{
return par1ItemStack;
}
TileEntity tile = par2World.getTileEntity(i, j, k);
if(tile instanceof IFluidHandler)
{
FluidStack amount = ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), 1000, false);
if(amount != null && amount.amount > 0)
{
((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), 1000, true);
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return par1ItemStack;
}
if (this.isFull == 0)
{
if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack))
{
return par1ItemStack;
}
if (par2World.getBlock(i, j, k).getMaterial() instanceof MaterialLiquid)
{
par2World.setBlockToAir(i, j, k);
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
} else
{
return par1ItemStack;
}
}
}
}
return par1ItemStack;
}
}
/**
* Attempts to place the liquid contained inside the bucket.
*/
public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10)
{
return false;
}
@Override
public void onArmourUpdate(World world, EntityPlayer player,
ItemStack thisItemStack)
{
// TODO Auto-generated method stub
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 25;
}
}

View file

@ -0,0 +1,285 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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;
public class WaterSigil extends ItemBucket implements ArmourUpgrade
{
/**
* field for checking if the bucket has been filled.
*/
private Block isFull = Blocks.water;
private int energyUsed;
public WaterSigil()
{
super(Blocks.water);
this.maxStackSize = 1;
//setMaxDamage(1000);
setEnergyUsed(100);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par1ItemStack.stackTagCompound == null)
{
par1ItemStack.setTagCompound(new NBTTagCompound());
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil");
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + 1);
copiedStack.stackSize = 1;
return copiedStack;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Infinite water, anyone?");
if (!(par1ItemStack.stackTagCompound == null))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
/**
* 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)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
float f = 1.0F;
double d0 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double) f;
double d1 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double) f + 1.62D - (double) par3EntityPlayer.yOffset;
double d2 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double) f;
//boolean flag = this.isFull == 0;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
if (movingobjectposition == null)
{
return par1ItemStack;
} else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
{
return par1ItemStack;
}
TileEntity tile = par2World.getTileEntity(i, j, k);
if(tile instanceof IFluidHandler)
{
FluidStack fluid = new FluidStack(FluidRegistry.WATER,1000);
int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, false);
if(amount>0)
{
((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, true);
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
}
}
return par1ItemStack;
}
{
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack))
{
return par1ItemStack;
}
if (this.tryPlaceContainedLiquid(par2World, d0, d1, d2, i, j, k) && !par3EntityPlayer.capabilities.isCreativeMode)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()))
{
}
} else
{
return par1ItemStack;
}
}
}
}
return par1ItemStack;
}
}
/**
* Attempts to place the liquid contained inside the bucket.
*/
public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10)
{
if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid())
{
return false;
} else if ((par1World.getBlock(par8, par9, par10) == Blocks.water || par1World.getBlock(par8, par9, par10) == Blocks.flowing_water) && par1World.getBlockMetadata(par8, par9, par10) == 0)
{
return false;
} else
{
if (par1World.provider.isHellWorld)
{
par1World.playSoundEffect(par2 + 0.5D, par4 + 0.5D, par6 + 0.5D, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
{
par1World.spawnParticle("largesmoke", (double) par8 + Math.random(), (double) par9 + Math.random(), (double) par10 + Math.random(), 0.0D, 0.0D, 0.0D);
}
} else
{
par1World.setBlock(par8, par9, par10, this.isFull, 0, 3);
}
return true;
}
}
protected void setEnergyUsed(int par1int)
{
this.energyUsed = par1int;
}
protected int getEnergyUsed()
{
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.setEntityHealth(player.func_110143_aJ() - 1);
// }
//
// if (player.func_110143_aJ() <= 0)
// {
// player.inventory.dropAllItems();
// }
// }
@Override
public void onArmourUpdate(World world, EntityPlayer player,
ItemStack thisItemStack)
{
// TODO Auto-generated method stub
//PotionEffect effect = new PotionEffect(Potion.waterBreathing.id, 2,9);
player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 9,true));
}
@Override
public boolean isUpgrade()
{
// TODO Auto-generated method stub
return true;
}
@Override
public int getEnergyForTenSeconds()
{
// TODO Auto-generated method stub
return 50;
}
}

View file

@ -0,0 +1,861 @@
package WayofTime.alchemicalWizardry.common.items.spell;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class ItemSpellMultiTool extends Item
{
private static final String harvestLevelSuffix = "harvestLvl";
private static final String digLevelSuffix = "digLvl";
private static final String tagName = "BloodMagicTool";
private Random rand = new Random();
public ItemSpellMultiTool()
{
super();
this.setMaxDamage(0);
this.setMaxStackSize(1);
this.setFull3D();
}
@Override
public void registerIcons (IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundTool");
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
float damage = this.getCustomItemAttack(par1ItemStack);
SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack);
if(parad != null)
{
parad.onLeftClickEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase);
}
damage += parad.getAddedDamageForEntity(par2EntityLivingBase);
if(rand.nextFloat() < this.getCritChance(par1ItemStack))
{
damage *= 1.75f;
}
if(par3EntityLivingBase instanceof EntityPlayer)
{
par2EntityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)par3EntityLivingBase), damage);
}
else
{
par2EntityLivingBase.attackEntityFrom(DamageSource.causeMobDamage(par3EntityLivingBase), damage);
}
return true;
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
SpellParadigmTool parad = this.loadParadigmFromStack(stack);
if(parad != null && entity instanceof EntityLivingBase)
{
parad.onLeftClickEntity(stack, (EntityLivingBase)entity, player);
}
return false;
}
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
if(player.worldObj.isRemote)
{
return false;
}
if (!stack.hasTagCompound())
return false;
World world = player.worldObj;
Block block = player.worldObj.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
// Block block = Block.blocksList[bID];
if (block == null || block == Blocks.air)
return false;
int hlvl = -1;
float blockHardness = block.getBlockHardness(world, x, y, z);
MovingObjectPosition mop = SpellHelper.raytraceFromEntity(world, player, true, 5.0D);
Block localBlock = world.getBlock(x, y, z);
int localMeta = world.getBlockMetadata(x, y, z);
String toolClass = block.getHarvestTool(meta);
if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1)
hlvl = block.getHarvestLevel(meta);
int toolLevel = this.getHarvestLevel(stack, toolClass);
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
{
boolean cancelHarvest = false;
if (!cancelHarvest)
{
if (localBlock != null && !(localHardness < 0))
{
boolean isEffective = false;
String localToolClass = this.getToolClassForMaterial(localBlock.getMaterial());
if(localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta))
{
isEffective = true;
}
if (localBlock.getMaterial().isToolNotRequired())
{
isEffective = true;
}
if (!player.capabilities.isCreativeMode)
{
if (isEffective)
{
if (localBlock.removedByPlayer(world, player, x, y, z))
{
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
}
//localBlock.harvestBlock(world, player, x, y, z, localMeta);
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
if (blockHardness > 0f)
onBlockDestroyed(stack, world, localBlock, x, y, z, player);
List<ItemStack> items = SpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack));
SpellParadigmTool parad = this.loadParadigmFromStack(stack);
List<ItemStack> newItems = parad.handleItemList(stack, items);
if(!world.isRemote)
{
SpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f);
}
world.func_147479_m(x, y, z);
int cost = 0;
cost += parad.digSurroundingArea(stack, world, player, mop, localToolClass, localHardness, toolLevel, this);
cost += parad.onBreakBlock(stack, world, player, localBlock, localMeta, x, y, z, ForgeDirection.getOrientation(mop.sideHit));
if(cost > 0)
{
EnergyItems.syphonAndDamageWhileInContainer(stack, player, cost);
}
}
else
{
world.setBlockToAir(x, y, z);
world.func_147479_m(x, y, z);
}
}
else
{
world.setBlockToAir(x, y, z);
world.func_147479_m(x, y, z);
}
}
}
}
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
return true;
}
public Material[] getMaterialsForToolclass(String toolClass)
{
if("pickaxe".equals(toolClass))
{
return new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits };
}
else if("shovel".equals(toolClass))
{
return new Material[]{ Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
}
else if("axe".equals(toolClass))
{
return new Material[]{ Material.wood, Material.vine, Material.circuits, Material.cactus };
}
return new Material[0];
}
public String getToolClassForMaterial(Material mat)
{
String testString = "pickaxe";
Material[] matList = this.getMaterialsForToolclass(testString);
for(int i=0; i < matList.length; i++)
{
if(matList[i] == mat)
{
return testString;
}
}
testString = "shovel";
matList = this.getMaterialsForToolclass(testString);
for(int i=0; i < matList.length; i++)
{
if(matList[i] == mat)
{
return testString;
}
}
testString = "axe";
matList = this.getMaterialsForToolclass(testString);
for(int i=0; i < matList.length; i++)
{
if(matList[i] == mat)
{
return testString;
}
}
return null;
}
public Set<String> getToolClasses(ItemStack stack)
{
Set<String> set = new HashSet();
if(this.getHarvestLevel(stack, "pickaxe") > -1)
{
set.add("pickaxe");
}
if(this.getHarvestLevel(stack, "axe") > -1)
{
set.add("axe");
}
if(this.getHarvestLevel(stack, "shovel") > -1)
{
set.add("shovel");
}
return set;
}
// @Override
// public boolean onBlockDestroyed (ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player)
// {
// if (block != null && block.getMaterial() == Material.leaves)
// return false;
//
//
// return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
// }
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
String toolClass = block.getHarvestTool(meta);
if(toolClass == null || toolClass.equals(""))
{
return 1.0f;
}
//if (ForgeHooks.isToolEffective(stack, block, meta))
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat(digLevelSuffix + toolClass);
}
else
{
stack.setTagCompound(new NBTTagCompound());
}
}
return 1.0f;
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
if(tag.hasKey(harvestLevelSuffix + toolClass))
{
return tag.getInteger(harvestLevelSuffix + toolClass);
}else
{
return -1;
}
}
else
{
stack.setTagCompound(new NBTTagCompound());
}
return -1;
}
// @Override
// public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_)
// {
// return p_150893_2_.getMaterial() != Material.iron && p_150893_2_.getMaterial() != Material.anvil && p_150893_2_.getMaterial() != Material.rock ? super.func_150893_a(p_150893_1_, p_150893_2_) : 15;
// }
@Override
public boolean canHarvestBlock(Block par1Block, ItemStack itemStack)
{
return true;
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return false;
}
@Override
public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5)
{
if(world.isRemote)
{
return;
}
SpellParadigmTool parad = this.loadParadigmFromStack(toolStack);
int cost = parad.onUpdate(toolStack, world, par3Entity, par4, par5);
if(par3Entity instanceof EntityPlayer && cost > 0)
EnergyItems.syphonAndDamageWhileInContainer(toolStack, (EntityPlayer)par3Entity, cost);
int duration = Math.max(this.getDuration(toolStack, world), 0);
if(duration <= 0 && par3Entity instanceof EntityPlayer)
{
int banishCost = parad.onBanishTool(toolStack, world, par3Entity, par4, par5);
EnergyItems.syphonAndDamageWhileInContainer(toolStack, (EntityPlayer)par3Entity, banishCost);
((EntityPlayer) par3Entity).inventory.mainInventory[par4] = this.getContainedCrystal(toolStack);
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if(par3EntityPlayer.isSneaking())
{
par3EntityPlayer.setCurrentItemOrArmor(0, this.getContainedCrystal(par1ItemStack));
return par1ItemStack;
}
SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack);
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
int cost = 0;
if(mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
cost = parad.onRightClickBlock(par1ItemStack, par3EntityPlayer, par2World, mop);
}else
{
cost = parad.onRightClickAir(par1ItemStack, par2World, par3EntityPlayer);
}
if(cost > 0)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, cost);
}
return par1ItemStack;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Here's a 'Tool Tip' :D");
if (!(par1ItemStack.stackTagCompound == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
for(String str : this.getToolListString(par1ItemStack))
{
par3List.add(str);
}
par3List.add("");
float damage = this.getCustomItemAttack(par1ItemStack);
par3List.add("\u00A79+" + ((int)(damage*10))/10.0f + " " + "Attack Damage");
float critChance = ((int)(this.getCritChance(par1ItemStack)*1000))/10;
par3List.add("\u00A79+" + critChance + "% " + "Crit Chance");
}
}
//--------------Custom methods--------------//
public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1,harvestLevel));
stack.getTagCompound().setTag(tagName, tag);
}
else
{
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1,harvestLevel));
stack.getTagCompound().setTag(tagName, tag);
}
}
public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat(digLevelSuffix + toolClass, digSpeed);
stack.getTagCompound().setTag(tagName, tag);
}
else
{
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat(digLevelSuffix + toolClass, digSpeed);
stack.getTagCompound().setTag(tagName, tag);
}
}
public float getDigSpeed(ItemStack stack, String toolClass)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat(digLevelSuffix + toolClass);
}
else
{
stack.setTagCompound(new NBTTagCompound());
return 0.0f;
}
}
public void setItemAttack(ItemStack stack, float damage)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat("itemAttack", Math.max(damage, 0.0f));
stack.stackTagCompound.setTag(tagName, tag);
}
else
{
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat("itemAttack", Math.max(damage, 0.0f));
stack.stackTagCompound.setTag(tagName, tag);
}
}
public float getCustomItemAttack(ItemStack stack)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat("itemAttack");
}
else
{
stack.setTagCompound(new NBTTagCompound());
return 0.0f;
}
}
public ItemStack getContainedCrystal(ItemStack container)
{
if(container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem");
return ItemStack.loadItemStackFromNBT(tag);
}
else
{
container.setTagCompound(new NBTTagCompound());
return null;
}
}
public void setContainedCrystal(ItemStack container, ItemStack crystal)
{
if(container.hasTagCompound())
{
NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName);
NBTTagCompound tag = compTag.getCompoundTag("heldItem");
crystal.writeToNBT(tag);
compTag.setTag("heldItem", tag);
container.getTagCompound().setTag(tagName, compTag);
}
else
{
container.setTagCompound(new NBTTagCompound());
NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName);
NBTTagCompound tag = compTag.getCompoundTag("heldItem");
crystal.writeToNBT(tag);
compTag.setTag("heldItem", tag);
container.getTagCompound().setTag(tagName, compTag);
}
}
public void setDuration(ItemStack container, World world, int duration)
{
if(world.isRemote)
{
return;
}else
{
World overWorld = DimensionManager.getWorld(0);
long worldtime = overWorld.getTotalWorldTime();
if(container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
container.getTagCompound().setTag(tagName, tag);
}
else
{
container.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
container.getTagCompound().setTag(tagName, tag);
}
}
}
public int getDuration(ItemStack container, World world)
{
if(world.isRemote)
{
return 0;
}
else
{
World overWorld = DimensionManager.getWorld(0);
long worldtime = overWorld.getTotalWorldTime();
if(container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
return (int)(tag.getLong("duration") - worldtime);
}
else
{
container.setTagCompound(new NBTTagCompound());
return 0;
}
}
// if(container.hasTagCompound())
// {
// NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
//
// return tag.getInteger("duration");
// }
// else
// {
// container.setTagCompound(new NBTTagCompound());
//
// return 0;
// }
}
public void loadParadigmIntoStack(ItemStack container, List<SpellEffect> list)
{
if(!container.hasTagCompound())
{
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
NBTTagList effectList = new NBTTagList();
for(SpellEffect eff : list)
{
effectList.appendTag(eff.getTag());
}
tagiest.setTag("Effects", effectList);
container.getTagCompound().setTag(tagName, tagiest);
}
public SpellParadigmTool loadParadigmFromStack(ItemStack container)
{
if(!container.hasTagCompound())
{
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
NBTTagList tagList = tagiest.getTagList("Effects",Constants.NBT.TAG_COMPOUND);
List<SpellEffect> spellEffectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
SpellEffect eff = SpellEffect.getEffectFromTag(tag);
if(eff!=null)
{
spellEffectList.add(eff);
}
}
return SpellParadigmTool.getParadigmForEffectArray(spellEffectList);
}
public void setSilkTouch(ItemStack stack, boolean silkTouch)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setBoolean("silkTouch", silkTouch);
stack.stackTagCompound.setTag(tagName, tag);
}
else
{
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setBoolean("silkTouch", silkTouch);
stack.stackTagCompound.setTag(tagName, tag);
}
}
public boolean getSilkTouch(ItemStack stack)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getBoolean("silkTouch");
}
else
{
stack.setTagCompound(new NBTTagCompound());
return false;
}
}
public void setFortuneLevel(ItemStack stack, int fortune)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger("fortuneLevel", Math.max(fortune, 0));
stack.stackTagCompound.setTag(tagName, tag);
}
else
{
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger("fortuneLevel", Math.max(fortune, 0));
stack.stackTagCompound.setTag(tagName, tag);
}
}
public int getFortuneLevel(ItemStack stack)
{
if(stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getInteger("fortuneLevel");
}
else
{
stack.setTagCompound(new NBTTagCompound());
return 0;
}
}
public List<String> getToolListString(ItemStack container)
{
if(!container.hasTagCompound())
{
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
NBTTagList tagList = tagiest.getTagList("ToolTips",Constants.NBT.TAG_COMPOUND);
List<String> toolTipList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
String str = tag.getString("tip");
if(str!=null)
{
toolTipList.add(str);
}
}
return toolTipList;
}
public void setToolListString(ItemStack container, List<String> toolTipString)
{
if(!container.hasTagCompound())
{
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
NBTTagList stringList = new NBTTagList();
for(String str : toolTipString)
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("tip", str);
stringList.appendTag(tag);
}
tagiest.setTag("ToolTips", stringList);
container.getTagCompound().setTag(tagName, tagiest);
}
public void setCritChance(ItemStack container, float chance)
{
if(container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setFloat("critChance", Math.max(chance, 0));
container.stackTagCompound.setTag(tagName, tag);
}
else
{
container.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setFloat("critChance", Math.max(chance, 0));
container.stackTagCompound.setTag(tagName, tag);
}
}
public float getCritChance(ItemStack container)
{
if(container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
return tag.getFloat("critChance");
}
else
{
container.setTagCompound(new NBTTagCompound());
return 0;
}
}
}

View file

@ -0,0 +1,169 @@
package WayofTime.alchemicalWizardry.common.items.thaumcraft;
import java.util.List;
import javax.swing.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class FocusBase extends EnergyItems //implements IWandFocus
{
protected IIcon ornament, depth;
public FocusBase()
{
super();
setMaxDamage(1);
setNoRepair();
setMaxStackSize(1);
}
boolean hasOrnament()
{
return false;
}
boolean hasDepth()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
super.registerIcons(iconRegister);
// if(hasOrnament())
// {
// ornament = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Orn");
// }
// if(hasDepth())
// {
// depth = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Depth");
// }
}
@Override
public boolean isItemTool(ItemStack par1ItemStack)
{
return true;
}
/*erride
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
AspectList cost = getVisCost();
if (cost != null && cost.size() > 0)
{
par3List.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1"));
for (Aspect aspect : cost.getAspectsSorted())
{
float amount = cost.getAmount(aspect) / 100.0F;
par3List.add(" " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount);
}
}
}
@Override
public int getItemEnchantability()
{
return 5;
}
@Override
public EnumRarity getRarity(ItemStack itemstack)
{
return EnumRarity.rare;
}
@Override
public Icon getOrnament()
{
return ornament;
}
@Override
public Icon getFocusDepthLayerIcon()
{
return depth;
}
@Override
public WandFocusAnimation getAnimation()
{
return WandFocusAnimation.WAVE;
}
@Override
public boolean isVisCostPerTick()
{
return false;
}
public boolean isUseItem()
{
return isVisCostPerTick();
}
@Override
public ItemStack onFocusRightClick(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, MovingObjectPosition paramMovingObjectPosition)
{
if (isUseItem())
{
paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE);
}
return paramItemStack;
}
@Override
public void onUsingFocusTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt)
{
// NO-OP
}
@Override
public void onPlayerStoppedUsingFocus(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt)
{
// NO-OP
}
@Override
public String getSortingHelper(ItemStack paramItemStack)
{
return "00";
}
@Override
public boolean onFocusBlockStartBreak(ItemStack paramItemStack, int paramInt1, int paramInt2, int paramInt3, EntityPlayer paramEntityPlayer)
{
return false;
}
@Override
public boolean acceptsEnchant(int id)
{
if (id == ThaumcraftApi.enchantFrugal ||
id == ThaumcraftApi.enchantPotency)
{
return true;
}
return false;
}
*/
}

View file

@ -0,0 +1,191 @@
package WayofTime.alchemicalWizardry.common.items.thaumcraft;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class FocusBloodBlast extends FocusBase
{
//private static final AspectList visUsage = new AspectList().add(Aspect.AIR, 15).add(Aspect.ENTROPY, 45);
private final int maxCooldown = 7;
public static Map<String,Integer> playerCooldown = new HashMap();
public FocusBloodBlast()
{
super();
this.setUnlocalizedName("focusBloodBlast");
this.setEnergyUsed(100);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
super.registerIcons(iconRegister);
if (hasOrnament())
{
ornament = iconRegister.registerIcon("AlchemicalWizardry:" + "focusBloodBlast" + "Orn");
}
if (hasDepth())
{
depth = iconRegister.registerIcon("AlchemicalWizardry:" + "focusBloodBlast" + "Depth");
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
//super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
if (!(par1ItemStack.stackTagCompound == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
/*
@Override
public void onUsingFocusTick(ItemStack stack, EntityPlayer par3EntityPlayer, int ticks)
{
if (AlchemicalWizardry.isThaumcraftLoaded)
{
Item item = stack.getItem();
Class clazz = item.getClass();
while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting"))
{
if (clazz == Object.class)
{
return;
}
clazz = clazz.getSuperclass();
}
//Item testItem = item.set
//Method consumeAllVis = null;
try
{
if (!playerCooldown.containsKey(par3EntityPlayer.username))
{
playerCooldown.put(par3EntityPlayer.username, 0);
}
Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class);
ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack);
//int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack);
int cooldown = playerCooldown.get(par3EntityPlayer.username) + 1;
playerCooldown.put(par3EntityPlayer.username, cooldown);
if (cooldown >= this.maxCooldown)
{
Method consumeAllVis = clazz.getMethod("consumeAllVis", ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class);
if ((Boolean) consumeAllVis.invoke(item, stack, par3EntityPlayer, getVisCost(), true))
{
playerCooldown.put(par3EntityPlayer.username, 0);
EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer);
World world = par3EntityPlayer.worldObj;
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
this.syphonBatteries(focusStack, par3EntityPlayer, 100);
}
//world.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
world.playSoundAtEntity(par3EntityPlayer, "thaumcraft:wand", 0.5F, 1F);
if (!world.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
world.spawnEntityInWorld(new EnergyBlastProjectile(world, par3EntityPlayer, (int) (5)));
//this.setDelay(par1ItemStack, maxDelay);
}
}
}
} catch (NoSuchMethodException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@Override
public void onPlayerStoppedUsingFocus(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt)
{
playerCooldown.put(paramEntityPlayer.username, 0);
}
@Override
public String getSortingHelper(ItemStack itemstack)
{
return "BLOODBLAST";
}
@Override
public int getFocusColor()
{
return 0x8A0707;
}
@Override
public AspectList getVisCost()
{
return visUsage;
}
@Override
public boolean isVisCostPerTick()
{
return true;
}
@Override
public WandFocusAnimation getAnimation()
{
return WandFocusAnimation.WAVE;
}
boolean hasOrnament()
{
return true;
}
*/
}

View file

@ -0,0 +1,263 @@
package WayofTime.alchemicalWizardry.common.items.thaumcraft;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class FocusGravityWell extends FocusBase
{
//private static final AspectList visUsage = new AspectList().add(Aspect.AIR, 5).add(Aspect.ORDER, 5);
private final int maxCooldown = 1;
public static Map<String,Integer> playerCooldown = new HashMap();
public FocusGravityWell()
{
super();
this.setUnlocalizedName("focusGravityWell");
this.setEnergyUsed(100);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
super.registerIcons(iconRegister);
if (hasOrnament())
{
ornament = iconRegister.registerIcon("AlchemicalWizardry:" + "focusGravityWell" + "Orn");
}
if (hasDepth())
{
depth = iconRegister.registerIcon("AlchemicalWizardry:" + "focusGravityWell" + "Depth");
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
//super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
if (!(par1ItemStack.stackTagCompound == null))
{
if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
{
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
}
}
}
/*
@Override
public void onUsingFocusTick(ItemStack stack, EntityPlayer par3EntityPlayer, int ticks)
{
if (AlchemicalWizardry.isThaumcraftLoaded)
{
Item item = stack.getItem();
Class clazz = item.getClass();
while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting"))
{
if (clazz == Object.class)
{
return;
}
clazz = clazz.getSuperclass();
}
//Item testItem = item.set
//Method consumeAllVis = null;
try
{
if (!playerCooldown.containsKey(par3EntityPlayer.username))
{
playerCooldown.put(par3EntityPlayer.username, 0);
}
Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class);
ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack);
//int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack);
int cooldown = playerCooldown.get(par3EntityPlayer.username) + 1;
playerCooldown.put(par3EntityPlayer.username, cooldown);
//if(cooldown>=this.maxCooldown)
{
Method consumeAllVis = clazz.getMethod("consumeAllVis", ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class);
if ((Boolean) consumeAllVis.invoke(item, stack, par3EntityPlayer, getVisCost(), true))
{
playerCooldown.put(par3EntityPlayer.username, 0);
EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer);
Vec3 vector = par3EntityPlayer.getLookVec();
float distance = 2;
//if(par3EntityPlayer.worldObj.isRemote)
{
List<Entity> entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX + vector.xCoord * distance - 0.5f, par3EntityPlayer.posY + vector.yCoord * distance - 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance - 0.5f, par3EntityPlayer.posX + vector.xCoord * distance + 0.5f, par3EntityPlayer.posY + vector.yCoord * distance + 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance + 0.5f).expand(1, 1, 1));
for (Entity entity : entities)
{
if (entity.getEntityName() == par3EntityPlayer.username)
{
continue;
}
entity.motionX = par3EntityPlayer.posX + vector.xCoord * distance - entity.posX;
entity.motionY = par3EntityPlayer.posY + vector.yCoord * distance - entity.posY;
entity.motionZ = par3EntityPlayer.posZ + vector.zCoord * distance - entity.posZ;
//entity.setVelocity(par3EntityPlayer.posX+vector.xCoord*distance-entity.posX, par3EntityPlayer.posY+vector.yCoord*distance-entity.posY, par3EntityPlayer.posZ+vector.zCoord*distance-entity.posZ);
}
}
World world = par3EntityPlayer.worldObj;
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
this.syphonBatteriesWithoutParticles(focusStack, par3EntityPlayer, 10, false);
}
}
}
} catch (NoSuchMethodException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@Override
public void onPlayerStoppedUsingFocus(ItemStack stack, World paramWorld, EntityPlayer par3EntityPlayer, int paramInt)
{
playerCooldown.put(par3EntityPlayer.username, 0);
if (AlchemicalWizardry.isThaumcraftLoaded)
{
Item item = stack.getItem();
Class clazz = item.getClass();
while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting"))
{
if (clazz == Object.class)
{
return;
}
clazz = clazz.getSuperclass();
}
//Item testItem = item.set
//Method consumeAllVis = null;
try
{
Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class);
ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack);
int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack);
if (potency > 0)
{
EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer);
Vec3 vector = par3EntityPlayer.getLookVec();
float distance = 2;
//if(par3EntityPlayer.worldObj.isRemote)
{
List<Entity> entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX + vector.xCoord * distance - 0.5f, par3EntityPlayer.posY + vector.yCoord * distance - 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance - 0.5f, par3EntityPlayer.posX + vector.xCoord * distance + 0.5f, par3EntityPlayer.posY + vector.yCoord * distance + 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance + 0.5f).expand(1, 1, 1));
for (Entity entity : entities)
{
if (entity.getEntityName() == par3EntityPlayer.username)
{
continue;
}
float speed = 1.0F * potency;
entity.motionX = vector.xCoord * speed;
entity.motionY = vector.yCoord * speed;
entity.motionZ = vector.zCoord * speed;
//entity.setVelocity(par3EntityPlayer.posX+vector.xCoord*distance-entity.posX, par3EntityPlayer.posY+vector.yCoord*distance-entity.posY, par3EntityPlayer.posZ+vector.zCoord*distance-entity.posZ);
}
}
}
} catch (NoSuchMethodException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@Override
public String getSortingHelper(ItemStack itemstack)
{
return "BLOODBLAST";
}
@Override
public int getFocusColor()
{
return 0x8A0707;
}
@Override
public AspectList getVisCost()
{
return visUsage;
}
@Override
public boolean isVisCostPerTick()
{
return true;
}
@Override
public WandFocusAnimation getAnimation()
{
return WandFocusAnimation.WAVE;
}
boolean hasOrnament()
{
return false;
}
*/
}

View file

@ -0,0 +1,103 @@
package WayofTime.alchemicalWizardry.common.items.thaumcraft;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import thaumcraft.api.IGoggles;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.nodes.IRevealer;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGoggles, IVisDiscountGear, IRevealer
{
private static IIcon helmetIcon;
public ItemSanguineArmour()
{
super(AlchemicalWizardry.sanguineArmourArmourMaterial, 4, 0);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
//this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem");
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SanguineHelmet");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
//if(AlchemicalWizardry.isThaumcraftLoaded)
{
if (this == ModItems.sanguineHelmet)
{
return "alchemicalwizardry:models/armor/sanguineArmour_layer_1.png";
}
}
return null;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("A pair of goggles imbued with power");
par3List.add("Vis discount: " + 8 + "%");
}
// @Override
// public boolean showNodes(ItemStack itemstack, EntityLivingBase player)
// {
// return true;
// }
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
{
return;
}
@Override
public boolean isUpgrade()
{
return false;
}
@Override
public int getEnergyForTenSeconds()
{
return 0;
}
@Override
public boolean showNodes(ItemStack itemstack, EntityLivingBase player)
{
return true;
}
@Override
public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect)
{
return 8;
}
@Override
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player)
{
return true;
}
}