mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-28 15:36:06 +00:00
commit source
This commit is contained in:
commit
1381f5b9b4
171 files changed
+7742
No files matched your search
@@ -0,0 +1,73 @@
|
||||
package taintedmagic.common.items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMagicFunguar extends ItemFood
|
||||
{
|
||||
Aspect[] aspects = new Aspect[]{
|
||||
Aspect.AIR,
|
||||
Aspect.EARTH,
|
||||
Aspect.FIRE,
|
||||
Aspect.WATER,
|
||||
Aspect.ORDER,
|
||||
Aspect.ENTROPY };
|
||||
|
||||
public ItemMagicFunguar (int i, float j, boolean k)
|
||||
{
|
||||
super(i, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemMagicFunguar");
|
||||
this.setAlwaysEdible();
|
||||
this.setUnlocalizedName("ItemMagicFunguar");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack s, World w, EntityPlayer p)
|
||||
{
|
||||
super.onFoodEaten(s, w, p);
|
||||
|
||||
Random r = new Random();
|
||||
try
|
||||
{
|
||||
p.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 2));
|
||||
p.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 100, 2));
|
||||
p.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100, 2));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
int i = r.nextInt(aspects.length);
|
||||
|
||||
if (!w.isRemote)
|
||||
{
|
||||
Thaumcraft.proxy.playerKnowledge.addAspectPool(p.getCommandSenderName(), aspects[i], Short.valueOf((short) (1)));
|
||||
ResearchManager.scheduleSave(p);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspects[i].getTag(), Short.valueOf((short) 1), Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), aspects[i]))), (EntityPlayerMP) p);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package taintedmagic.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMaterial extends Item
|
||||
{
|
||||
public int SUBTYPES = 9;
|
||||
public IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemMaterial ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemMaterial");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
int m = s.getItemDamage();
|
||||
switch (m)
|
||||
{
|
||||
case 0 :
|
||||
return EnumRarity.uncommon;
|
||||
case 1 :
|
||||
return EnumRarity.uncommon;
|
||||
case 2 :
|
||||
return EnumRarity.uncommon;
|
||||
case 3 :
|
||||
return EnumRarity.common;
|
||||
case 4 :
|
||||
return EnumRarity.common;
|
||||
case 5 :
|
||||
return TaintedMagic.rarityCreation;
|
||||
case 6 :
|
||||
return EnumRarity.uncommon;
|
||||
case 7 :
|
||||
return EnumRarity.uncommon;
|
||||
case 8 :
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemMaterial" + i);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int i)
|
||||
{
|
||||
return this.icons[i];
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs c, List l)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
l.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack s)
|
||||
{
|
||||
return super.getUnlocalizedName() + "." + s.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package taintedmagic.common.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import taintedmagic.api.RecipeVoidsentBlood;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemVoidsentBlood extends Item
|
||||
{
|
||||
public ItemVoidsentBlood ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemVoidsentBlood");
|
||||
this.setUnlocalizedName("ItemVoidsentBlood");
|
||||
|
||||
GameRegistry.addRecipe(new RecipeVoidsentBlood());
|
||||
RecipeSorter.register("taintedmagic:ItemVoidsentBlood", RecipeVoidsentBlood.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package taintedmagic.common.items.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockShadowOre extends ItemBlock
|
||||
{
|
||||
public ItemBlockShadowOre (Block b)
|
||||
{
|
||||
super(b);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package taintedmagic.common.items.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockWarpwoodSapling extends ItemBlock
|
||||
{
|
||||
public ItemBlockWarpwoodSapling (Block b)
|
||||
{
|
||||
super(b);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package taintedmagic.common.items.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.ItemApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.items.armor.ItemFortressArmor;
|
||||
|
||||
public class ItemShadowFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear, ISpecialArmor
|
||||
{
|
||||
public ItemShadowFortressArmor (ArmorMaterial m, int j, int k)
|
||||
{
|
||||
super(m, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.iconHelm = ir.registerIcon("taintedmagic:ItemShadowFortressHelmet");
|
||||
this.iconChest = ir.registerIcon("taintedmagic:ItemShadowFortressChestplate");
|
||||
this.iconLegs = ir.registerIcon("taintedmagic:ItemShadowFortressLeggings");
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
l.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + getVisDiscount(s, p, null) + "%");
|
||||
super.addInformation(s, p, l, b);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack s, Entity e, int slot, String t)
|
||||
{
|
||||
return "taintedmagic:textures/models/ModelShadowFortressArmor.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack s, EntityPlayer p, Aspect a)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialArmor.ArmorProperties getProperties (EntityLivingBase p, ItemStack s, DamageSource source, double dmg, int slot)
|
||||
{
|
||||
int priority = 0;
|
||||
double ratio = this.damageReduceAmount / 25.0D;
|
||||
|
||||
if (source.isMagicDamage() == true)
|
||||
{
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 35.0D;
|
||||
}
|
||||
else if ( (source.isFireDamage() == true) || (source.isExplosion()))
|
||||
{
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 20.0D;
|
||||
}
|
||||
else if (source.isUnblockable())
|
||||
{
|
||||
priority = 0;
|
||||
ratio = 0.0D;
|
||||
}
|
||||
|
||||
if ( (p instanceof EntityPlayer))
|
||||
{
|
||||
double set = 0.875D;
|
||||
for (int a = 1; a < 4; a++)
|
||||
{
|
||||
ItemStack piece = ((EntityPlayer) p).inventory.armorInventory[a];
|
||||
if ( (piece != null) && ( (piece.getItem() instanceof ItemFortressArmor)))
|
||||
{
|
||||
set += 0.250D;
|
||||
if ( (piece.hasTagCompound()) && (piece.stackTagCompound.hasKey("mask")))
|
||||
{
|
||||
set += 0.05D;
|
||||
}
|
||||
}
|
||||
}
|
||||
ratio *= set;
|
||||
}
|
||||
|
||||
return new ISpecialArmor.ArmorProperties(priority, ratio, s.getMaxDamage() + 1 - s.getItemDamage());
|
||||
}
|
||||
|
||||
public int getArmorDisplay (EntityPlayer p, ItemStack s, int slot)
|
||||
{
|
||||
return this.damageReduceAmount;
|
||||
}
|
||||
|
||||
public void damageArmor (EntityLivingBase e, ItemStack s, DamageSource source, int dmg, int slot)
|
||||
{
|
||||
if (source != DamageSource.fall) s.damageItem(dmg, e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package taintedmagic.common.items.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.ItemApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.common.items.armor.ItemFortressArmor;
|
||||
|
||||
public class ItemVoidFortressArmor extends ItemFortressArmor implements IWarpingGear, IVisDiscountGear
|
||||
{
|
||||
public ItemVoidFortressArmor (ArmorMaterial m, int j, int k)
|
||||
{
|
||||
super(m, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.iconHelm = ir.registerIcon("taintedmagic:ItemVoidFortressHelmet");
|
||||
this.iconChest = ir.registerIcon("taintedmagic:ItemVoidFortressChestplate");
|
||||
this.iconLegs = ir.registerIcon("taintedmagic:ItemVoidFortressLeggings");
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
l.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + getVisDiscount(s, p, null) + "%");
|
||||
super.addInformation(s, p, l, b);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack s, Entity e, int slot, String t)
|
||||
{
|
||||
return "taintedmagic:textures/models/ModelVoidFortressArmor.png";
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return s2.isItemEqual(ItemApi.getItem("itemResource", 16)) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack s, World w, Entity e, int j, boolean k)
|
||||
{
|
||||
super.onUpdate(s, w, e, j, k);
|
||||
|
||||
if ( (!w.isRemote) && (s.isItemDamaged()) && (e.ticksExisted % 20 == 0) && ( (e instanceof EntityLivingBase))) s.damageItem(-1, (EntityLivingBase) e);
|
||||
}
|
||||
|
||||
public void onArmorTick (World w, EntityPlayer p, ItemStack s)
|
||||
{
|
||||
super.onArmorTick(w, p, s);
|
||||
if ( (!w.isRemote) && (s.getItemDamage() > 0) && (p.ticksExisted % 20 == 0)) s.damageItem(-1, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack s, EntityPlayer p, Aspect a)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package taintedmagic.common.items.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.IRunicArmor;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.armor.Hover;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ItemVoidwalkerBoots extends ItemArmor implements IVisDiscountGear, IWarpingGear, IRunicArmor, IRepairable, ISpecialArmor
|
||||
{
|
||||
public ItemVoidwalkerBoots (ArmorMaterial m, int j, int k)
|
||||
{
|
||||
super(m, j, k);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemVoidwalkerBoots");
|
||||
this.setTextureName("taintedmagic:ItemVoidwalkerBoots");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack s, Entity e, int slot, String t)
|
||||
{
|
||||
return "taintedmagic:textures/models/ModelVoidwalkerBoots.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunicCharge (ItemStack s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisDiscount (ItemStack s, EntityPlayer p, Aspect a)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialArmor.ArmorProperties getProperties (EntityLivingBase e, ItemStack s, DamageSource source, double dmg, int slot)
|
||||
{
|
||||
int priority = 0;
|
||||
double ratio = this.damageReduceAmount / 90.0D;
|
||||
|
||||
if (source.isMagicDamage() == true)
|
||||
{
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 80.0D;
|
||||
}
|
||||
else if ( (source.isFireDamage() == true) || (source.isExplosion()))
|
||||
{
|
||||
priority = 1;
|
||||
ratio = this.damageReduceAmount / 80.0D;
|
||||
}
|
||||
else if (source.isUnblockable())
|
||||
{
|
||||
priority = 0;
|
||||
ratio = 0.0D;
|
||||
}
|
||||
return new ISpecialArmor.ArmorProperties(priority, ratio, s.getMaxDamage() + 1 - s.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay (EntityPlayer p, ItemStack s, int slot)
|
||||
{
|
||||
return this.damageReduceAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase e, ItemStack s, DamageSource source, int dmg, int slot)
|
||||
{
|
||||
if (source != DamageSource.fall) s.damageItem(dmg, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack s, World w, Entity e, int j, boolean k)
|
||||
{
|
||||
super.onUpdate(s, w, e, j, k);
|
||||
|
||||
if ( (!w.isRemote) && (s.isItemDamaged()) && (e.ticksExisted % 20 == 0) && ( (e instanceof EntityLivingBase))) s.damageItem(-1, (EntityLivingBase) e);
|
||||
}
|
||||
|
||||
public void onArmorTick (World w, EntityPlayer p, ItemStack s)
|
||||
{
|
||||
super.onArmorTick(w, p, s);
|
||||
if ( (!w.isRemote) && (s.getItemDamage() > 0) && (p.ticksExisted % 20 == 0)) s.damageItem(-1, p);
|
||||
|
||||
if (p.moveForward > 0.0F)
|
||||
{
|
||||
if ( (p.worldObj.isRemote) && (!p.isSneaking()))
|
||||
{
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(Integer.valueOf(p.getEntityId())))
|
||||
{
|
||||
Thaumcraft.instance.entityEventHandler.prevStep.put(Integer.valueOf(p.getEntityId()), Float.valueOf(p.stepHeight));
|
||||
}
|
||||
p.stepHeight = 1.0F;
|
||||
}
|
||||
|
||||
if (p.onGround || p.capabilities.isFlying)
|
||||
{
|
||||
float bonus = 0.20F;
|
||||
p.moveFlying(0.0F, 1.0F, p.capabilities.isFlying ? (bonus - 0.075F) : bonus);
|
||||
p.jumpMovementFactor = 0.00002F;
|
||||
}
|
||||
else if (Hover.getHover(p.getEntityId()))
|
||||
{
|
||||
p.jumpMovementFactor = 0.03F;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
p.jumpMovementFactor = 0.05F;
|
||||
}
|
||||
}
|
||||
if (p.fallDistance > 0.0F) p.fallDistance = 0.0F;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerJumps (LivingEvent.LivingJumpEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
if (player.inventory.armorItemInSlot(0) != null && player.inventory.armorItemInSlot(0).getItem() == ItemRegistry.ItemVoidwalkerBoots)
|
||||
{
|
||||
event.entityLiving.motionY += 0.35D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package taintedmagic.common.items.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IRunicArmor;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.ItemRunic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.armor.Hover;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemVoidwalkerSash extends ItemRunic implements IRunicArmor, IWarpingGear, IBauble
|
||||
{
|
||||
public static final String TAG_MODE = "mode";
|
||||
|
||||
public ItemVoidwalkerSash ()
|
||||
{
|
||||
super(20);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemVoidwalkerSash");
|
||||
this.setMaxDamage(-1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ItemVoidwalkerSash");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunicCharge (ItemStack s)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip (ItemStack s, EntityLivingBase e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip (ItemStack s, EntityLivingBase e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType (ItemStack s)
|
||||
{
|
||||
return BaubleType.BELT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped (ItemStack s, EntityLivingBase e)
|
||||
{
|
||||
Thaumcraft.instance.runicEventHandler.isDirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped (ItemStack s, EntityLivingBase e)
|
||||
{
|
||||
Thaumcraft.instance.runicEventHandler.isDirty = true;
|
||||
}
|
||||
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
l.add("\u00A78" + StatCollector.translateToLocal("text.sash.mode") + (hasSpeedBoost(s) ? " \u00A7a" : " \u00A7c") + StatCollector.translateToLocal(hasSpeedBoost(s) ? "text.sash.on" : "text.sash.off"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick (ItemStack s, EntityLivingBase e)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) e;
|
||||
if ( (p.inventory.armorItemInSlot(0) != null) && (p.inventory.armorItemInSlot(0).getItem() instanceof ItemVoidwalkerBoots))
|
||||
{
|
||||
if (hasSpeedBoost(s))
|
||||
{
|
||||
if (p.moveForward > 0.0F)
|
||||
{
|
||||
if ( (p.worldObj.isRemote) && (!p.isSneaking()))
|
||||
{
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(Integer.valueOf(p.getEntityId())))
|
||||
{
|
||||
Thaumcraft.instance.entityEventHandler.prevStep.put(Integer.valueOf(p.getEntityId()), Float.valueOf(p.stepHeight));
|
||||
}
|
||||
p.stepHeight = 1.0F;
|
||||
}
|
||||
|
||||
if (p.onGround || p.capabilities.isFlying)
|
||||
{
|
||||
float bonus = 0.4F;
|
||||
p.moveFlying(0.0F, 1.0F, p.capabilities.isFlying ? (bonus - 0.050F) : bonus);
|
||||
}
|
||||
else if (Hover.getHover(p.getEntityId()))
|
||||
{
|
||||
p.jumpMovementFactor = 0.015F;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
p.jumpMovementFactor = 0.025F;
|
||||
}
|
||||
}
|
||||
if (p.fallDistance > 0.0F) p.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJump (LivingEvent.LivingJumpEvent event)
|
||||
{
|
||||
if ( (event.entityLiving instanceof EntityPlayer))
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack sash = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
|
||||
ItemStack boots = player.inventory.armorItemInSlot(0);
|
||||
if ( (sash != null) && ( (sash.getItem() instanceof ItemVoidwalkerSash)))
|
||||
{
|
||||
if ( (boots != null) && ( (boots.getItem() instanceof ItemVoidwalkerBoots)))
|
||||
{
|
||||
if (hasSpeedBoost(sash))
|
||||
{
|
||||
player.motionY += 0.15F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack s, World w, EntityPlayer p)
|
||||
{
|
||||
if (!w.isRemote && p.isSneaking())
|
||||
{
|
||||
if (s.stackTagCompound == null)
|
||||
{
|
||||
s.setTagCompound(new NBTTagCompound());
|
||||
s.stackTagCompound.setBoolean(TAG_MODE, false);
|
||||
}
|
||||
if (s.stackTagCompound != null) s.stackTagCompound.setBoolean(TAG_MODE, !s.stackTagCompound.getBoolean(TAG_MODE));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public boolean hasSpeedBoost (ItemStack s)
|
||||
{
|
||||
if (s.stackTagCompound == null) return true;
|
||||
|
||||
else return s.stackTagCompound.getBoolean(TAG_MODE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package taintedmagic.common.items.equipment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IGoggles;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.nodes.IRevealer;
|
||||
import thaumcraft.common.items.armor.ItemGoggles;
|
||||
|
||||
public class ItemWarpedGoggles extends ItemGoggles implements IWarpingGear
|
||||
{
|
||||
public ItemWarpedGoggles (ArmorMaterial m, int j, int k)
|
||||
{
|
||||
super(m, j, k);
|
||||
this.setMaxDamage(500);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemWarpedGoggles");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemWarpedGoggles");
|
||||
}
|
||||
|
||||
public String getArmorTexture (ItemStack s, Entity e, int slot, String type)
|
||||
{
|
||||
return "taintedmagic:textures/models/ModelWarpedGoggles.png";
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import taintedmagic.api.IBloodlust;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemCrystalDagger extends ItemSword implements IBloodlust, IRepairable
|
||||
{
|
||||
public ItemCrystalDagger (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemCrystalDagger");
|
||||
this.setMaxStackSize(1);
|
||||
this.setTextureName("taintedmagic:ItemCrystalDagger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import taintedmagic.client.model.ModelKatana;
|
||||
import taintedmagic.client.model.ModelSaya;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
import thaumcraft.common.config.Config;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemKatana extends Item implements IWarpingGear, IRepairable
|
||||
{
|
||||
public static final int SUBTYPES = 3;
|
||||
|
||||
public static final ResourceLocation textureThaumium = new ResourceLocation("taintedmagic:textures/models/ModelKatanaThaumium.png");
|
||||
public static final ResourceLocation textureVoidmetal = new ResourceLocation("taintedmagic:textures/models/ModelKatanaVoidmetal.png");
|
||||
public static final ResourceLocation textureShadowmetal = new ResourceLocation("taintedmagic:textures/models/ModelKatanaShadowmetal.png");
|
||||
|
||||
public static final ModelKatana katana = new ModelKatana();
|
||||
public static final ModelSaya saya = new ModelSaya();
|
||||
|
||||
public ItemKatana ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemKatana");
|
||||
this.setHasSubtypes(true);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack s, EntityLivingBase e, EntityLivingBase p)
|
||||
{
|
||||
if (!e.worldObj.isRemote && (! (e instanceof EntityPlayer) || ! (p instanceof EntityPlayer) || MinecraftServer.getServer().isPVPEnabled()))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (s.getItemDamage() == 1)
|
||||
{
|
||||
e.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60));
|
||||
e.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120));
|
||||
}
|
||||
if (s.getItemDamage() == 2)
|
||||
{
|
||||
e.addPotionEffect(new PotionEffect(Potion.wither.getId(), 60));
|
||||
e.addPotionEffect(new PotionEffect(Config.potionBlurredID, 120));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
e.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) p), getAttackDamage(s));
|
||||
}
|
||||
p.worldObj.playSoundAtEntity(p, "thaumcraft:swing", 1.0F, 1.0F);
|
||||
|
||||
return super.hitEntity(s, e, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs c, List l)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
l.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack s)
|
||||
{
|
||||
return super.getUnlocalizedName() + "." + s.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
if (s.getItemDamage() == 1) l.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("enchantment.special.sapgreat"));
|
||||
l.add(" ");
|
||||
l.add("\u00A79+" + getAttackDamage(s) + " " + StatCollector.translateToLocal("text.attackdamage"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack s)
|
||||
{
|
||||
return EnumAction.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
public float getAttackDamage (ItemStack s)
|
||||
{
|
||||
switch (s.getItemDamage())
|
||||
{
|
||||
case 0 :
|
||||
return 14.25F;
|
||||
case 1 :
|
||||
return 17.75F;
|
||||
case 2 :
|
||||
return 20.5F;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerRender (RenderPlayerEvent.Specials.Post event)
|
||||
{
|
||||
EntityPlayer p = event.entityPlayer;
|
||||
|
||||
if (event.entityLiving.getActivePotionEffect(Potion.invisibility) != null) return;
|
||||
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
if (p.inventory.getStackInSlot(i) != null && p.inventory.getStackInSlot(i).getItem() == this)
|
||||
{
|
||||
ItemStack s = p.inventory.getStackInSlot(i);
|
||||
|
||||
if (p.getHeldItem() == null || p.getHeldItem().getItem() != this)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glRotatef(55, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
GL11.glTranslatef(-0.6F, 2.25F, 1.25F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(s));
|
||||
katana.render(0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glRotatef(55, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
GL11.glTranslatef(-0.6F, 2.25F, 1.25F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(s));
|
||||
saya.render(0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceLocation getTexture (ItemStack s)
|
||||
{
|
||||
switch (s.getItemDamage())
|
||||
{
|
||||
case 0 :
|
||||
return textureThaumium;
|
||||
case 1 :
|
||||
return textureVoidmetal;
|
||||
case 2 :
|
||||
return textureShadowmetal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return s.getItemDamage() == 0 ? 0 : s.getItemDamage() == 1 ? 3 : 7;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import taintedmagic.api.IBloodlust;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.IWarpingGear;
|
||||
|
||||
public class ItemPrimordialEdge extends ItemSword implements IWarpingGear, IRepairable
|
||||
{
|
||||
public ItemPrimordialEdge (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setTextureName("taintedmagic:ItemPrimordialEdge");
|
||||
this.setUnlocalizedName("ItemPrimordialEdge");
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
}
|
||||
|
||||
public EnumAction getItemUseAction (ItemStack s)
|
||||
{
|
||||
return EnumAction.block;
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
public boolean hitEntity (ItemStack s, EntityLivingBase e, EntityLivingBase p)
|
||||
{
|
||||
super.hitEntity(s, e, p);
|
||||
|
||||
try
|
||||
{
|
||||
e.addPotionEffect(new PotionEffect(Potion.wither.id, 5, 1));
|
||||
e.addPotionEffect(new PotionEffect(Potion.weakness.id, 5, 1));
|
||||
p.worldObj.playSoundAtEntity(p, "thaumcraft:swing", 1.0F, 1.0F);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack s, World w, EntityPlayer p)
|
||||
{
|
||||
p.setItemInUse(s, this.getMaxItemUseDuration(s));
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick (ItemStack s, EntityPlayer p, int count)
|
||||
{
|
||||
Iterator i$;
|
||||
|
||||
List ents = p.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(p.posX, p.posY, p.posZ, p.posX + 1, p.posY + 1, p.posZ + 1).expand(15.0D, 15.0D, 15.0D));
|
||||
|
||||
p.worldObj.playSoundAtEntity(p, "thaumcraft:brain", 0.05F, 0.5F);
|
||||
if ( (ents != null) && (ents.size() > 0)) for (i$ = ents.iterator(); i$.hasNext();)
|
||||
{
|
||||
Object ent = i$.next();
|
||||
Entity eo = (Entity) ent;
|
||||
|
||||
if (eo != p)
|
||||
{
|
||||
if ( (eo.isEntityAlive()) && (!eo.isEntityInvulnerable()))
|
||||
{
|
||||
double d = pointDistanceSpace(eo.posX, eo.posY, eo.posZ, p);
|
||||
if (d < 2.0D)
|
||||
{
|
||||
eo.attackEntityFrom(DamageSource.magic, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
double var3 = (p.posX + 0.5D - eo.posX) / 20.0D;
|
||||
double var5 = (p.posY + 0.5D - eo.posY) / 20.0D;
|
||||
double var7 = (p.posZ + 0.5D - eo.posZ) / 20.0D;
|
||||
double var9 = Math.sqrt(var3 * var3 + var5 * var5 + var7 * var7);
|
||||
double var11 = 1.0D - var9;
|
||||
|
||||
if (var11 > 0.0D)
|
||||
{
|
||||
var11 *= var11;
|
||||
eo.motionX += var3 / var9 * var11 * 0.20D;
|
||||
eo.motionY += var5 / var9 * var11 * 0.30D;
|
||||
eo.motionZ += var7 / var9 * var11 * 0.20D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate (ItemStack s, World w, Entity e, int i, boolean b)
|
||||
{
|
||||
if ( (!w.isRemote) && (s.isItemDamaged()) && (e.ticksExisted % 20 == 0))
|
||||
{
|
||||
s.damageItem(-1, (EntityLivingBase) e);
|
||||
}
|
||||
}
|
||||
|
||||
public double pointDistanceSpace (double x, double y, double z, EntityPlayer p)
|
||||
{
|
||||
double xvar = p.posX + 0.5D - x;
|
||||
double yvar = p.posY + 0.5D - y;
|
||||
double zvar = p.posZ + 0.5D - z;
|
||||
return xvar * xvar + yvar * yvar + zvar * zvar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
l.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("text.eldritchsapping"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWarp (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemShadowmetalAxe extends ItemAxe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalAxe (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalAxe");
|
||||
this.setUnlocalizedName("ItemShadowmetalAxe");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ItemShadowmetalHoe extends ItemHoe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalHoe (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalHoe");
|
||||
this.setUnlocalizedName("ItemShadowmetalHoe");
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack s, EntityPlayer p, World w, int x, int y, int z, int i, float a, float b, float c)
|
||||
{
|
||||
super.onItemUse(s, p, w, x, y, z, i, a, b, c);
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
Block block = Blocks.dirt;
|
||||
|
||||
if (p.worldObj.getBlock(x, y, z) == Blocks.farmland)
|
||||
{
|
||||
p.worldObj.setBlock(x, y, z, Blocks.dirt);
|
||||
s.damageItem(1, p);
|
||||
w.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getStepResourcePath(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
}
|
||||
else if (p.worldObj.getBlock(x, y, z) == Blocks.dirt || p.worldObj.getBlock(x, y, z) == Blocks.grass)
|
||||
{
|
||||
p.worldObj.setBlock(x, y, z, Blocks.farmland);
|
||||
s.damageItem(1, p);
|
||||
w.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getStepResourcePath(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
}
|
||||
}
|
||||
if (p.worldObj.getBlock(x, y, z) == Blocks.dirt || p.worldObj.getBlock(x, y, z) == Blocks.grass || p.worldObj.getBlock(x, y, z) == Blocks.farmland) p.swingItem();
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void useHoe (UseHoeEvent event)
|
||||
{
|
||||
if (event.current.getItem() == ItemRegistry.ItemShadowmetalHoe)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemShadowmetalPick extends ItemPickaxe implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalPick (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalPick");
|
||||
this.setUnlocalizedName("ItemShadowmetalPick");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemShadowmetalSpade extends ItemSpade implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalSpade (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalSpade");
|
||||
this.setUnlocalizedName("ItemShadowmetalSpade");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
public class ItemShadowmetalSword extends ItemSword implements IRepairable
|
||||
{
|
||||
public ItemShadowmetalSword (ToolMaterial m)
|
||||
{
|
||||
super(m);
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setTextureName("taintedmagic:ItemShadowmetalSword");
|
||||
this.setUnlocalizedName("ItemShadowmetalSword");
|
||||
}
|
||||
|
||||
public boolean getIsRepairable (ItemStack s, ItemStack s2)
|
||||
{
|
||||
return (s2.isItemEqual(new ItemStack(ItemRegistry.ItemMaterial)) && s2.getItemDamage() == 0) ? true : super.getIsRepairable(s, s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package taintedmagic.common.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
|
||||
public class ItemThaumicDisassembler extends Item
|
||||
{
|
||||
public static final String TAG_MODE = "mode";
|
||||
|
||||
public ItemThaumicDisassembler ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setMaxDamage(500);
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("ItemThaumicDisassembler");
|
||||
this.setTextureName("taintedmagic:ItemThaumicDisassembler");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock (Block b, ItemStack s)
|
||||
{
|
||||
return b != Blocks.bedrock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
super.addInformation(s, p, l, b);
|
||||
|
||||
l.add(StatCollector.translateToLocal("text.mode") + ": " + EnumChatFormatting.BLUE + getModeName(s));
|
||||
l.add(StatCollector.translateToLocal("text.efficiency") + ": " + EnumChatFormatting.BLUE + getEfficiency(s));
|
||||
l.add(" ");
|
||||
l.add(EnumChatFormatting.BLUE + "+20 " + StatCollector.translateToLocal("text.attackdamage"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack s, EntityLivingBase e, EntityLivingBase p)
|
||||
{
|
||||
e.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) p), 20);
|
||||
s.damageItem(2, p);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack s, Block b, int meta)
|
||||
{
|
||||
return getEfficiency(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack s, World w, Block b, int x, int y, int z, EntityLivingBase e)
|
||||
{
|
||||
if (b.getBlockHardness(w, x, y, z) != 0.0D) s.damageItem(1, e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack s, int x, int y, int z, EntityPlayer p)
|
||||
{
|
||||
super.onBlockStartBreak(s, x, y, z, p);
|
||||
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
Block block = p.worldObj.getBlock(x, y, z);
|
||||
int meta = p.worldObj.getBlockMetadata(x, y, z);
|
||||
|
||||
if (block == Blocks.lit_redstone_ore)
|
||||
{
|
||||
block = Blocks.redstone_ore;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, meta);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack s, World w, EntityPlayer p)
|
||||
{
|
||||
if (!w.isRemote && p.isSneaking()) toggleMode(s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public int getEfficiency (ItemStack s)
|
||||
{
|
||||
switch (getMode(s))
|
||||
{
|
||||
case 0 :
|
||||
return 20;
|
||||
case 1 :
|
||||
return 8;
|
||||
case 2 :
|
||||
return 128;
|
||||
case 3 :
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getMode (ItemStack s)
|
||||
{
|
||||
if (s.stackTagCompound == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return s.stackTagCompound.getInteger(TAG_MODE);
|
||||
}
|
||||
|
||||
public String getModeName (ItemStack s)
|
||||
{
|
||||
int mode = getMode(s);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0 :
|
||||
return StatCollector.translateToLocal("text.disassembler.normal");
|
||||
case 1 :
|
||||
return StatCollector.translateToLocal("text.disassembler.slow");
|
||||
case 2 :
|
||||
return StatCollector.translateToLocal("text.disassembler.fast");
|
||||
case 3 :
|
||||
return StatCollector.translateToLocal("text.disassembler.off");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void toggleMode (ItemStack s)
|
||||
{
|
||||
if (s.stackTagCompound == null) s.setTagCompound(new NBTTagCompound());
|
||||
|
||||
s.stackTagCompound.setInteger(TAG_MODE, getMode(s) < 3 ? getMode(s) + 1 : 0);
|
||||
}
|
||||
|
||||
public void onUpdate (ItemStack s, World w, Entity e, int i, boolean b)
|
||||
{
|
||||
super.onUpdate(s, w, e, i, b);
|
||||
if (e instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) e;
|
||||
if ( (!w.isRemote) && (s.isItemDamaged()) && (e.ticksExisted % 20 == 0))
|
||||
{
|
||||
if (WandManager.consumeVisFromInventory(p, new AspectList().add(Aspect.ENTROPY, 5)))
|
||||
{
|
||||
s.damageItem(-1, (EntityLivingBase) e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.entities.EntityEldritchOrbAttack;
|
||||
import taintedmagic.common.entities.EntityTaintBubble;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.entities.monster.EntityEldritchGuardian;
|
||||
import thaumcraft.common.entities.projectile.EntityEldritchOrb;
|
||||
import thaumcraft.common.entities.projectile.EntityEmber;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.misc.PacketMiscEvent;
|
||||
|
||||
public class ItemFocusEldritch extends ItemFocusBasic
|
||||
{
|
||||
public static FocusUpgradeType sanity = new FocusUpgradeType(57, new ResourceLocation("taintedmagic", "textures/foci/IconSanity.png"), "focus.upgrade.sanity.name", "focus.upgrade.sanity.text", new AspectList().add(Aspect.MIND, 1).add(Aspect.HEAL, 1));
|
||||
IIcon depthIcon = null;
|
||||
|
||||
private static final AspectList costBase = new AspectList().add(Aspect.ENTROPY, 20).add(Aspect.FIRE, 20);
|
||||
private static final AspectList costSane = new AspectList().add(Aspect.ENTROPY, 20).add(Aspect.FIRE, 50).add(Aspect.ORDER, 20);
|
||||
private static final AspectList costCorrosive = new AspectList().add(Aspect.ENTROPY, 50).add(Aspect.FIRE, 20).add(Aspect.WATER, 20);
|
||||
|
||||
long soundDelay = 0L;
|
||||
|
||||
public ItemFocusEldritch ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusEldritch");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusEldritch");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusEldritch_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "AM" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 0x000018;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return isUpgradedWith(s, ItemFocusTaint.corrosive) ? costCorrosive : isUpgradedWith(s, sanity) ? costSane : costBase;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return 600;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
|
||||
if (!w.isRemote)
|
||||
{
|
||||
int potency = wand.getFocusPotency(s);
|
||||
if (wand.consumeAllVis(s, p, getVisCost(s), true, false))
|
||||
{
|
||||
EntityEldritchOrbAttack orb = null;
|
||||
orb = new EntityEldritchOrbAttack(w, p, isUpgradedWith(wand.getFocusItem(s), ItemFocusTaint.corrosive));
|
||||
orb.dmg = (10F + potency);
|
||||
w.spawnEntityInWorld(orb);
|
||||
if (!isUpgradedWith(wand.getFocusItem(s), sanity))
|
||||
{
|
||||
Random rand = new Random();
|
||||
int randomInt = rand.nextInt(10);
|
||||
if (randomInt == 5)
|
||||
{
|
||||
Thaumcraft.addStickyWarpToPlayer(p, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
w.playSoundAtEntity(p, "thaumcraft:egattack", 0.4F, 1.0F + w.rand.nextFloat() * 0.1F);
|
||||
}
|
||||
p.swingItem();
|
||||
return s;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack s, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
ItemFocusTaint.corrosive };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
this.sanity };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
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.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFocusMageMace extends ItemFocusBasic
|
||||
{
|
||||
public IIcon depthIcon = null;
|
||||
public IIcon ornIcon = null;
|
||||
|
||||
public int dmg;
|
||||
|
||||
public static FocusUpgradeType bloodlust = new FocusUpgradeType(58, new ResourceLocation("taintedmagic", "textures/misc/IconBloodlust.png"), "focus.upgrade.bloodlust.name", "focus.upgrade.bloodlust.text", new AspectList().add(Aspect.WEAPON, 1).add(Aspect.HEAL, 1));
|
||||
public static final AspectList costBase = new AspectList().add(Aspect.ENTROPY, 50);
|
||||
public static final AspectList costBloodlust = new AspectList().add(Aspect.ENTROPY, 50).add(Aspect.ORDER, 20).add(Aspect.FIRE, 50);
|
||||
|
||||
public ItemFocusMageMace ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusMageMace");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusMageMace");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusMageMace_depth");
|
||||
this.ornIcon = ir.registerIcon("taintedmagic:ItemFocusMageMace_orn");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public IIcon getOrnament (ItemStack s)
|
||||
{
|
||||
return this.ornIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "MM" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 3289650;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return this.isUpgradedWith(s, bloodlust) ? this.costBloodlust : this.costBase;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
super.addInformation(s, p, l, b);
|
||||
l.add(" ");
|
||||
l.add(EnumChatFormatting.BLUE + "+" + new String(this.isUpgradedWith(s, FocusUpgradeType.potency) ? Integer.toString(15 + this.getUpgradeLevel(s, FocusUpgradeType.potency)) : "15") + " " + StatCollector.translateToLocal("text.attackdamageequipped"));
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack s, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
this.bloodlust };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canApplyUpgrade (ItemStack s, EntityPlayer p, FocusUpgradeType t, int rank)
|
||||
{
|
||||
return (!t.equals(this.bloodlust)) || (ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "BLOODLUSTUPGRADE"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.entities.EntityTaintBubble;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.entities.projectile.EntityEmber;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
|
||||
public class ItemFocusMeteorology extends ItemFocusBasic
|
||||
{
|
||||
IIcon depthIcon = null;
|
||||
|
||||
private static final AspectList costBase = new AspectList().add(Aspect.AIR, 1000).add(Aspect.WATER, 1000).add(Aspect.FIRE, 1000).add(Aspect.EARTH, 1000).add(Aspect.ORDER, 1000).add(Aspect.ENTROPY, 1000);
|
||||
|
||||
public ItemFocusMeteorology ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusMeteorology");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusMeteorology");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusMeteorology_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "WT" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 0x23D9EA;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return new AspectList().add(Aspect.AIR, 1000).add(Aspect.WATER, 1000).add(Aspect.FIRE, 1000).add(Aspect.EARTH, 1000).add(Aspect.ORDER, 1000).add(Aspect.ENTROPY, 1000);
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
WandManager.setCooldown(p, 30000);
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
wand.consumeAllVis(s, p, getVisCost(s), true, false);
|
||||
|
||||
w.getWorldInfo().setRainTime(w.isRaining() ? 24000 : 0);
|
||||
w.getWorldInfo().setRaining(!w.isRaining());
|
||||
|
||||
p.playSound("thaumcraft:wand", 0.5F, 1.0F);
|
||||
return s;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.entities.EntityTaintBubble;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.entities.projectile.EntityEmber;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
|
||||
public class ItemFocusTaint extends ItemFocusBasic
|
||||
{
|
||||
public static FocusUpgradeType tainturgy = new FocusUpgradeType(55, new ResourceLocation("taintedmagic", "textures/foci/IconTainturgy.png"), "focus.upgrade.tainturgy.name", "focus.upgrade.tainturgy.text", new AspectList().add(Aspect.TAINT, 1).add(Aspect.HEAL, 1));
|
||||
public static FocusUpgradeType corrosive = new FocusUpgradeType(56, new ResourceLocation("taintedmagic", "textures/foci/IconCorrosive.png"), "focus.upgrade.corrosive.name", "focus.upgrade.corrosive.text", new AspectList().add(Aspect.TAINT, 1).add(Aspect.POISON, 1));
|
||||
IIcon depthIcon = null;
|
||||
|
||||
private static final AspectList costBase = new AspectList().add(Aspect.EARTH, 10).add(Aspect.WATER, 10);
|
||||
private static final AspectList costTainturgist = new AspectList().add(Aspect.EARTH, 10).add(Aspect.WATER, 10).add(Aspect.ORDER, 10);
|
||||
|
||||
public ItemFocusTaint ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusTaint");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusTaint");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusTaint_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "BM" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 8073200;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return isUpgradedWith(s, tainturgy) ? costTainturgist : costBase;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
p.setItemInUse(s, 2147483647);
|
||||
WandManager.setCooldown(p, -1);
|
||||
return s;
|
||||
}
|
||||
|
||||
public void onUsingFocusTick (ItemStack s, EntityPlayer p, int count)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
if (!wand.consumeAllVis(s, p, getVisCost(s), false, false))
|
||||
{
|
||||
p.stopUsingItem();
|
||||
return;
|
||||
}
|
||||
int range = 8;
|
||||
Vec3 vec3d = p.getLook(range);
|
||||
if (!p.worldObj.isRemote && p.ticksExisted % 20 == 0) p.worldObj.playSoundAtEntity(p, "thaumcraft:bubble", 0.33F, 2.0F);
|
||||
|
||||
int potency = wand.getFocusPotency(s);
|
||||
if ( (!p.worldObj.isRemote) && (wand.consumeAllVis(s, p, getVisCost(s), true, false)))
|
||||
{
|
||||
float scatter = isUpgradedWith(wand.getFocusItem(s), FocusUpgradeType.enlarge) ? 15.0F : 8.0F;
|
||||
for (int a = 0; a < 2 + wand.getFocusPotency(s); a++)
|
||||
{
|
||||
EntityTaintBubble orb = new EntityTaintBubble(p.worldObj, p, scatter, isUpgradedWith(wand.getFocusItem(s), this.corrosive));
|
||||
orb.posX += orb.motionX;
|
||||
orb.posY += orb.motionY;
|
||||
orb.posZ += orb.motionZ;
|
||||
orb.damage = 5F + potency;
|
||||
p.worldObj.spawnEntityInWorld(orb);
|
||||
if (!isUpgradedWith(wand.getFocusItem(s), tainturgy))
|
||||
{
|
||||
Random rand = new Random();
|
||||
int randomInt = rand.nextInt(150);
|
||||
if (randomInt == 9)
|
||||
{
|
||||
try
|
||||
{
|
||||
p.addPotionEffect(new PotionEffect(Config.potionVisExhaustID, 1000, 2));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack s, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
tainturgy };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
FocusUpgradeType.enlarge };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.potency,
|
||||
corrosive };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
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.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.entities.EntityEldritchOrbAttack;
|
||||
import taintedmagic.common.helper.Vector3;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.entities.projectile.EntityPrimalOrb;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.fx.PacketFXSonic;
|
||||
|
||||
public class ItemFocusTaintedBlast extends ItemFocusBasic
|
||||
{
|
||||
private static final AspectList costBase = new AspectList().add(Aspect.ENTROPY, 500).add(Aspect.EARTH, 500).add(Aspect.WATER, 500);
|
||||
|
||||
public static IIcon depthIcon;
|
||||
public static IIcon ornIcon;
|
||||
|
||||
public ItemFocusTaintedBlast ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusTaintedBlast");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusTaintedBlast");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusTaint_depth");
|
||||
this.ornIcon = ir.registerIcon("taintedmagic:ItemFocusTaintedBlast_orn");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public IIcon getOrnament (ItemStack s)
|
||||
{
|
||||
return this.ornIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "TB" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 13107455;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return costBase;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return 15000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
super.addInformation(s, p, l, b);
|
||||
l.add(" ");
|
||||
l.add(EnumChatFormatting.BLUE + "+" + new String(this.isUpgradedWith(s, FocusUpgradeType.enlarge) ? Integer.toString(15 + this.getUpgradeLevel(s, FocusUpgradeType.enlarge)) : "15") + " " + StatCollector.translateToLocal("text.radius"));
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
Iterator i$;
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
|
||||
int potency = wand.getFocusPotency(s);
|
||||
if (wand.consumeAllVis(s, p, getVisCost(s), true, false))
|
||||
{
|
||||
List entities = p.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(p.posX, p.posY, p.posZ, p.posX + 1, p.posY + 1, p.posZ + 1).expand(15.0D + this.getUpgradeLevel(s, FocusUpgradeType.enlarge), 15.0D + this.getUpgradeLevel(s, FocusUpgradeType.enlarge), 15.0D + this.getUpgradeLevel(s, FocusUpgradeType.enlarge)));
|
||||
if ( (entities != null) && (entities.size() > 0)) for (i$ = entities.iterator(); i$.hasNext();)
|
||||
{
|
||||
Object ent = i$.next();
|
||||
Entity eo = (Entity) ent;
|
||||
|
||||
if (eo != p)
|
||||
{
|
||||
if (eo.isEntityAlive() && !eo.isEntityInvulnerable())
|
||||
{
|
||||
double d = getDistanceTo(eo.posX, eo.posY, eo.posZ, p);
|
||||
if (d < 7.0D)
|
||||
{
|
||||
eo.attackEntityFrom(DamageSource.magic, 2.0F);
|
||||
}
|
||||
}
|
||||
Vector3 movement = getDistanceBetween(eo, p);
|
||||
eo.addVelocity(movement.x * 3, 0.8, movement.z * 3);
|
||||
}
|
||||
}
|
||||
w.playSoundAtEntity(p, "taintedmagic:shockwave", 5.0F, 1.0F * (float) Math.random());
|
||||
TaintedMagic.proxy.spawnShockwaveParticles(p.worldObj);
|
||||
return s;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Vector3 getDistanceBetween (Entity e, Entity e2)
|
||||
{
|
||||
Vector3 fromPosition = new Vector3(e.posX, e.posY, e.posZ);
|
||||
Vector3 toPosition = new Vector3(e2.posX, e2.posY, e2.posZ);
|
||||
Vector3 dist = fromPosition.sub(toPosition);
|
||||
dist.normalize();
|
||||
return dist;
|
||||
|
||||
}
|
||||
|
||||
public static double getDistanceTo (double x, double y, double z, EntityPlayer p)
|
||||
{
|
||||
double var7 = p.posX + 0.5D - x;
|
||||
double var9 = p.posY + 0.5D - y;
|
||||
double var11 = p.posZ + 0.5D - z;
|
||||
return var7 * var7 + var9 * var9 + var11 * var11;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack s, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.enlarge };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.enlarge };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.enlarge };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.enlarge };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{
|
||||
FocusUpgradeType.frugal,
|
||||
FocusUpgradeType.enlarge };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
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.world.World;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.items.wands.WandManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFocusTime extends ItemFocusBasic
|
||||
{
|
||||
IIcon depthIcon = null;
|
||||
|
||||
private static final AspectList costBase = new AspectList().add(Aspect.AIR, 1000).add(Aspect.WATER, 1000).add(Aspect.FIRE, 1000).add(Aspect.EARTH, 1000).add(Aspect.ORDER, 1000).add(Aspect.ENTROPY, 1000);
|
||||
|
||||
public ItemFocusTime ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusTime");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusTime");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusMeteorology_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "TI" + super.getSortingHelper(s);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
|
||||
return player == null ? 0xFFFFFF : Color.HSBtoRGB(player.ticksExisted * 16 % 360 / 360F, 1F, 1F);
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return new AspectList().add(Aspect.AIR, 1000).add(Aspect.WATER, 1000).add(Aspect.FIRE, 1000).add(Aspect.EARTH, 1000).add(Aspect.ORDER, 1000).add(Aspect.ENTROPY, 1000);
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
WandManager.setCooldown(p, 30000);
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
|
||||
wand.consumeAllVis(s, p, getVisCost(s), true, false);
|
||||
|
||||
w.setWorldTime(w.isDaytime() ? 14000 : 0);
|
||||
|
||||
p.playSound("thaumcraft:wand", 0.5F, 1.0F);
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack (ItemStack s, int i)
|
||||
{
|
||||
EntityPlayer p = TaintedMagic.proxy.getClientPlayer();
|
||||
return p == null ? 0xFFFFFF : Color.HSBtoRGB(p.ticksExisted * 16 % 360 / 360F, 1F, 1F);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWandCap extends Item
|
||||
{
|
||||
public int SUBTYPES = 4;
|
||||
public IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemWandCap ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemWandCap");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemWandCap" + i);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int i)
|
||||
{
|
||||
return this.icons[i];
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs c, List l)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
l.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack s)
|
||||
{
|
||||
return super.getUnlocalizedName() + "." + s.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package taintedmagic.common.items.wand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemWandRod extends Item
|
||||
{
|
||||
public int SUBTYPES = 2;
|
||||
public IIcon[] icons = new IIcon[SUBTYPES];
|
||||
|
||||
public ItemWandRod ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemWandRod");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity (ItemStack s)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
this.icons[i] = ir.registerIcon("taintedmagic:ItemWandRod" + i);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int i)
|
||||
{
|
||||
return this.icons[i];
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void getSubItems (Item item, CreativeTabs c, List l)
|
||||
{
|
||||
for (int i = 0; i < SUBTYPES; i++)
|
||||
l.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack s)
|
||||
{
|
||||
return super.getUnlocalizedName() + "." + s.getItemDamage();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user