Renamed nomenclature to Demonic Will instead of souls - still missing a few spots
This commit is contained in:
parent
9eb49dd5a9
commit
61e6cf2a14
42 changed files with 334 additions and 339 deletions
|
@ -12,7 +12,7 @@ import net.minecraft.util.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class SoulForgeRecipe
|
||||
public class TartaricForgeRecipe
|
||||
{
|
||||
protected ItemStack output = null;
|
||||
protected ArrayList<Object> input = new ArrayList<Object>();
|
||||
|
@ -21,17 +21,17 @@ public class SoulForgeRecipe
|
|||
@Getter
|
||||
protected double soulsDrained;
|
||||
|
||||
public SoulForgeRecipe(Block result, double minSouls, double drain, Object... recipe)
|
||||
public TartaricForgeRecipe(Block result, double minSouls, double drain, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), minSouls, drain, recipe);
|
||||
}
|
||||
|
||||
public SoulForgeRecipe(Item result, double minSouls, double drain, Object... recipe)
|
||||
public TartaricForgeRecipe(Item result, double minSouls, double drain, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), minSouls, drain, recipe);
|
||||
}
|
||||
|
||||
public SoulForgeRecipe(ItemStack result, double minSouls, double drain, Object... recipe)
|
||||
public TartaricForgeRecipe(ItemStack result, double minSouls, double drain, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
this.minimumSouls = minSouls;
|
|
@ -7,26 +7,26 @@ import lombok.Getter;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.recipe.SoulForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
|
||||
public class SoulForgeRecipeRegistry
|
||||
public class TartaricForgeRecipeRegistry
|
||||
{
|
||||
@Getter
|
||||
private static List<SoulForgeRecipe> recipeList = new ArrayList<SoulForgeRecipe>();
|
||||
private static List<TartaricForgeRecipe> recipeList = new ArrayList<TartaricForgeRecipe>();
|
||||
|
||||
public static void registerRecipe(SoulForgeRecipe recipe)
|
||||
public static void registerRecipe(TartaricForgeRecipe recipe)
|
||||
{
|
||||
recipeList.add(recipe);
|
||||
}
|
||||
|
||||
public static void registerRecipe(ItemStack outputStack, double minimulSouls, double drain, Object... objects)
|
||||
{
|
||||
registerRecipe(new SoulForgeRecipe(outputStack, minimulSouls, drain, objects));
|
||||
registerRecipe(new TartaricForgeRecipe(outputStack, minimulSouls, drain, objects));
|
||||
}
|
||||
|
||||
public static SoulForgeRecipe getMatchingRecipe(List<ItemStack> itemList, World world, BlockPos pos)
|
||||
public static TartaricForgeRecipe getMatchingRecipe(List<ItemStack> itemList, World world, BlockPos pos)
|
||||
{
|
||||
for (SoulForgeRecipe recipe : recipeList)
|
||||
for (TartaricForgeRecipe recipe : recipeList)
|
||||
{
|
||||
if (recipe.matches(itemList, world, pos))
|
||||
{
|
30
src/main/java/WayofTime/bloodmagic/api/soul/IDemonWill.java
Normal file
30
src/main/java/WayofTime/bloodmagic/api/soul/IDemonWill.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDemonWill
|
||||
{
|
||||
public double getWill(ItemStack soulStack);
|
||||
|
||||
public 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
|
||||
* @param drainAmount
|
||||
* @return The amount of will drained.
|
||||
*/
|
||||
public double drainWill(ItemStack willStack, double drainAmount);
|
||||
|
||||
/**
|
||||
* Creates a new ItemStack with the specified number of will. Implementation
|
||||
* should respect the number requested.
|
||||
*
|
||||
* @param meta
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public ItemStack createWill(int meta, double number);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDemonWillGem
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param willGemStack
|
||||
* - The ItemStack for this demon will gem.
|
||||
* @param willStack
|
||||
* - The ItemStack for the will. Item should extend IDemonWill
|
||||
* @return - The remainder willStack after the will has been absorbed into
|
||||
* the gem. Return null if there is no will left in the stack.
|
||||
*/
|
||||
public ItemStack fillDemonWillGem(ItemStack willGemStack, ItemStack willStack);
|
||||
|
||||
/**
|
||||
* Returns the number of souls that are left in the soul gem. Returns a
|
||||
* double because souls can be fractionally drained.
|
||||
*
|
||||
* @param willGemStack
|
||||
* @return
|
||||
*/
|
||||
public double getWill(ItemStack willGemStack);
|
||||
|
||||
public void setWill(ItemStack willGemStack, double amount);
|
||||
|
||||
public int getMaxWill(ItemStack willGemStack);
|
||||
|
||||
public double drainWill(ItemStack stack, double drainAmount);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDemonWillWeapon
|
||||
{
|
||||
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISoul
|
||||
{
|
||||
public double getSouls(ItemStack soulStack);
|
||||
|
||||
public void setSouls(ItemStack soulStack, double souls);
|
||||
|
||||
/**
|
||||
* Drains the souls from the soulStack. If all of the souls are drained, the
|
||||
* soulStack will be removed.
|
||||
*
|
||||
* @param soulStack
|
||||
* @param drainAmount
|
||||
* @return The number of souls drained.
|
||||
*/
|
||||
public double drainSouls(ItemStack soulStack, double drainAmount);
|
||||
|
||||
/**
|
||||
* Creates a new ItemStack with the specified number of souls.
|
||||
* Implementation should respect the number requested.
|
||||
*
|
||||
* @param meta
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public ItemStack createSoul(int meta, double number);
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISoulGem
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param soulGemStack
|
||||
* - The ItemStack for this soul gem.
|
||||
* @param soulStack
|
||||
* - The ItemStack for the soul. Item should extend ISoul
|
||||
* @return - The remainder soulStack after the souls have been absorbed into
|
||||
* the gem. Return null if there are no souls left in the stack.
|
||||
*/
|
||||
public ItemStack fillSoulGem(ItemStack soulGemStack, ItemStack soulStack);
|
||||
|
||||
/**
|
||||
* Returns the number of souls that are left in the soul gem. Returns a
|
||||
* double because souls can be fractionally drained.
|
||||
*
|
||||
* @param soulGemStack
|
||||
* @return
|
||||
*/
|
||||
public double getSouls(ItemStack soulGemStack);
|
||||
|
||||
public void setSouls(ItemStack soulGemStack, double amount);
|
||||
|
||||
public int getMaxSouls(ItemStack soulGemStack);
|
||||
|
||||
public double drainSouls(ItemStack stack, double drainAmount);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package WayofTime.bloodmagic.api.soul;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISoulWeapon
|
||||
{
|
||||
public List<ItemStack> getRandomSoulDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting);
|
||||
}
|
|
@ -12,9 +12,9 @@ import net.minecraft.item.ItemStack;
|
|||
* @author WayofTime
|
||||
*
|
||||
*/
|
||||
public class PlayerSoulHandler
|
||||
public class PlayerDemonWillHandler
|
||||
{
|
||||
public static double getTotalSouls(EntityPlayer player)
|
||||
public static double getTotalDemonWill(EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double souls = 0;
|
||||
|
@ -24,12 +24,12 @@ public class PlayerSoulHandler
|
|||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof ISoul)
|
||||
if (stack.getItem() instanceof IDemonWill)
|
||||
{
|
||||
souls += ((ISoul) stack.getItem()).getSouls(stack);
|
||||
} else if (stack.getItem() instanceof ISoulGem)
|
||||
souls += ((IDemonWill) stack.getItem()).getWill(stack);
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
souls += ((ISoulGem) stack.getItem()).getSouls(stack);
|
||||
souls += ((IDemonWillGem) stack.getItem()).getWill(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class PlayerSoulHandler
|
|||
* @param amount
|
||||
* @return - amount consumed
|
||||
*/
|
||||
public static double consumeSouls(EntityPlayer player, double amount)
|
||||
public static double consumeDemonWill(EntityPlayer player, double amount)
|
||||
{
|
||||
double consumed = 0;
|
||||
|
||||
|
@ -59,16 +59,16 @@ public class PlayerSoulHandler
|
|||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof ISoul)
|
||||
if (stack.getItem() instanceof IDemonWill)
|
||||
{
|
||||
consumed += ((ISoul) stack.getItem()).drainSouls(stack, amount - consumed);
|
||||
if (((ISoul) stack.getItem()).getSouls(stack) <= 0)
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(stack) <= 0)
|
||||
{
|
||||
inventory[i] = null;
|
||||
}
|
||||
} else if (stack.getItem() instanceof ISoulGem)
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
consumed += ((ISoulGem) stack.getItem()).drainSouls(stack, amount - consumed);
|
||||
consumed += ((IDemonWillGem) stack.getItem()).drainWill(stack, amount - consumed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,15 +77,15 @@ public class PlayerSoulHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds an ISoul contained in an ItemStack to one of the Soul Gems in the
|
||||
* player's inventory.
|
||||
* Adds an IDemonWill contained in an ItemStack to one of the Soul Gems in
|
||||
* the player's inventory.
|
||||
*
|
||||
* @param player
|
||||
* @param soulStack
|
||||
* - ItemStack that contains an ISoul to be added
|
||||
* - ItemStack that contains an IDemonWill to be added
|
||||
* @return
|
||||
*/
|
||||
public static ItemStack addSouls(EntityPlayer player, ItemStack soulStack)
|
||||
public static ItemStack addDemonWill(EntityPlayer player, ItemStack soulStack)
|
||||
{
|
||||
if (soulStack == null)
|
||||
{
|
||||
|
@ -99,9 +99,9 @@ public class PlayerSoulHandler
|
|||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof ISoulGem)
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
ItemStack newStack = ((ISoulGem) stack.getItem()).fillSoulGem(stack, soulStack);
|
||||
ItemStack newStack = ((IDemonWillGem) stack.getItem()).fillDemonWillGem(stack, soulStack);
|
||||
if (newStack == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -113,7 +113,7 @@ public class PlayerSoulHandler
|
|||
return soulStack;
|
||||
}
|
||||
|
||||
public static double addSouls(EntityPlayer player, double amount)
|
||||
public static double addDemonWill(EntityPlayer player, double amount)
|
||||
{
|
||||
ItemStack[] inventory = player.inventory.mainInventory;
|
||||
double remaining = amount;
|
||||
|
@ -123,11 +123,11 @@ public class PlayerSoulHandler
|
|||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof ISoulGem)
|
||||
if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
double souls = ((ISoulGem) stack.getItem()).getSouls(stack);
|
||||
double fill = Math.min(((ISoulGem) stack.getItem()).getMaxSouls(stack) - souls, remaining);
|
||||
((ISoulGem) stack.getItem()).setSouls(stack, fill + souls);
|
||||
double souls = ((IDemonWillGem) stack.getItem()).getWill(stack);
|
||||
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(stack) - souls, remaining);
|
||||
((IDemonWillGem) stack.getItem()).setWill(stack, fill + souls);
|
||||
remaining -= fill;
|
||||
|
||||
if (remaining <= 0)
|
Loading…
Add table
Add a link
Reference in a new issue