Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -9,7 +9,6 @@ import WayofTime.bloodmagic.client.IVariantProvider;
|
|||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
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;
|
||||
|
@ -17,19 +16,16 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvider
|
||||
{
|
||||
public static String[] names = { "base", "corrosive", "destructive", "vengeful", "steadfast" };
|
||||
public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvider {
|
||||
public static String[] names = {"base", "corrosive", "destructive", "vengeful", "steadfast"};
|
||||
|
||||
public ItemMonsterSoul()
|
||||
{
|
||||
public ItemMonsterSoul() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".monsterSoul.");
|
||||
|
@ -39,14 +35,12 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
|
||||
if (!isInCreativeTab(creativeTab))
|
||||
return;
|
||||
|
||||
|
@ -56,8 +50,7 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
tooltip.add(TextHelper.localize("tooltip.bloodmagic.will", getWill(getType(stack), stack)));
|
||||
|
@ -66,16 +59,13 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getType(ItemStack stack) {
|
||||
return EnumDemonWillType.values()[stack.getItemDamage() % 5];
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulStack)
|
||||
{
|
||||
if (type != this.getType(soulStack))
|
||||
{
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulStack) {
|
||||
if (type != this.getType(soulStack)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -87,8 +77,7 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setWill(EnumDemonWillType type, ItemStack soulStack, double souls)
|
||||
{
|
||||
public void setWill(EnumDemonWillType type, ItemStack soulStack, double souls) {
|
||||
NBTHelper.checkNBT(soulStack);
|
||||
|
||||
NBTTagCompound tag = soulStack.getTagCompound();
|
||||
|
@ -99,8 +88,7 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulStack, double drainAmount)
|
||||
{
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulStack, double drainAmount) {
|
||||
double souls = getWill(type, soulStack);
|
||||
|
||||
double soulsDrained = Math.min(drainAmount, souls);
|
||||
|
@ -110,19 +98,16 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createWill(int meta, double number)
|
||||
{
|
||||
public ItemStack createWill(int meta, double number) {
|
||||
ItemStack soulStack = new ItemStack(this, 1, meta % 5);
|
||||
setWill(getType(soulStack), soulStack, number);
|
||||
return soulStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
String name = names[i];
|
||||
ret.add(new ImmutablePair<Integer, String>(i, "type=" + name));
|
||||
}
|
||||
|
@ -130,20 +115,17 @@ public class ItemMonsterSoul extends Item implements IDemonWill, IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getWill(ItemStack willStack)
|
||||
{
|
||||
public double getWill(ItemStack willStack) {
|
||||
return this.getWill(EnumDemonWillType.DEFAULT, willStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWill(ItemStack willStack, double will)
|
||||
{
|
||||
public void setWill(ItemStack willStack, double will) {
|
||||
this.setWill(EnumDemonWillType.DEFAULT, willStack, will);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(ItemStack willStack, double drainAmount)
|
||||
{
|
||||
public double drainWill(ItemStack willStack, double drainAmount) {
|
||||
return this.drainWill(EnumDemonWillType.DEFAULT, willStack, drainAmount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -11,15 +15,9 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||
|
||||
public class ItemSentientArmourGem extends Item
|
||||
{
|
||||
public ItemSentientArmourGem()
|
||||
{
|
||||
public class ItemSentientArmourGem extends Item {
|
||||
public ItemSentientArmourGem() {
|
||||
super();
|
||||
|
||||
setCreativeTab(BloodMagic.TAB_BM);
|
||||
|
@ -27,29 +25,23 @@ public class ItemSentientArmourGem extends Item
|
|||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
boolean hasSentientArmour = false;
|
||||
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
|
||||
for (ItemStack armourStack : armourInventory)
|
||||
{
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour)
|
||||
{
|
||||
for (ItemStack armourStack : armourInventory) {
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
|
||||
hasSentientArmour = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSentientArmour)
|
||||
{
|
||||
if (hasSentientArmour) {
|
||||
ItemSentientArmour.revertAllArmour(player);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double will = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
|
@ -61,20 +53,16 @@ public class ItemSentientArmourGem extends Item
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
boolean hasSentientArmour = false;
|
||||
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
|
||||
for (ItemStack armourStack : armourInventory)
|
||||
{
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour)
|
||||
{
|
||||
for (ItemStack armourStack : armourInventory) {
|
||||
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
|
||||
hasSentientArmour = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSentientArmour)
|
||||
{
|
||||
if (hasSentientArmour) {
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientArmourGem1", "inventory");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
|
@ -28,55 +41,38 @@ import net.minecraft.world.EnumDifficulty;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
public static double[] destructiveDamageAdded = new double[] { 2, 3, 4, 5, 6 };
|
||||
public static double[] vengefulDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] steadfastDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] defaultDigSpeedAdded = new double[] { 1, 1.5, 2, 3, 4 };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75 };
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3 };
|
||||
public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool {
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
|
||||
public static double[] defaultDamageAdded = new double[]{1, 2, 3, 3.5, 4};
|
||||
public static double[] destructiveDamageAdded = new double[]{2, 3, 4, 5, 6};
|
||||
public static double[] vengefulDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] steadfastDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] defaultDigSpeedAdded = new double[]{1, 1.5, 2, 3, 4};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75};
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3};
|
||||
|
||||
public static double[] healthBonus = new double[] { 0, 0, 0, 0, 0 }; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[] { -3, -2.8, -2.7, -2.6, -2.5 };
|
||||
public static double[] destructiveAttackSpeed = new double[] { -3.1, -3.1, -3.2, -3.3, -3.3 };
|
||||
public static double[] healthBonus = new double[]{0, 0, 0, 0, 0}; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[]{-3, -2.8, -2.7, -2.6, -2.5};
|
||||
public static double[] destructiveAttackSpeed = new double[]{-3.1, -3.1, -3.2, -3.3, -3.3};
|
||||
|
||||
public static int[] absorptionTime = new int[] { 200, 300, 400, 500, 600 };
|
||||
public static int[] absorptionTime = new int[]{200, 300, 400, 500, 600};
|
||||
|
||||
public static double maxAbsorptionHearts = 10;
|
||||
|
||||
public static int[] poisonTime = new int[] { 25, 50, 60, 80, 100 };
|
||||
public static int[] poisonLevel = new int[] { 0, 0, 0, 1, 1 };
|
||||
public static int[] poisonTime = new int[]{25, 50, 60, 80, 100};
|
||||
public static int[] poisonLevel = new int[]{0, 0, 0, 1, 1};
|
||||
|
||||
public static double[] movementSpeed = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25 };
|
||||
public static double[] movementSpeed = new double[]{0.05, 0.1, 0.15, 0.2, 0.25};
|
||||
|
||||
public final double baseAttackDamage = 8;
|
||||
public final double baseAttackSpeed = -3;
|
||||
|
||||
public ItemSentientAxe()
|
||||
{
|
||||
public ItemSentientAxe() {
|
||||
super(Item.ToolMaterial.IRON);
|
||||
setMaxDamage(getMaxDamage() * 2);
|
||||
// super(ModItems.soulToolMaterial);
|
||||
|
@ -86,26 +82,21 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
float value = super.getStrVsBlock(stack, state);
|
||||
if (value > 1)
|
||||
{
|
||||
if (value > 1) {
|
||||
return (float) (value + getDigSpeedOfSword(stack));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
this.setCurrentType(stack, soulsRemaining > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
|
@ -124,106 +115,89 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
setDigSpeedOfSword(stack, level >= 0 ? getDigSpeed(type, level) : 0);
|
||||
}
|
||||
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
if (willBracket < 0)
|
||||
{
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket) {
|
||||
if (willBracket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
// return movementSpeed[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive())
|
||||
{
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker) {
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive()) {
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
if (super.hitEntity(stack, target, attacker))
|
||||
{
|
||||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (super.hitEntity(stack, target, attacker)) {
|
||||
if (attacker instanceof EntityPlayer) {
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
@ -233,11 +207,9 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
{
|
||||
if (provider.providesEffectForWill(type)) {
|
||||
provider.applyOnHitEffect(type, stack, offStack, attacker, target);
|
||||
}
|
||||
}
|
||||
|
@ -250,22 +222,19 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -274,26 +243,21 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -303,8 +267,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
|
@ -313,21 +276,17 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
{
|
||||
if (drain > 0) {
|
||||
EnumDemonWillType type = getCurrentType(stack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
if (drain > soulsRemaining)
|
||||
{
|
||||
if (drain > soulsRemaining) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, drain);
|
||||
}
|
||||
}
|
||||
|
@ -337,24 +296,20 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemMeshDefinition getMeshDefinition()
|
||||
{
|
||||
public ItemMeshDefinition getMeshDefinition() {
|
||||
return new CustomMeshDefinitionMultiWill("ItemSentientAxe");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCustomLocation()
|
||||
{
|
||||
public ResourceLocation getCustomLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariants()
|
||||
{
|
||||
public List<String> getVariants() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
ret.add("type=" + type.getName().toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -362,12 +317,10 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting)
|
||||
{
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
|
||||
return soulList;
|
||||
}
|
||||
|
||||
|
@ -377,10 +330,8 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
for (int i = 0; i <= looting; i++) {
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
|
@ -391,11 +342,9 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
|
||||
//TODO: Change attack speed.
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
|
@ -405,16 +354,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
return multimap;
|
||||
}
|
||||
|
||||
public double getDamageOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDamageOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage)
|
||||
{
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -422,16 +369,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDrainOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain)
|
||||
{
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -439,16 +384,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -456,16 +399,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -473,16 +414,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DROP, drop);
|
||||
}
|
||||
|
||||
public double getHealthBonusOfSword(ItemStack stack)
|
||||
{
|
||||
public double getHealthBonusOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_HEALTH);
|
||||
}
|
||||
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp)
|
||||
{
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -490,16 +429,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_HEALTH, hp);
|
||||
}
|
||||
|
||||
public double getAttackSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getAttackSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -507,16 +444,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_SPEED);
|
||||
}
|
||||
|
||||
public void setSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -524,16 +459,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getDigSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getDigSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED);
|
||||
}
|
||||
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -542,17 +475,14 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
if (soulsRemaining < 1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -22,81 +32,59 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool//, IMeshProvider
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 0.25, 0.5, 0.75, 1, 1.25 };
|
||||
public static float[] velocityAdded = new float[] { 0.25f, 0.5f, 0.75f, 1, 1.25f };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75 }; //TODO
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3 };
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
|
||||
public static double[] defaultDamageAdded = new double[]{0.25, 0.5, 0.75, 1, 1.25};
|
||||
public static float[] velocityAdded = new float[]{0.25f, 0.5f, 0.75f, 1, 1.25f};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75}; //TODO
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3};
|
||||
|
||||
public ItemSentientBow()
|
||||
{
|
||||
public ItemSentientBow() {
|
||||
super();
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sentientBow");
|
||||
setCreativeTab(BloodMagic.TAB_BM);
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
|
||||
{
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
if (entityIn == null)
|
||||
{
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
if (entityIn == null) {
|
||||
return 0.0F;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
ItemStack itemstack = entityIn.getActiveItemStack();
|
||||
return !itemstack.isEmpty() && itemstack.getItem() == RegistrarBloodMagicItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter()
|
||||
{
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
|
||||
}
|
||||
});
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
|
||||
{
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn)
|
||||
{
|
||||
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
|
||||
return ((ItemSentientBow) RegistrarBloodMagicItems.SENTIENT_BOW).getCurrentType(stack).ordinal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
recalculatePowers(stack, type, soulsRemaining);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will) {
|
||||
this.setCurrentType(stack, will > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
int level = getLevel(stack, will);
|
||||
//
|
||||
|
@ -117,13 +105,10 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
setDamageAdded(stack, level >= 0 ? getDamageModifier(type, level) : 0);
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -132,49 +117,42 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public double getDamageModifier(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return 0;
|
||||
case DEFAULT:
|
||||
case CORROSIVE:
|
||||
case DESTRUCTIVE:
|
||||
case STEADFAST:
|
||||
return defaultDamageAdded[willBracket];
|
||||
public double getDamageModifier(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return 0;
|
||||
case DEFAULT:
|
||||
case CORROSIVE:
|
||||
case DESTRUCTIVE:
|
||||
case STEADFAST:
|
||||
return defaultDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getVelocityModifier(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return velocityAdded[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public float getVelocityModifier(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return velocityAdded[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDamageAdded(ItemStack stack, double damage)
|
||||
{
|
||||
public void setDamageAdded(ItemStack stack, double damage) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -182,8 +160,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble("damage", damage);
|
||||
}
|
||||
|
||||
public double getDamageAdded(ItemStack stack)
|
||||
{
|
||||
public double getDamageAdded(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -191,8 +168,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
return tag.getDouble("damage");
|
||||
}
|
||||
|
||||
public void setVelocityOfArrow(ItemStack stack, float velocity)
|
||||
{
|
||||
public void setVelocityOfArrow(ItemStack stack, float velocity) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -200,22 +176,19 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setFloat("velocity", velocity);
|
||||
}
|
||||
|
||||
public float getVelocityOfArrow(ItemStack stack)
|
||||
{
|
||||
public float getVelocityOfArrow(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (tag.hasKey("velocity"))
|
||||
{
|
||||
if (tag.hasKey("velocity")) {
|
||||
return tag.getFloat("velocity");
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -223,16 +196,14 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
public double getDrainOfActivatedBow(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedBow(ItemStack stack, double drain)
|
||||
{
|
||||
public void setDrainOfActivatedBow(ItemStack stack, double drain) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -240,16 +211,14 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
public double getStaticDropOfActivatedBow(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedBow(ItemStack stack, double drop)
|
||||
{
|
||||
public void setStaticDropOfActivatedBow(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -257,16 +226,14 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedBow(ItemStack stack)
|
||||
{
|
||||
public double getDropOfActivatedBow(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedBow(ItemStack stack, double drop)
|
||||
{
|
||||
public void setDropOfActivatedBow(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -275,15 +242,13 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
this.recalculatePowers(stack, world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity)
|
||||
{
|
||||
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity) {
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
double amount = user instanceof EntityPlayer ? (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack)) : 0;
|
||||
|
@ -298,14 +263,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
entityArrow.setThrowableHeading(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0);
|
||||
|
||||
if (newArrowVelocity == 0)
|
||||
{
|
||||
if (newArrowVelocity == 0) {
|
||||
world.playSound(null, user.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (velocity == 1.0F)
|
||||
{
|
||||
if (velocity == 1.0F) {
|
||||
entityArrow.setIsCritical(true);
|
||||
}
|
||||
|
||||
|
@ -315,13 +278,11 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
if (k > 0) {
|
||||
entityArrow.setKnockbackStrength(k);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0)
|
||||
{
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
|
||||
entityArrow.setFire(100);
|
||||
}
|
||||
|
||||
|
@ -331,10 +292,8 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, stack) > 0;
|
||||
ItemStack itemstack = this.getFiredArrow(player);
|
||||
|
@ -344,21 +303,17 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
if (i < 0)
|
||||
return;
|
||||
|
||||
if (itemstack != null || flag)
|
||||
{
|
||||
if (itemstack == null)
|
||||
{
|
||||
if (itemstack != null || flag) {
|
||||
if (itemstack == null) {
|
||||
itemstack = new ItemStack(Items.ARROW);
|
||||
}
|
||||
|
||||
float arrowVelocity = getArrowVelocity(i);
|
||||
|
||||
if ((double) arrowVelocity >= 0.1D)
|
||||
{
|
||||
if ((double) arrowVelocity >= 0.1D) {
|
||||
boolean flag1 = flag && itemstack.getItem() == Items.ARROW; //Forge: Fix consuming custom arrows.
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(stack, world, player);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
|
@ -372,14 +327,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
EntitySentientArrow entityArrow = new EntitySentientArrow(world, entityLiving, type, amount);
|
||||
entityArrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F);
|
||||
|
||||
if (newArrowVelocity == 0)
|
||||
{
|
||||
if (newArrowVelocity == 0) {
|
||||
world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
|
||||
return;
|
||||
}
|
||||
|
||||
if (arrowVelocity == 1.0F)
|
||||
{
|
||||
if (arrowVelocity == 1.0F) {
|
||||
entityArrow.setIsCritical(true);
|
||||
}
|
||||
|
||||
|
@ -389,20 +342,17 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
if (k > 0) {
|
||||
entityArrow.setKnockbackStrength(k);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0)
|
||||
{
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
|
||||
entityArrow.setFire(100);
|
||||
}
|
||||
|
||||
stack.damageItem(1, player);
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
|
@ -411,12 +361,10 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowVelocity * 0.5F);
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
if (!flag1) {
|
||||
itemstack.shrink(1);
|
||||
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
if (itemstack.isEmpty()) {
|
||||
player.inventory.deleteStack(itemstack);
|
||||
}
|
||||
}
|
||||
|
@ -427,22 +375,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
}
|
||||
|
||||
protected ItemStack getFiredArrow(EntityPlayer player)
|
||||
{
|
||||
if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND)))
|
||||
{
|
||||
protected ItemStack getFiredArrow(EntityPlayer player) {
|
||||
if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND))) {
|
||||
return player.getHeldItem(EnumHand.OFF_HAND);
|
||||
} else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND)))
|
||||
{
|
||||
} else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) {
|
||||
return player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
} else
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
|
||||
{
|
||||
} else {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (this.isArrow(itemstack))
|
||||
{
|
||||
if (this.isArrow(itemstack)) {
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
@ -452,17 +394,14 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
if (soulsRemaining < 1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
|
@ -28,55 +41,38 @@ import net.minecraft.world.EnumDifficulty;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
public static double[] destructiveDamageAdded = new double[] { 2, 3, 4, 5, 6 };
|
||||
public static double[] vengefulDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] steadfastDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] defaultDigSpeedAdded = new double[] { 1, 1.5, 2, 3, 4 };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75 };
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3 };
|
||||
public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool {
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
|
||||
public static double[] defaultDamageAdded = new double[]{1, 2, 3, 3.5, 4};
|
||||
public static double[] destructiveDamageAdded = new double[]{2, 3, 4, 5, 6};
|
||||
public static double[] vengefulDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] steadfastDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] defaultDigSpeedAdded = new double[]{1, 1.5, 2, 3, 4};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75};
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3};
|
||||
|
||||
public static double[] healthBonus = new double[] { 0, 0, 0, 0, 0 }; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[] { -3, -2.8, -2.7, -2.6, -2.5 };
|
||||
public static double[] destructiveAttackSpeed = new double[] { -3.1, -3.1, -3.2, -3.3, -3.3 };
|
||||
public static double[] healthBonus = new double[]{0, 0, 0, 0, 0}; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[]{-3, -2.8, -2.7, -2.6, -2.5};
|
||||
public static double[] destructiveAttackSpeed = new double[]{-3.1, -3.1, -3.2, -3.3, -3.3};
|
||||
|
||||
public static int[] absorptionTime = new int[] { 200, 300, 400, 500, 600 };
|
||||
public static int[] absorptionTime = new int[]{200, 300, 400, 500, 600};
|
||||
|
||||
public static double maxAbsorptionHearts = 10;
|
||||
|
||||
public static int[] poisonTime = new int[] { 25, 50, 60, 80, 100 };
|
||||
public static int[] poisonLevel = new int[] { 0, 0, 0, 1, 1 };
|
||||
public static int[] poisonTime = new int[]{25, 50, 60, 80, 100};
|
||||
public static int[] poisonLevel = new int[]{0, 0, 0, 1, 1};
|
||||
|
||||
public static double[] movementSpeed = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25 };
|
||||
public static double[] movementSpeed = new double[]{0.05, 0.1, 0.15, 0.2, 0.25};
|
||||
|
||||
public final double baseAttackDamage = 3;
|
||||
public final double baseAttackSpeed = -2.8;
|
||||
|
||||
public ItemSentientPickaxe()
|
||||
{
|
||||
public ItemSentientPickaxe() {
|
||||
super(Item.ToolMaterial.IRON);
|
||||
setMaxDamage(getMaxDamage() * 2);
|
||||
// super(ModItems.soulToolMaterial);
|
||||
|
@ -86,26 +82,21 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
float value = super.getStrVsBlock(stack, state);
|
||||
if (value > 1)
|
||||
{
|
||||
if (value > 1) {
|
||||
return (float) (value + getDigSpeedOfSword(stack));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
this.setCurrentType(stack, soulsRemaining > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
|
@ -124,106 +115,89 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
setDigSpeedOfSword(stack, level >= 0 ? getDigSpeed(type, level) : 0);
|
||||
}
|
||||
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
if (willBracket < 0)
|
||||
{
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket) {
|
||||
if (willBracket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
// return movementSpeed[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive())
|
||||
{
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker) {
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive()) {
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
if (super.hitEntity(stack, target, attacker))
|
||||
{
|
||||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (super.hitEntity(stack, target, attacker)) {
|
||||
if (attacker instanceof EntityPlayer) {
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
@ -233,11 +207,9 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
{
|
||||
if (provider.providesEffectForWill(type)) {
|
||||
provider.applyOnHitEffect(type, stack, offStack, attacker, target);
|
||||
}
|
||||
}
|
||||
|
@ -250,22 +222,19 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -274,25 +243,20 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -302,8 +266,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
|
@ -312,21 +275,17 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
{
|
||||
if (drain > 0) {
|
||||
EnumDemonWillType type = getCurrentType(stack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
if (drain > soulsRemaining)
|
||||
{
|
||||
if (drain > soulsRemaining) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, drain);
|
||||
}
|
||||
}
|
||||
|
@ -336,24 +295,20 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemMeshDefinition getMeshDefinition()
|
||||
{
|
||||
public ItemMeshDefinition getMeshDefinition() {
|
||||
return new CustomMeshDefinitionMultiWill("ItemSentientPickaxe");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCustomLocation()
|
||||
{
|
||||
public ResourceLocation getCustomLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariants()
|
||||
{
|
||||
public List<String> getVariants() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
ret.add("type=" + type.getName().toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -361,12 +316,10 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting)
|
||||
{
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
|
||||
return soulList;
|
||||
}
|
||||
|
||||
|
@ -376,10 +329,8 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
for (int i = 0; i <= looting; i++) {
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
|
@ -390,11 +341,9 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
|
||||
//TODO: Change attack speed.
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
|
@ -404,16 +353,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
return multimap;
|
||||
}
|
||||
|
||||
public double getDamageOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDamageOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage)
|
||||
{
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -421,16 +368,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDrainOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain)
|
||||
{
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -438,16 +383,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -455,16 +398,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -472,16 +413,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DROP, drop);
|
||||
}
|
||||
|
||||
public double getHealthBonusOfSword(ItemStack stack)
|
||||
{
|
||||
public double getHealthBonusOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_HEALTH);
|
||||
}
|
||||
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp)
|
||||
{
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -489,16 +428,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_HEALTH, hp);
|
||||
}
|
||||
|
||||
public double getAttackSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getAttackSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -506,16 +443,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_SPEED);
|
||||
}
|
||||
|
||||
public void setSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -523,16 +458,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getDigSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getDigSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED);
|
||||
}
|
||||
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -541,17 +474,14 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
if (soulsRemaining < 1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
|
@ -28,55 +41,38 @@ import net.minecraft.world.EnumDifficulty;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 2, 3, 3.5, 4 };
|
||||
public static double[] destructiveDamageAdded = new double[] { 2, 3, 4, 5, 6 };
|
||||
public static double[] vengefulDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] steadfastDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2 };
|
||||
public static double[] defaultDigSpeedAdded = new double[] { 1, 1.5, 2, 3, 4 };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75 };
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3 };
|
||||
public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool {
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
|
||||
public static double[] defaultDamageAdded = new double[]{1, 2, 3, 3.5, 4};
|
||||
public static double[] destructiveDamageAdded = new double[]{2, 3, 4, 5, 6};
|
||||
public static double[] vengefulDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] steadfastDamageAdded = new double[]{0, 0.5, 1, 1.5, 2};
|
||||
public static double[] defaultDigSpeedAdded = new double[]{1, 1.5, 2, 3, 4};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75};
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3};
|
||||
|
||||
public static double[] healthBonus = new double[] { 0, 0, 0, 0, 0 }; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[] { -3, -2.8, -2.7, -2.6, -2.5 };
|
||||
public static double[] destructiveAttackSpeed = new double[] { -3.1, -3.1, -3.2, -3.3, -3.3 };
|
||||
public static double[] healthBonus = new double[]{0, 0, 0, 0, 0}; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[]{-3, -2.8, -2.7, -2.6, -2.5};
|
||||
public static double[] destructiveAttackSpeed = new double[]{-3.1, -3.1, -3.2, -3.3, -3.3};
|
||||
|
||||
public static int[] absorptionTime = new int[] { 200, 300, 400, 500, 600 };
|
||||
public static int[] absorptionTime = new int[]{200, 300, 400, 500, 600};
|
||||
|
||||
public static double maxAbsorptionHearts = 10;
|
||||
|
||||
public static int[] poisonTime = new int[] { 25, 50, 60, 80, 100 };
|
||||
public static int[] poisonLevel = new int[] { 0, 0, 0, 1, 1 };
|
||||
public static int[] poisonTime = new int[]{25, 50, 60, 80, 100};
|
||||
public static int[] poisonLevel = new int[]{0, 0, 0, 1, 1};
|
||||
|
||||
public static double[] movementSpeed = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25 };
|
||||
public static double[] movementSpeed = new double[]{0.05, 0.1, 0.15, 0.2, 0.25};
|
||||
|
||||
public final double baseAttackDamage = 3;
|
||||
public final double baseAttackSpeed = -2.8;
|
||||
|
||||
public ItemSentientShovel()
|
||||
{
|
||||
public ItemSentientShovel() {
|
||||
super(Item.ToolMaterial.IRON);
|
||||
setMaxDamage(getMaxDamage() * 2);
|
||||
// super(ModItems.soulToolMaterial);
|
||||
|
@ -86,26 +82,21 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
float value = super.getStrVsBlock(stack, state);
|
||||
if (value > 1)
|
||||
{
|
||||
if (value > 1) {
|
||||
return (float) (value + getDigSpeedOfSword(stack));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
this.setCurrentType(stack, soulsRemaining > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
|
@ -124,106 +115,89 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
setDigSpeedOfSword(stack, level >= 0 ? getDigSpeed(type, level) : 0);
|
||||
}
|
||||
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
if (willBracket < 0)
|
||||
{
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket) {
|
||||
if (willBracket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.9;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
public double getDigSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
// return movementSpeed[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
default:
|
||||
return defaultDigSpeedAdded[willBracket];
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive())
|
||||
{
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityPlayer attacker) {
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive()) {
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
if (super.hitEntity(stack, target, attacker))
|
||||
{
|
||||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (super.hitEntity(stack, target, attacker)) {
|
||||
if (attacker instanceof EntityPlayer) {
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
@ -233,11 +207,9 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
{
|
||||
if (provider.providesEffectForWill(type)) {
|
||||
provider.applyOnHitEffect(type, stack, offStack, attacker, target);
|
||||
}
|
||||
}
|
||||
|
@ -250,22 +222,19 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -274,26 +243,21 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -303,8 +267,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
|
@ -313,21 +276,17 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
{
|
||||
if (drain > 0) {
|
||||
EnumDemonWillType type = getCurrentType(stack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
if (drain > soulsRemaining)
|
||||
{
|
||||
if (drain > soulsRemaining) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, drain);
|
||||
}
|
||||
}
|
||||
|
@ -337,24 +296,20 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemMeshDefinition getMeshDefinition()
|
||||
{
|
||||
public ItemMeshDefinition getMeshDefinition() {
|
||||
return new CustomMeshDefinitionMultiWill("ItemSentientShovel");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCustomLocation()
|
||||
{
|
||||
public ResourceLocation getCustomLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariants()
|
||||
{
|
||||
public List<String> getVariants() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
ret.add("type=" + type.getName().toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -362,12 +317,10 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting)
|
||||
{
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
|
||||
return soulList;
|
||||
}
|
||||
|
||||
|
@ -377,10 +330,8 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
for (int i = 0; i <= looting; i++) {
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
|
@ -391,11 +342,9 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
|
||||
//TODO: Change attack speed.
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
|
@ -405,16 +354,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
return multimap;
|
||||
}
|
||||
|
||||
public double getDamageOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDamageOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage)
|
||||
{
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -422,16 +369,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDrainOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain)
|
||||
{
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -439,16 +384,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -456,16 +399,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -473,16 +414,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DROP, drop);
|
||||
}
|
||||
|
||||
public double getHealthBonusOfSword(ItemStack stack)
|
||||
{
|
||||
public double getHealthBonusOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_HEALTH);
|
||||
}
|
||||
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp)
|
||||
{
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -490,16 +429,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_HEALTH, hp);
|
||||
}
|
||||
|
||||
public double getAttackSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getAttackSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -507,16 +444,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_SPEED);
|
||||
}
|
||||
|
||||
public void setSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -524,16 +459,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getDigSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getDigSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DIG_SPEED);
|
||||
}
|
||||
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setDigSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -542,17 +475,14 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
if (soulsRemaining < 1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -26,51 +39,34 @@ import net.minecraft.world.EnumDifficulty;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
||||
import WayofTime.bloodmagic.api.iface.ISentientTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
|
||||
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000, 2000, 4000 };
|
||||
public static double[] defaultDamageAdded = new double[] { 1, 1.5, 2, 2.5, 3, 3.5, 4 };
|
||||
public static double[] destructiveDamageAdded = new double[] { 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6 };
|
||||
public static double[] vengefulDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2, 2.25, 2.5 };
|
||||
public static double[] steadfastDamageAdded = new double[] { 0, 0.5, 1, 1.5, 2, 2.25, 2.5 };
|
||||
public static double[] soulDrainPerSwing = new double[] { 0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.25 };
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13, 15, 18 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3, 4, 4 };
|
||||
public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IMeshProvider, IMultiWillTool, ISentientTool {
|
||||
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000, 2000, 4000};
|
||||
public static double[] defaultDamageAdded = new double[]{1, 1.5, 2, 2.5, 3, 3.5, 4};
|
||||
public static double[] destructiveDamageAdded = new double[]{1.5, 2.25, 3, 3.75, 4.5, 5.25, 6};
|
||||
public static double[] vengefulDamageAdded = new double[]{0, 0.5, 1, 1.5, 2, 2.25, 2.5};
|
||||
public static double[] steadfastDamageAdded = new double[]{0, 0.5, 1, 1.5, 2, 2.25, 2.5};
|
||||
public static double[] soulDrainPerSwing = new double[]{0.05, 0.1, 0.2, 0.4, 0.75, 1, 1.25};
|
||||
public static double[] soulDrop = new double[]{2, 4, 7, 10, 13, 15, 18};
|
||||
public static double[] staticDrop = new double[]{1, 1, 2, 3, 3, 4, 4};
|
||||
|
||||
public static double[] healthBonus = new double[] { 0, 0, 0, 0, 0, 0, 0 }; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[] { -2.1, -2, -1.8, -1.7, -1.6, -1.6, -1.5 };
|
||||
public static double[] destructiveAttackSpeed = new double[] { -2.6, -2.7, -2.8, -2.9, -3, -3, -3 };
|
||||
public static double[] healthBonus = new double[]{0, 0, 0, 0, 0, 0, 0}; //TODO: Think of implementing this later
|
||||
public static double[] vengefulAttackSpeed = new double[]{-2.1, -2, -1.8, -1.7, -1.6, -1.6, -1.5};
|
||||
public static double[] destructiveAttackSpeed = new double[]{-2.6, -2.7, -2.8, -2.9, -3, -3, -3};
|
||||
|
||||
public static int[] absorptionTime = new int[] { 200, 300, 400, 500, 600, 700, 800 };
|
||||
public static int[] absorptionTime = new int[]{200, 300, 400, 500, 600, 700, 800};
|
||||
|
||||
public static double maxAbsorptionHearts = 10;
|
||||
|
||||
public static int[] poisonTime = new int[] { 25, 50, 60, 80, 100, 120, 150 };
|
||||
public static int[] poisonLevel = new int[] { 0, 0, 0, 1, 1, 1, 1 };
|
||||
public static int[] poisonTime = new int[]{25, 50, 60, 80, 100, 120, 150};
|
||||
public static int[] poisonLevel = new int[]{0, 0, 0, 1, 1, 1, 1};
|
||||
|
||||
public static double[] movementSpeed = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4 };
|
||||
public static double[] movementSpeed = new double[]{0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4};
|
||||
|
||||
public ItemSentientSword()
|
||||
{
|
||||
public ItemSentientSword() {
|
||||
super(RegistrarBloodMagicItems.SOUL_TOOL_MATERIAL);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sentientSword");
|
||||
|
@ -78,20 +74,17 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
|
||||
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
recalculatePowers(stack, type, soulsRemaining);
|
||||
}
|
||||
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will)
|
||||
{
|
||||
public void recalculatePowers(ItemStack stack, EnumDemonWillType type, double will) {
|
||||
this.setCurrentType(stack, will > 0 ? type : EnumDemonWillType.DEFAULT);
|
||||
int level = getLevel(stack, will);
|
||||
|
||||
|
@ -107,95 +100,80 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
setSpeedOfSword(stack, level >= 0 ? getMovementSpeed(type, level) : 0);
|
||||
}
|
||||
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
if (willBracket < 0)
|
||||
{
|
||||
public double getExtraDamage(EnumDemonWillType type, int willBracket) {
|
||||
if (willBracket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
case DEFAULT:
|
||||
return defaultDamageAdded[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveDamageAdded[willBracket];
|
||||
case VENGEFUL:
|
||||
return vengefulDamageAdded[willBracket];
|
||||
case STEADFAST:
|
||||
return steadfastDamageAdded[willBracket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.4;
|
||||
public double getAttackSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return vengefulAttackSpeed[willBracket];
|
||||
case DESTRUCTIVE:
|
||||
return destructiveAttackSpeed[willBracket];
|
||||
default:
|
||||
return -2.4;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getHealthBonus(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case STEADFAST:
|
||||
return healthBonus[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
public double getMovementSpeed(EnumDemonWillType type, int willBracket) {
|
||||
switch (type) {
|
||||
case VENGEFUL:
|
||||
return movementSpeed[willBracket];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive())
|
||||
{
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
public void applyEffectToEntity(EnumDemonWillType type, int willBracket, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.WITHER, poisonTime[willBracket], poisonLevel[willBracket]));
|
||||
break;
|
||||
case DEFAULT:
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
break;
|
||||
case STEADFAST:
|
||||
if (!target.isEntityAlive()) {
|
||||
float absorption = attacker.getAbsorptionAmount();
|
||||
attacker.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, absorptionTime[willBracket], 127));
|
||||
attacker.setAbsorptionAmount((float) Math.min(absorption + target.getMaxHealth() * 0.05f, maxAbsorptionHearts));
|
||||
}
|
||||
break;
|
||||
case VENGEFUL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||
{
|
||||
if (super.hitEntity(stack, target, attacker))
|
||||
{
|
||||
if (attacker instanceof EntityPlayer)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
if (super.hitEntity(stack, target, attacker)) {
|
||||
if (attacker instanceof EntityPlayer) {
|
||||
EntityPlayer attackerPlayer = (EntityPlayer) attacker;
|
||||
this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
@ -205,11 +183,9 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
applyEffectToEntity(type, willBracket, target, attackerPlayer);
|
||||
|
||||
ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider)
|
||||
{
|
||||
if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
|
||||
ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
|
||||
if (provider.providesEffectForWill(type))
|
||||
{
|
||||
if (provider.providesEffectForWill(type)) {
|
||||
provider.applyOnHitEffect(type, stack, offStack, attacker, target);
|
||||
}
|
||||
}
|
||||
|
@ -222,22 +198,19 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type)
|
||||
{
|
||||
public void setCurrentType(ItemStack stack, EnumDemonWillType type) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -246,25 +219,20 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
recalculatePowers(player.getHeldItem(hand), world, player);
|
||||
return super.onItemRightClick(world, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
|
||||
{
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return oldStack.getItem() != newStack.getItem();
|
||||
}
|
||||
|
||||
private int getLevel(ItemStack stack, double soulsRemaining)
|
||||
{
|
||||
private int getLevel(ItemStack stack, double soulsRemaining) {
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
for (int i = 0; i < soulBracket.length; i++) {
|
||||
if (soulsRemaining >= soulBracket[i]) {
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +242,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
|
@ -284,21 +251,17 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
recalculatePowers(stack, player.getEntityWorld(), player);
|
||||
|
||||
double drain = this.getDrainOfActivatedSword(stack);
|
||||
if (drain > 0)
|
||||
{
|
||||
if (drain > 0) {
|
||||
EnumDemonWillType type = getCurrentType(stack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
|
||||
if (drain > soulsRemaining)
|
||||
{
|
||||
if (drain > soulsRemaining) {
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
PlayerDemonWillHandler.consumeDemonWill(type, player, drain);
|
||||
}
|
||||
}
|
||||
|
@ -308,24 +271,20 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemMeshDefinition getMeshDefinition()
|
||||
{
|
||||
public ItemMeshDefinition getMeshDefinition() {
|
||||
return new CustomMeshDefinitionMultiWill("ItemSentientSword");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCustomLocation()
|
||||
{
|
||||
public ResourceLocation getCustomLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariants()
|
||||
{
|
||||
public List<String> getVariants() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
ret.add("type=" + type.getName().toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -333,12 +292,10 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting)
|
||||
{
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
|
||||
List<ItemStack> soulList = new ArrayList<ItemStack>();
|
||||
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob))
|
||||
{
|
||||
if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
|
||||
return soulList;
|
||||
}
|
||||
|
||||
|
@ -348,10 +305,8 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
for (int i = 0; i <= looting; i++)
|
||||
{
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4)
|
||||
{
|
||||
for (int i = 0; i <= looting; i++) {
|
||||
if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
|
||||
ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
|
||||
soulList.add(soulStack);
|
||||
}
|
||||
|
@ -362,11 +317,9 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
|
||||
//TODO: Change attack speed.
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", getDamageOfActivatedSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.getAttackSpeedOfSword(stack), 0));
|
||||
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(new UUID(0, 31818145), "Weapon modifier", this.getHealthBonusOfSword(stack), 0));
|
||||
|
@ -376,16 +329,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
return multimap;
|
||||
}
|
||||
|
||||
public double getDamageOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDamageOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DAMAGE);
|
||||
}
|
||||
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage)
|
||||
{
|
||||
public void setDamageOfActivatedSword(ItemStack stack, double damage) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -393,16 +344,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DAMAGE, damage);
|
||||
}
|
||||
|
||||
public double getDrainOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDrainOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN);
|
||||
}
|
||||
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain)
|
||||
{
|
||||
public void setDrainOfActivatedSword(ItemStack stack, double drain) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -410,16 +359,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ACTIVE_DRAIN, drain);
|
||||
}
|
||||
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getStaticDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP);
|
||||
}
|
||||
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setStaticDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -427,16 +374,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_STATIC_DROP, drop);
|
||||
}
|
||||
|
||||
public double getDropOfActivatedSword(ItemStack stack)
|
||||
{
|
||||
public double getDropOfActivatedSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_DROP);
|
||||
}
|
||||
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop)
|
||||
{
|
||||
public void setDropOfActivatedSword(ItemStack stack, double drop) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -444,16 +389,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_DROP, drop);
|
||||
}
|
||||
|
||||
public double getHealthBonusOfSword(ItemStack stack)
|
||||
{
|
||||
public double getHealthBonusOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_HEALTH);
|
||||
}
|
||||
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp)
|
||||
{
|
||||
public void setHealthBonusOfSword(ItemStack stack, double hp) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -461,16 +404,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_HEALTH, hp);
|
||||
}
|
||||
|
||||
public double getAttackSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getAttackSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setAttackSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -478,16 +419,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
tag.setDouble(Constants.NBT.SOUL_SWORD_ATTACK_SPEED, speed);
|
||||
}
|
||||
|
||||
public double getSpeedOfSword(ItemStack stack)
|
||||
{
|
||||
public double getSpeedOfSword(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
return tag.getDouble(Constants.NBT.SOUL_SWORD_SPEED);
|
||||
}
|
||||
|
||||
public void setSpeedOfSword(ItemStack stack, double speed)
|
||||
{
|
||||
public void setSpeedOfSword(ItemStack stack, double speed) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
@ -496,17 +435,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
|
||||
{
|
||||
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
|
||||
World world = player.getEntityWorld();
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
this.recalculatePowers(droppedStack, world, player);
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(droppedStack);
|
||||
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
|
||||
if (soulsRemaining < 1024)
|
||||
{
|
||||
if (soulsRemaining < 1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillGem;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionWillGem;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -18,24 +23,16 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillGem;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionWillGem;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, IMultiWillTool
|
||||
{
|
||||
public static String[] names = { "petty", "lesser", "common", "greater", "grand" };
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public ItemSoulGem()
|
||||
{
|
||||
public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, IMultiWillTool {
|
||||
public static String[] names = {"petty", "lesser", "common", "greater", "grand"};
|
||||
|
||||
public ItemSoulGem() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".soulGem.");
|
||||
|
@ -45,14 +42,12 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double drain = Math.min(this.getWill(type, stack), this.getMaxWill(type, stack) / 10);
|
||||
|
@ -65,24 +60,20 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemMeshDefinition getMeshDefinition()
|
||||
{
|
||||
public ItemMeshDefinition getMeshDefinition() {
|
||||
return new CustomMeshDefinitionWillGem("ItemSoulGem");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCustomLocation()
|
||||
{
|
||||
public ResourceLocation getCustomLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariants()
|
||||
{
|
||||
public List<String> getVariants() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
ret.add("type=petty_" + type.getName().toLowerCase());
|
||||
ret.add("type=lesser_" + type.getName().toLowerCase());
|
||||
ret.add("type=common_" + type.getName().toLowerCase());
|
||||
|
@ -94,21 +85,17 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
|
||||
if (!isInCreativeTab(creativeTab))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
ItemStack emptyStack = new ItemStack(this, 1, i);
|
||||
|
||||
list.add(emptyStack);
|
||||
}
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
ItemStack fullStack = new ItemStack(this, 1, i);
|
||||
setWill(type, fullStack, getMaxWill(EnumDemonWillType.DEFAULT, fullStack));
|
||||
list.add(fullStack);
|
||||
|
@ -118,8 +105,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
|
@ -132,57 +118,47 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double maxWill = getMaxWill(type, stack);
|
||||
if (maxWill <= 0)
|
||||
{
|
||||
if (maxWill <= 0) {
|
||||
return 1;
|
||||
}
|
||||
return 1.0 - (getWill(type, stack) / maxWill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRGBDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public int getRGBDurabilityForDisplay(ItemStack stack) {
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
double maxWill = getMaxWill(type, stack);
|
||||
if (maxWill <= 0)
|
||||
{
|
||||
if (maxWill <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return MathHelper.hsvToRGB(Math.max(0.0F, (float)(getWill(type, stack)) / (float) maxWill) / 3.0F, 1.0F, 1.0F);
|
||||
return MathHelper.hsvToRGB(Math.max(0.0F, (float) (getWill(type, stack)) / (float) maxWill) / 3.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack fillDemonWillGem(ItemStack soulGemStack, ItemStack soulStack)
|
||||
{
|
||||
if (soulStack != null && soulStack.getItem() instanceof IDemonWill)
|
||||
{
|
||||
public ItemStack fillDemonWillGem(ItemStack soulGemStack, ItemStack soulStack) {
|
||||
if (soulStack != null && soulStack.getItem() instanceof IDemonWill) {
|
||||
EnumDemonWillType thisType = this.getCurrentType(soulGemStack);
|
||||
if (thisType != ((IDemonWill) soulStack.getItem()).getType(soulStack))
|
||||
{
|
||||
if (thisType != ((IDemonWill) soulStack.getItem()).getType(soulStack)) {
|
||||
return soulStack;
|
||||
}
|
||||
IDemonWill soul = (IDemonWill) soulStack.getItem();
|
||||
double soulsLeft = getWill(thisType, soulGemStack);
|
||||
|
||||
if (soulsLeft < getMaxWill(thisType, soulGemStack))
|
||||
{
|
||||
if (soulsLeft < getMaxWill(thisType, soulGemStack)) {
|
||||
double newSoulsLeft = Math.min(soulsLeft + soul.getWill(thisType, soulStack), getMaxWill(thisType, soulGemStack));
|
||||
soul.drainWill(thisType, soulStack, newSoulsLeft - soulsLeft);
|
||||
|
||||
setWill(thisType, soulGemStack, newSoulsLeft);
|
||||
if (soul.getWill(thisType, soulStack) <= 0)
|
||||
{
|
||||
if (soul.getWill(thisType, soulStack) <= 0) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@ -192,10 +168,8 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
if (!type.equals(getCurrentType(soulGemStack)))
|
||||
{
|
||||
public double getWill(EnumDemonWillType type, ItemStack soulGemStack) {
|
||||
if (!type.equals(getCurrentType(soulGemStack))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -205,8 +179,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setWill(EnumDemonWillType type, ItemStack soulGemStack, double souls)
|
||||
{
|
||||
public void setWill(EnumDemonWillType type, ItemStack soulGemStack, double souls) {
|
||||
setCurrentType(type, soulGemStack);
|
||||
|
||||
NBTTagCompound tag = soulGemStack.getTagCompound();
|
||||
|
@ -215,19 +188,16 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulGemStack, double drainAmount, boolean doDrain)
|
||||
{
|
||||
public double drainWill(EnumDemonWillType type, ItemStack soulGemStack, double drainAmount, boolean doDrain) {
|
||||
EnumDemonWillType currentType = this.getCurrentType(soulGemStack);
|
||||
if (currentType != type)
|
||||
{
|
||||
if (currentType != type) {
|
||||
return 0;
|
||||
}
|
||||
double souls = getWill(type, soulGemStack);
|
||||
|
||||
double soulsDrained = Math.min(drainAmount, souls);
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
if (doDrain) {
|
||||
setWill(type, soulGemStack, souls - soulsDrained);
|
||||
}
|
||||
|
||||
|
@ -235,55 +205,47 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxWill(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
public int getMaxWill(EnumDemonWillType type, ItemStack soulGemStack) {
|
||||
EnumDemonWillType currentType = getCurrentType(soulGemStack);
|
||||
if (!type.equals(currentType) && currentType != EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
if (!type.equals(currentType) && currentType != EnumDemonWillType.DEFAULT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (soulGemStack.getMetadata())
|
||||
{
|
||||
case 0:
|
||||
return 64;
|
||||
case 1:
|
||||
return 256;
|
||||
case 2:
|
||||
return 1024;
|
||||
case 3:
|
||||
return 4096;
|
||||
case 4:
|
||||
return 16384;
|
||||
switch (soulGemStack.getMetadata()) {
|
||||
case 0:
|
||||
return 64;
|
||||
case 1:
|
||||
return 256;
|
||||
case 2:
|
||||
return 1024;
|
||||
case 3:
|
||||
return 4096;
|
||||
case 4:
|
||||
return 16384;
|
||||
}
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumDemonWillType getCurrentType(ItemStack soulGemStack)
|
||||
{
|
||||
public EnumDemonWillType getCurrentType(ItemStack soulGemStack) {
|
||||
NBTHelper.checkNBT(soulGemStack);
|
||||
|
||||
NBTTagCompound tag = soulGemStack.getTagCompound();
|
||||
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
return EnumDemonWillType.DEFAULT;
|
||||
}
|
||||
|
||||
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public void setCurrentType(EnumDemonWillType type, ItemStack soulGemStack)
|
||||
{
|
||||
public void setCurrentType(EnumDemonWillType type, ItemStack soulGemStack) {
|
||||
NBTHelper.checkNBT(soulGemStack);
|
||||
|
||||
NBTTagCompound tag = soulGemStack.getTagCompound();
|
||||
|
||||
if (type == EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
if (tag.hasKey(Constants.NBT.WILL_TYPE))
|
||||
{
|
||||
if (type == EnumDemonWillType.DEFAULT) {
|
||||
if (tag.hasKey(Constants.NBT.WILL_TYPE)) {
|
||||
tag.removeTag(Constants.NBT.WILL_TYPE);
|
||||
}
|
||||
|
||||
|
@ -294,10 +256,8 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public double fillWill(EnumDemonWillType type, ItemStack stack, double fillAmount, boolean doFill)
|
||||
{
|
||||
if (!type.equals(getCurrentType(stack)) && this.getWill(getCurrentType(stack), stack) > 0)
|
||||
{
|
||||
public double fillWill(EnumDemonWillType type, ItemStack stack, double fillAmount, boolean doFill) {
|
||||
if (!type.equals(getCurrentType(stack)) && this.getWill(getCurrentType(stack), stack) > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -306,8 +266,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
|
|||
|
||||
double filled = Math.min(fillAmount, maxWill - current);
|
||||
|
||||
if (doFill)
|
||||
{
|
||||
if (doFill) {
|
||||
this.setWill(type, stack, filled + current);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.util.*;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -22,12 +21,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSoulSnare extends Item implements IVariantProvider
|
||||
{
|
||||
public static String[] names = { "base" };
|
||||
public class ItemSoulSnare extends Item implements IVariantProvider {
|
||||
public static String[] names = {"base"};
|
||||
|
||||
public ItemSoulSnare()
|
||||
{
|
||||
public ItemSoulSnare() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".soulSnare.");
|
||||
|
@ -37,18 +34,15 @@ public class ItemSoulSnare extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
||||
ItemStack stack = playerIn.getHeldItem(hand);
|
||||
if (!playerIn.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!playerIn.capabilities.isCreativeMode) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
||||
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
if (!worldIn.isRemote) {
|
||||
EntitySoulSnare snare = new EntitySoulSnare(worldIn, playerIn);
|
||||
snare.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
worldIn.spawnEntity(snare);
|
||||
|
@ -58,15 +52,13 @@ public class ItemSoulSnare extends Item implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
|
||||
{
|
||||
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
|
||||
if (!isInCreativeTab(creativeTab))
|
||||
return;
|
||||
|
||||
|
@ -76,16 +68,14 @@ public class ItemSoulSnare extends Item implements IVariantProvider
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.bloodmagic.soulSnare.desc"))));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
ret.add(new ImmutablePair<Integer, String>(0, "type=soulsnare"));
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue