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
|
@ -13,7 +13,7 @@ buildscript {
|
||||||
plugins {
|
plugins {
|
||||||
id "net.minecraftforge.gradle.forge" version "2.0.2"
|
id "net.minecraftforge.gradle.forge" version "2.0.2"
|
||||||
id 'com.matthewprenger.cursegradle' version '1.0.7'
|
id 'com.matthewprenger.cursegradle' version '1.0.7'
|
||||||
id 'net.franz-becker.gradle-lombok' version '1.5'
|
id 'io.franzbecker.gradle-lombok' version '1.6'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
@ -110,12 +110,16 @@ lombok {
|
||||||
sha256 = "e0a471be03e1e6b02bf019480cec7a3ac9801702bf7bf62f15d077ad4df8dd5d"
|
sha256 = "e0a471be03e1e6b02bf019480cec7a3ac9801702bf7bf62f15d077ad4df8dd5d"
|
||||||
}
|
}
|
||||||
|
|
||||||
import net.franz_becker.gradle.lombok.task.DelombokTask
|
import io.franzbecker.gradle.lombok.task.DelombokTask
|
||||||
|
|
||||||
task delombok(type: DelombokTask) {
|
task delombok(type: DelombokTask) {
|
||||||
args("src/main/java", "-d", "build/sources/delomboked/java")
|
args("src/main/java", "-d", "build/sources/delomboked/java")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task delombokHelp(type: DelombokTask) {
|
||||||
|
args "--help"
|
||||||
|
}
|
||||||
|
|
||||||
tasks.eclipse.dependsOn installLombok
|
tasks.eclipse.dependsOn installLombok
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class LivingArmourUpgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Percentage of damage blocked. This stacks multiplicatively with other
|
* Percentage of damage blocked. This stacks multiplicities with other
|
||||||
* upgrades.
|
* upgrades.
|
||||||
*
|
*
|
||||||
* @return 0 for no damage blocked, 1 for full damage blocked
|
* @return 0 for no damage blocked, 1 for full damage blocked
|
||||||
|
@ -54,9 +54,6 @@ public abstract class LivingArmourUpgrade
|
||||||
|
|
||||||
public abstract String getUnlocalizedName();
|
public abstract String getUnlocalizedName();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public abstract int getMaxTier();
|
public abstract int getMaxTier();
|
||||||
|
|
||||||
public abstract int getCostOfUpgrade();
|
public abstract int getCostOfUpgrade();
|
||||||
|
@ -67,7 +64,7 @@ public abstract class LivingArmourUpgrade
|
||||||
|
|
||||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||||
{
|
{
|
||||||
return HashMultimap.<String, AttributeModifier>create();
|
return HashMultimap.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void writeToNBT(NBTTagCompound tag);
|
public abstract void writeToNBT(NBTTagCompound tag);
|
||||||
|
|
|
@ -53,9 +53,7 @@ public class AlchemyArrayRecipeRegistry
|
||||||
{
|
{
|
||||||
arrayRecipe.catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
arrayRecipe.catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
||||||
if (circleRenderer != null)
|
if (circleRenderer != null)
|
||||||
{
|
|
||||||
arrayRecipe.circleRenderer = circleRenderer;
|
arrayRecipe.circleRenderer = circleRenderer;
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,15 +87,7 @@ public class AlchemyArrayRecipeRegistry
|
||||||
|
|
||||||
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||||
{
|
{
|
||||||
AlchemyCircleRenderer circleRenderer = null;
|
AlchemyCircleRenderer circleRenderer = arrayResource == null ? defaultRenderer : new AlchemyCircleRenderer(arrayResource);
|
||||||
if (arrayResource == null)
|
|
||||||
{
|
|
||||||
circleRenderer = defaultRenderer;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
circleRenderer = new AlchemyCircleRenderer(arrayResource);
|
|
||||||
}
|
|
||||||
|
|
||||||
registerRecipe(inputStack, catalystStack, arrayEffect, circleRenderer);
|
registerRecipe(inputStack, catalystStack, arrayEffect, circleRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,16 +99,13 @@ public class AlchemyArrayRecipeRegistry
|
||||||
public static void replaceAlchemyCircle(ItemStack inputStack, AlchemyCircleRenderer circleRenderer)
|
public static void replaceAlchemyCircle(ItemStack inputStack, AlchemyCircleRenderer circleRenderer)
|
||||||
{
|
{
|
||||||
if (circleRenderer == null)
|
if (circleRenderer == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||||
{
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||||
{
|
|
||||||
arrayRecipe.circleRenderer = circleRenderer;
|
arrayRecipe.circleRenderer = circleRenderer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,11 +120,7 @@ public class AlchemyArrayRecipeRegistry
|
||||||
{
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
if (ItemStackWrapper.getHolder(arrayRecipe.getInputStack()).equals(ItemStackWrapper.getHolder(inputStack)))
|
if (ItemStackWrapper.getHolder(arrayRecipe.getInputStack()).equals(ItemStackWrapper.getHolder(inputStack)))
|
||||||
{
|
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack); // TODO: Decide if a copy should be returned.
|
||||||
AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
|
||||||
|
|
||||||
return effect; // TODO: Decide if a copy should be returned.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -149,9 +132,7 @@ public class AlchemyArrayRecipeRegistry
|
||||||
{
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||||
{
|
|
||||||
return arrayRecipe.circleRenderer;
|
return arrayRecipe.circleRenderer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultRenderer;
|
return defaultRenderer;
|
||||||
|
@ -181,14 +162,12 @@ public class AlchemyArrayRecipeRegistry
|
||||||
* inputStack.
|
* inputStack.
|
||||||
*
|
*
|
||||||
* @param comparedStack
|
* @param comparedStack
|
||||||
* @return - true if the ItemStack is a compatible item
|
* - The stack to compare with
|
||||||
|
*
|
||||||
|
* @return - True if the ItemStack is a compatible item
|
||||||
*/
|
*/
|
||||||
public boolean doesInputMatchRecipe(ItemStack comparedStack)
|
public boolean doesInputMatchRecipe(ItemStack comparedStack) {
|
||||||
{
|
return !(comparedStack == null || this.inputStack == null) && this.inputStack.isItemEqual(comparedStack);
|
||||||
if (comparedStack == null || this.inputStack == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return this.inputStack.isItemEqual(comparedStack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,27 +175,23 @@ public class AlchemyArrayRecipeRegistry
|
||||||
*
|
*
|
||||||
* @param comparedStack
|
* @param comparedStack
|
||||||
* The catalyst that is being checked
|
* The catalyst that is being checked
|
||||||
* @return
|
*
|
||||||
|
* @return - The effect
|
||||||
*/
|
*/
|
||||||
public AlchemyArrayEffect getAlchemyArrayEffectForCatalyst(@Nullable ItemStack comparedStack)
|
public AlchemyArrayEffect getAlchemyArrayEffectForCatalyst(@Nullable ItemStack comparedStack)
|
||||||
{
|
{
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
for (Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
||||||
{
|
{
|
||||||
ItemStack catalystStack = entry.getKey().toStack();
|
ItemStack catalystStack = entry.getKey().toStack();
|
||||||
|
|
||||||
if (comparedStack == null && catalystStack == null)
|
if (comparedStack == null && catalystStack == null)
|
||||||
{
|
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
|
||||||
|
|
||||||
if (comparedStack == null || catalystStack == null)
|
if (comparedStack == null || catalystStack == null)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (catalystStack.isItemEqual(comparedStack))
|
if (catalystStack.isItemEqual(comparedStack))
|
||||||
{
|
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -86,9 +86,9 @@ public abstract class Ritual
|
||||||
public abstract void performRitual(IMasterRitualStone masterRitualStone);
|
public abstract void performRitual(IMasterRitualStone masterRitualStone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the ritual is stopped for a given {@link BreakType}.
|
* Called when the ritual is stopped for a given {@link Ritual.BreakType}.
|
||||||
*
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(Ritual.BreakType)}
|
||||||
*
|
*
|
||||||
* @param masterRitualStone
|
* @param masterRitualStone
|
||||||
* - The {@link IMasterRitualStone} that the ritual is bound to
|
* - The {@link IMasterRitualStone} that the ritual is bound to
|
||||||
|
|
|
@ -4,27 +4,49 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IDemonWill
|
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
|
* Drains the demonic will from the willStack. If all of the will is
|
||||||
* drained, the willStack will be removed.
|
* drained, the willStack will be removed.
|
||||||
*
|
*
|
||||||
* @param willStack
|
* @param willStack
|
||||||
|
* - The ItemStack of the will
|
||||||
* @param drainAmount
|
* @param drainAmount
|
||||||
|
* - The amount of Will to drain
|
||||||
|
*
|
||||||
* @return The amount of will drained.
|
* @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
|
* Creates a new ItemStack with the specified number of will. Implementation
|
||||||
* should respect the number requested.
|
* should respect the number requested.
|
||||||
*
|
*
|
||||||
* @param meta
|
* @param meta
|
||||||
|
* - The meta of the ItemStack to create
|
||||||
* @param number
|
* @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 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
|
* Drains the demonic will from the willStack. If all of the will is
|
||||||
* drained, the willStack will be removed. Will only drain in discrete
|
* drained, the willStack will be removed. Will only drain in discrete
|
||||||
* amounts, determined by getDiscretization.
|
* amounts, determined by getDiscretization.
|
||||||
*
|
*
|
||||||
* @param willStack
|
* @param willStack
|
||||||
|
* - The ItemStack of the will
|
||||||
* @param drainAmount
|
* @param drainAmount
|
||||||
|
* - The amount of Will to drain
|
||||||
|
*
|
||||||
* @return The amount of will drained.
|
* @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.
|
* Gets the discrete number for this demonic will.
|
||||||
*
|
*
|
||||||
* @param willStack
|
* @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
|
* This class provides several helper methods in order to handle soul
|
||||||
* consumption and use for a player. This refers to the Soul System, meaning
|
* 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
|
* Monster Souls and Soul Gems, etc. The Soul Network's helper methods are found
|
||||||
* in WayofTime.bloodmagic.api.network
|
* in {@link WayofTime.bloodmagic.api.network.SoulNetwork}
|
||||||
*
|
|
||||||
* @author WayofTime
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class PlayerDemonWillHandler
|
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)
|
public static double getTotalDemonWill(EnumDemonWillType type, EntityPlayer player)
|
||||||
{
|
{
|
||||||
ItemStack[] inventory = player.inventory.mainInventory;
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
double souls = 0;
|
double souls = 0;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.length; i++)
|
for (ItemStack stack : inventory) {
|
||||||
{
|
if (stack != null) {
|
||||||
ItemStack stack = inventory[i];
|
if (stack.getItem() instanceof IDemonWill) {
|
||||||
if (stack != null)
|
|
||||||
{
|
|
||||||
if (stack.getItem() instanceof IDemonWill)
|
|
||||||
{
|
|
||||||
souls += ((IDemonWill) stack.getItem()).getWill(stack);
|
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);
|
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
|
* Checks if the player's Tartaric gems are completely full.
|
||||||
* return true.
|
*
|
||||||
*
|
* @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)
|
public static boolean isDemonWillFull(EnumDemonWillType type, EntityPlayer player)
|
||||||
{
|
{
|
||||||
ItemStack[] inventory = player.inventory.mainInventory;
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
|
|
||||||
boolean hasGem = false;
|
boolean hasGem = false;
|
||||||
for (int i = 0; i < inventory.length; i++)
|
for (ItemStack stack : inventory) {
|
||||||
{
|
if (stack != null && stack.getItem() instanceof IDemonWillGem) {
|
||||||
ItemStack stack = inventory[i];
|
hasGem = true;
|
||||||
if (stack != null)
|
if (((IDemonWillGem) stack.getItem()).getWill(type, stack) < ((IDemonWillGem) stack.getItem()).getMaxWill(type, stack))
|
||||||
{
|
return false;
|
||||||
if (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
|
* @param player
|
||||||
|
* - The player to consume the will of
|
||||||
* @param amount
|
* @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)
|
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++)
|
for (int i = 0; i < inventory.length; i++)
|
||||||
{
|
{
|
||||||
if (consumed >= amount)
|
if (consumed >= amount)
|
||||||
{
|
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = inventory[i];
|
ItemStack stack = inventory[i];
|
||||||
if (stack != null)
|
if (stack != null)
|
||||||
|
@ -92,9 +93,7 @@ public class PlayerDemonWillHandler
|
||||||
{
|
{
|
||||||
consumed += ((IDemonWill) stack.getItem()).drainWill(stack, amount - consumed);
|
consumed += ((IDemonWill) stack.getItem()).drainWill(stack, amount - consumed);
|
||||||
if (((IDemonWill) stack.getItem()).getWill(stack) <= 0)
|
if (((IDemonWill) stack.getItem()).getWill(stack) <= 0)
|
||||||
{
|
|
||||||
inventory[i] = null;
|
inventory[i] = null;
|
||||||
}
|
|
||||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||||
{
|
{
|
||||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed);
|
consumed += ((IDemonWillGem) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||||
|
@ -110,82 +109,91 @@ public class PlayerDemonWillHandler
|
||||||
* the player's inventory.
|
* the player's inventory.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param soulStack
|
* - The player to add will to
|
||||||
* - ItemStack that contains an IDemonWill to be added
|
* @param willStack
|
||||||
* @return
|
* - 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;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack[] inventory = player.inventory.mainInventory;
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.length; i++)
|
for (ItemStack stack : inventory)
|
||||||
{
|
{
|
||||||
ItemStack stack = inventory[i];
|
if (stack != null && stack.getItem() instanceof IDemonWillGem)
|
||||||
if (stack != null)
|
|
||||||
{
|
{
|
||||||
if (stack.getItem() instanceof IDemonWillGem)
|
ItemStack newStack = ((IDemonWillGem) stack.getItem()).fillDemonWillGem(stack, willStack);
|
||||||
{
|
if (newStack == null)
|
||||||
ItemStack newStack = ((IDemonWillGem) stack.getItem()).fillDemonWillGem(stack, soulStack);
|
return null;
|
||||||
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)
|
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount)
|
||||||
{
|
{
|
||||||
ItemStack[] inventory = player.inventory.mainInventory;
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
double remaining = amount;
|
double remaining = amount;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.length; i++)
|
for (ItemStack stack : inventory)
|
||||||
{
|
{
|
||||||
ItemStack stack = inventory[i];
|
if (stack != null && stack.getItem() instanceof IDemonWillGem)
|
||||||
if (stack != null)
|
|
||||||
{
|
{
|
||||||
if (stack.getItem() instanceof IDemonWillGem)
|
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||||
{
|
if (remaining <= 0)
|
||||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
break;
|
||||||
|
|
||||||
if (remaining <= 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return amount - remaining;
|
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)
|
public static double addDemonWill(EnumDemonWillType type, EntityPlayer player, double amount, ItemStack ignored)
|
||||||
{
|
{
|
||||||
ItemStack[] inventory = player.inventory.mainInventory;
|
ItemStack[] inventory = player.inventory.mainInventory;
|
||||||
double remaining = amount;
|
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) && stack.getItem() instanceof IDemonWillGem)
|
||||||
if (stack != null && !stack.equals(ignored))
|
|
||||||
{
|
{
|
||||||
if (stack.getItem() instanceof IDemonWillGem)
|
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
||||||
{
|
|
||||||
remaining -= ((IDemonWillGem) stack.getItem()).fillWill(type, stack, remaining);
|
|
||||||
|
|
||||||
if (remaining <= 0)
|
if (remaining <= 0)
|
||||||
{
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@ import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
|
@Getter
|
||||||
public class ChunkPairSerializable implements Serializable
|
public class ChunkPairSerializable implements Serializable
|
||||||
{
|
{
|
||||||
@Getter
|
|
||||||
private int chunkXPos;
|
private int chunkXPos;
|
||||||
@Getter
|
|
||||||
private int chunkZPos;
|
private int chunkZPos;
|
||||||
|
|
||||||
public ChunkPairSerializable(int chunkXPos, int chunkZPos)
|
public ChunkPairSerializable(int chunkXPos, int chunkZPos)
|
||||||
|
@ -35,34 +34,4 @@ public class ChunkPairSerializable implements Serializable
|
||||||
public BlockPos getChunkCenter(){
|
public BlockPos getChunkCenter(){
|
||||||
return getChunkCenter(64);
|
return getChunkCenter(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o)
|
|
||||||
{
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
ChunkPairSerializable that = (ChunkPairSerializable) o;
|
|
||||||
|
|
||||||
if (chunkXPos != that.chunkXPos) return false;
|
|
||||||
return chunkZPos == that.chunkZPos;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
int result = chunkXPos;
|
|
||||||
result = 31 * result + chunkZPos;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "ChunkPairSerializable{" +
|
|
||||||
"chunkXPos=" + chunkXPos +
|
|
||||||
", chunkZPos=" + chunkZPos +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,9 @@ public class DefaultItemFilter implements IItemFilter
|
||||||
* managing receives an ItemStack. Should only really be called by the Input
|
* managing receives an ItemStack. Should only really be called by the Input
|
||||||
* filter via it's transfer method.
|
* filter via it's transfer method.
|
||||||
*
|
*
|
||||||
* @param stack
|
* @param inputStack
|
||||||
* -
|
* - The stack to transfer
|
||||||
|
*
|
||||||
* @return - The remainder of the stack after it has been absorbed into the
|
* @return - The remainder of the stack after it has been absorbed into the
|
||||||
* inventory.
|
* inventory.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,27 +8,28 @@ import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
public interface IItemFilter
|
public interface IItemFilter
|
||||||
{
|
{
|
||||||
public void initializeFilter(List<ItemStack> filteredList, IInventory inventory, EnumFacing side, boolean isFilterOutput);
|
void initializeFilter(List<ItemStack> filteredList, IInventory inventory, EnumFacing side, boolean isFilterOutput);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is only called when the output inventory this filter is
|
* This method is only called when the output inventory this filter is
|
||||||
* managing receives an ItemStack. Should only really be called by the Input
|
* managing receives an ItemStack. Should only really be called by the Input
|
||||||
* filter via it's transfer method.
|
* filter via it's transfer method.
|
||||||
*
|
*
|
||||||
* @param stack
|
* @param inputStack
|
||||||
* -
|
* - The stack to filter
|
||||||
|
*
|
||||||
* @return - The remainder of the stack after it has been absorbed into the
|
* @return - The remainder of the stack after it has been absorbed into the
|
||||||
* inventory.
|
* inventory.
|
||||||
*/
|
*/
|
||||||
public ItemStack transferStackThroughOutputFilter(ItemStack inputStack);
|
ItemStack transferStackThroughOutputFilter(ItemStack inputStack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is only called on an input filter to transfer ItemStacks from
|
* This method is only called on an input filter to transfer ItemStacks from
|
||||||
* the input inventory to the output inventory.
|
* the input inventory to the output inventory.
|
||||||
*/
|
*/
|
||||||
public int transferThroughInputFilter(IItemFilter outputFilter, int maxTransfer);
|
int transferThroughInputFilter(IItemFilter outputFilter, int maxTransfer);
|
||||||
|
|
||||||
public boolean doesStackMatchFilter(ItemStack testStack);
|
boolean doesStackMatchFilter(ItemStack testStack);
|
||||||
|
|
||||||
public boolean doStacksMatch(ItemStack filterStack, ItemStack testStack);
|
boolean doStacksMatch(ItemStack filterStack, ItemStack testStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,8 +162,8 @@ public class TestItemFilter implements IItemFilter
|
||||||
* managing receives an ItemStack. Should only really be called by the Input
|
* managing receives an ItemStack. Should only really be called by the Input
|
||||||
* filter via it's transfer method.
|
* filter via it's transfer method.
|
||||||
*
|
*
|
||||||
* @param stack
|
* @param inputStack
|
||||||
* -
|
* - The stack to transfer
|
||||||
* @return - The remainder of the stack after it has been absorbed into the
|
* @return - The remainder of the stack after it has been absorbed into the
|
||||||
* inventory.
|
* inventory.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue