Clean up some javadoc spam
Still need to figure out why delombok is priting an error for every non-BM import. It was apparently fixed in `gradle-lombok` 1.5 but it seems to have returned.
This commit is contained in:
parent
fe18be56fd
commit
126d17b55d
11 changed files with 175 additions and 177 deletions
|
@ -4,27 +4,49 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public interface IDemonWill
|
||||
{
|
||||
public double getWill(ItemStack soulStack);
|
||||
/**
|
||||
* Obtains the amount of Will an ItemStack contains.
|
||||
*
|
||||
* @param willStack
|
||||
* - The stack to retrieve the Will from
|
||||
*
|
||||
* @return - The amount of Will an ItemStack contains
|
||||
*/
|
||||
double getWill(ItemStack willStack);
|
||||
|
||||
public void setWill(ItemStack willStack, double will);
|
||||
/**
|
||||
* Sets the amount of Will in a given ItemStack.
|
||||
*
|
||||
* @param willStack
|
||||
* - The ItemStack of the Will
|
||||
* @param will
|
||||
* - The amount of will to set the stack to
|
||||
*/
|
||||
void setWill(ItemStack willStack, double will);
|
||||
|
||||
/**
|
||||
* Drains the demonic will from the willStack. If all of the will is
|
||||
* drained, the willStack will be removed.
|
||||
*
|
||||
* @param willStack
|
||||
* - The ItemStack of the will
|
||||
* @param drainAmount
|
||||
* - The amount of Will to drain
|
||||
*
|
||||
* @return The amount of will drained.
|
||||
*/
|
||||
public double drainWill(ItemStack willStack, double drainAmount);
|
||||
double drainWill(ItemStack willStack, double drainAmount);
|
||||
|
||||
/**
|
||||
* Creates a new ItemStack with the specified number of will. Implementation
|
||||
* should respect the number requested.
|
||||
*
|
||||
* @param meta
|
||||
* - The meta of the ItemStack to create
|
||||
* @param number
|
||||
* @return
|
||||
* - The amount of Will to create the Stack with.
|
||||
*
|
||||
* @return - An ItemStack with the set amount of Will
|
||||
*/
|
||||
public ItemStack createWill(int meta, double number);
|
||||
ItemStack createWill(int meta, double number);
|
||||
}
|
||||
|
|
|
@ -4,26 +4,47 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public interface IDiscreteDemonWill
|
||||
{
|
||||
public double getWill(ItemStack soulStack);
|
||||
/**
|
||||
* Obtains the amount of Will an ItemStack contains.
|
||||
*
|
||||
* @param soulStack
|
||||
* - The stack to retrieve the Will from
|
||||
*
|
||||
* @return - The amount of Will an ItemStack contains
|
||||
*/
|
||||
double getWill(ItemStack soulStack);
|
||||
|
||||
/**
|
||||
* Drains the demonic will from the willStack. If all of the will is
|
||||
* drained, the willStack will be removed. Will only drain in discrete
|
||||
* amounts, determined by getDiscretization.
|
||||
*
|
||||
*
|
||||
* @param willStack
|
||||
* - The ItemStack of the will
|
||||
* @param drainAmount
|
||||
* - The amount of Will to drain
|
||||
*
|
||||
* @return The amount of will drained.
|
||||
*/
|
||||
public double drainWill(ItemStack willStack, double drainAmount);
|
||||
double drainWill(ItemStack willStack, double drainAmount);
|
||||
|
||||
/**
|
||||
* Gets the discrete number for this demonic will.
|
||||
*
|
||||
*
|
||||
* @param willStack
|
||||
* @return
|
||||
* - The ItemStack of the will
|
||||
*
|
||||
* @return - The discrete number for the given stack.
|
||||
*/
|
||||
public double getDiscretization(ItemStack willStack);
|
||||
double getDiscretization(ItemStack willStack);
|
||||
|
||||
public EnumDemonWillType getType(ItemStack willStack);
|
||||
/**
|
||||
* Obtains the type of will this is.
|
||||
*
|
||||
* @param willStack
|
||||
* - The ItemStack of the will
|
||||
*
|
||||
* @return - The type of will this is.
|
||||
*/
|
||||
EnumDemonWillType getType(ItemStack willStack);
|
||||
}
|
||||
|
|
|
@ -7,28 +7,30 @@ import net.minecraft.item.ItemStack;
|
|||
* This class provides several helper methods in order to handle soul
|
||||
* consumption and use for a player. This refers to the Soul System, meaning
|
||||
* Monster Souls and Soul Gems, etc. The Soul Network's helper methods are found
|
||||
* in WayofTime.bloodmagic.api.network
|
||||
*
|
||||
* @author WayofTime
|
||||
*
|
||||
* in {@link WayofTime.bloodmagic.api.network.SoulNetwork}
|
||||
*/
|
||||
public class PlayerDemonWillHandler
|
||||
{
|
||||
/**
|
||||
* Gets the total amount of Will a player contains in their inventory
|
||||
*
|
||||
* @param type
|
||||
* - The type of Will to check for
|
||||
* @param player
|
||||
* - The player to check the will of
|
||||
*
|
||||
* @return - The amount of will the player contains
|
||||
*/
|
||||
public static double getTotalDemonWill(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double souls = 0;
|
||||
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
{
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWill)
|
||||
{
|
||||
for (ItemStack stack : inventory) {
|
||||
if (stack != null) {
|
||||
if (stack.getItem() instanceof IDemonWill) {
|
||||
souls += ((IDemonWill) stack.getItem()).getWill(stack);
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
} else if (stack.getItem() instanceof IDemonWillGem) {
|
||||
souls += ((IDemonWillGem) stack.getItem()).getWill(type, stack);
|
||||
}
|
||||
}
|
||||
|
@ -38,28 +40,25 @@ public class PlayerDemonWillHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the player's Tartaric gems are completely full. If so, it will
|
||||
* return true.
|
||||
*
|
||||
* Checks if the player's Tartaric gems are completely full.
|
||||
*
|
||||
* @param type
|
||||
* - The type of Will to check for
|
||||
* @param player
|
||||
* - The player to check the Will of
|
||||
*
|
||||
* @return - True if all Will containers are full, false if not.
|
||||
*/
|
||||
public static boolean isDemonWillFull(EnumDemonWillType type, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
|
||||
boolean hasGem = false;
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
{
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
hasGem = true;
|
||||
if (((IDemonWillGem) stack.getItem()).getWill(type, stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(type, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (ItemStack stack : inventory) {
|
||||
if (stack != null && stack.getItem() instanceof IDemonWillGem) {
|
||||
hasGem = true;
|
||||
if (((IDemonWillGem) stack.getItem()).getWill(type, stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(type, stack))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +66,14 @@ public class PlayerDemonWillHandler
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Consumes Will from the inventory of a given player
|
||||
*
|
||||
* @param player
|
||||
* - The player to consume the will of
|
||||
* @param amount
|
||||
* @return - amount consumed
|
||||
* - The amount of will to consume
|
||||
*
|
||||
* @return - The amount of will consumed.
|
||||
*/
|
||||
public static double consumeDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||
{
|
||||
|
@ -81,9 +84,7 @@ public class PlayerDemonWillHandler
|
|||
for (int i = 0; i < inventory.length; i++)
|
||||
{
|
||||
if (consumed >= amount)
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
|
@ -92,9 +93,7 @@ public class PlayerDemonWillHandler
|
|||
{
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(stack) <= 0)
|
||||
{
|
||||
inventory[i] = null;
|
||||
}
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||
|
@ -110,82 +109,91 @@ public class PlayerDemonWillHandler
|
|||
* the player's inventory.
|
||||
*
|
||||
* @param player
|
||||
* @param soulStack
|
||||
* - ItemStack that contains an IDemonWill to be added
|
||||
* @return
|
||||
* - The player to add will to
|
||||
* @param willStack
|
||||
* - ItemStack that contains an IDemonWill to be added
|
||||
*
|
||||
* @return - The modified willStack
|
||||
*/
|
||||
public static ItemStack addDemonWill(EntityPlayer player, ItemStack soulStack)
|
||||
public static ItemStack addDemonWill(EntityPlayer player, ItemStack willStack)
|
||||
{
|
||||
if (soulStack == null)
|
||||
{
|
||||
if (willStack == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
for (ItemStack stack : inventory)
|
||||
{
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
if (stack != null && stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
ItemStack newStack = ((IDemonWillGem) stack.getItem()).fillDemonWillGem(stack, soulStack);
|
||||
if (newStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ItemStack newStack = ((IDemonWillGem) stack.getItem()).fillDemonWillGem(stack, willStack);
|
||||
if (newStack == null)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return soulStack;
|
||||
return willStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an IDiscreteDemonWill contained in an ItemStack to one of the Soul Gems in
|
||||
* the player's inventory.
|
||||
*
|
||||
* @param type
|
||||
* - The type of Will to add
|
||||
* @param player
|
||||
* - The player to check the Will of
|
||||
* @param amount
|
||||
* - The amount of will to add
|
||||
*
|
||||
* @return - The amount of will added
|
||||
*/
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
for (ItemStack stack : inventory)
|
||||
{
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
if (stack != null && stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||
|
||||
if (remaining <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||
if (remaining <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return amount - remaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an IDiscreteDemonWill contained in an ItemStack to one of the Soul Gems in
|
||||
* the player's inventory while ignoring a specified stack.
|
||||
*
|
||||
* @param type
|
||||
* - The type of Will to add
|
||||
* @param player
|
||||
* - The player to check the Will of
|
||||
* @param amount
|
||||
* - The amount of will to add
|
||||
* @param ignored
|
||||
* - A stack to ignore
|
||||
*
|
||||
* @return - The amount of will added
|
||||
*/
|
||||
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount, ItemStack ignored)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
for (ItemStack stack : inventory)
|
||||
{
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null && !stack.equals(ignored))
|
||||
if (stack != null && !stack.equals(ignored) && stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||
|
||||
if (remaining <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (remaining <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue