Added altar recipe registry
This commit is contained in:
parent
eb46185dc8
commit
17f63200aa
4 changed files with 196 additions and 137 deletions
|
@ -0,0 +1,70 @@
|
|||
package WayofTime.alchemicalWizardry.common.altarRecipeRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AltarRecipe
|
||||
{
|
||||
public int minTier;
|
||||
public int liquidRequired;
|
||||
public boolean canBeFilled; //Tells the system that the item is an orb
|
||||
public int consumptionRate;
|
||||
public int drainRate;
|
||||
public ItemStack requiredItem;
|
||||
public ItemStack result;
|
||||
|
||||
public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
|
||||
{
|
||||
this.result = result;
|
||||
this.requiredItem = requiredItem;
|
||||
this.minTier = minTier;
|
||||
this.liquidRequired = liquidRequired;
|
||||
this.consumptionRate = consumptionRate;
|
||||
this.drainRate = drainRate;
|
||||
this.canBeFilled = canBeFilled;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ItemStack getRequiredItem()
|
||||
{
|
||||
return this.requiredItem;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
|
||||
{
|
||||
if(comparedStack == null || this.requiredItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return tierCheck>=minTier && this.requiredItem.isItemEqual(comparedStack);
|
||||
}
|
||||
|
||||
public int getMinTier()
|
||||
{
|
||||
return this.minTier;
|
||||
}
|
||||
|
||||
public int getLiquidRequired()
|
||||
{
|
||||
return this.liquidRequired;
|
||||
}
|
||||
|
||||
public int getConsumptionRate()
|
||||
{
|
||||
return this.consumptionRate;
|
||||
}
|
||||
|
||||
public int getDrainRate()
|
||||
{
|
||||
return this.drainRate;
|
||||
}
|
||||
|
||||
public boolean getCanBeFilled()
|
||||
{
|
||||
return this.canBeFilled;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package WayofTime.alchemicalWizardry.common.altarRecipeRegistry;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AltarRecipeRegistry
|
||||
{
|
||||
public static List<AltarRecipe> altarRecipes = new LinkedList();
|
||||
|
||||
public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
|
||||
{
|
||||
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
|
||||
}
|
||||
|
||||
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate)
|
||||
{
|
||||
registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true);
|
||||
}
|
||||
|
||||
public static void initRecipes()
|
||||
{
|
||||
registerAltarRecipe(new ItemStack(ModItems.weakBloodOrb), new ItemStack(Item.diamond),1,2000,2,1,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.apprenticeBloodOrb), new ItemStack(Item.emerald),2,5000,5,5,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.magicianBloodOrb), new ItemStack(Block.blockGold),3,5000,5,5,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.masterBloodOrb), new ItemStack(ModItems.weakBloodShard),4,40000,30,50,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.archmageBloodOrb), new ItemStack(ModItems.demonBloodShard),5,50000,5,5,false);
|
||||
|
||||
registerAltarOrbRecipe(new ItemStack(ModItems.weakBloodOrb),1,2);
|
||||
registerAltarOrbRecipe(new ItemStack(ModItems.apprenticeBloodOrb),2,5);
|
||||
registerAltarOrbRecipe(new ItemStack(ModItems.magicianBloodOrb),3,5);
|
||||
registerAltarOrbRecipe(new ItemStack(ModItems.masterBloodOrb),4,25);
|
||||
registerAltarOrbRecipe(new ItemStack(ModItems.archmageBloodOrb),5,50);
|
||||
|
||||
registerAltarRecipe(new ItemStack(ModItems.telepositionFocus), new ItemStack(Item.enderPearl),4,2000,10,10,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.enhancedTelepositionFocus), new ItemStack(ModItems.telepositionFocus),4,10000,25,15,false);
|
||||
registerAltarRecipe(new ItemStack(ModItems.imbuedSlate), new ItemStack(ModItems.imbuedSlate),4,15000,20,20,false);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for(AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for(AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return recipe.getResult();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for(AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue