API fun
This commit is contained in:
parent
a1ca81423b
commit
d229da6272
75 changed files with 1868 additions and 1866 deletions
|
@ -1,110 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.alchemy;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlchemicalPotionCreationHandler
|
||||
{
|
||||
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();
|
||||
|
||||
public static void initializePotions()
|
||||
{
|
||||
addPotion(new ItemStack(Item.ghastTear), Potion.regeneration.id, 450);
|
||||
addPotion(new ItemStack(Item.goldenCarrot), Potion.nightVision.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.magmaCream), Potion.fireResistance.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.bucketWater), Potion.waterBreathing.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.sugar), Potion.moveSpeed.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.speckledMelon), Potion.heal.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.spiderEye), Potion.poison.id, 450);
|
||||
addPotion(new ItemStack(Item.fermentedSpiderEye), Potion.weakness.id, 450);
|
||||
addPotion(new ItemStack(Item.blazePowder), Potion.damageBoost.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(ModItems.aether), Potion.jump.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.clay), Potion.moveSlowdown.id, 450);
|
||||
addPotion(new ItemStack(Item.redstone), Potion.digSpeed.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.potion, 1, 0), AlchemicalWizardry.customPotionDrowning.id, 450);
|
||||
//addPotion(new ItemStack(Item.goldenCarrot),Potion.nightVision.id,2*60*20);
|
||||
addPotion(new ItemStack(Item.glassBottle), Potion.invisibility.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.diamond), Potion.resistance.id, 2 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.poisonousPotato), Potion.field_76443_y.id, 2); //saturation
|
||||
addPotion(new ItemStack(ModItems.demonBloodShard), Potion.field_76434_w.id, 4 * 60 * 20); //health boost
|
||||
addPotion(new ItemStack(ModItems.weakBloodShard), Potion.field_76444_x.id, 4 * 60 * 20); //Absorption
|
||||
addPotion(new ItemStack(ModItems.terrae), AlchemicalWizardry.customPotionBoost.id, 1 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.feather), AlchemicalWizardry.customPotionFlight.id, 1 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.arrow), AlchemicalWizardry.customPotionReciprocation.id, 1 * 60 * 20);
|
||||
addPotion(new ItemStack(Item.enderPearl),AlchemicalWizardry.customPotionPlanarBinding.id,1*60*20);
|
||||
}
|
||||
|
||||
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration));
|
||||
}
|
||||
|
||||
public static int getPotionIDForStack(ItemStack itemStack)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
return aphc.getPotionID();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getPotionTickDurationForStack(ItemStack itemStack)
|
||||
{
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
return aphc.getTickDuration();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList)
|
||||
{
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.alchemy;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemyPotionHandlerComponent
|
||||
{
|
||||
private ItemStack itemStack;
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
|
||||
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
}
|
||||
|
||||
public boolean compareItemStack(ItemStack comparedStack)
|
||||
{
|
||||
if (comparedStack != null && itemStack != null)
|
||||
{
|
||||
if (comparedStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return comparedStack.itemID == itemStack.itemID && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
} else if (!(itemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
return comparedStack.itemID == itemStack.itemID && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public int getPotionID()
|
||||
{
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration()
|
||||
{
|
||||
return this.tickDuration;
|
||||
}
|
||||
}
|
|
@ -119,44 +119,6 @@ public class AlchemyRecipe
|
|||
}
|
||||
|
||||
return true;
|
||||
// if(slottedBloodOrbLevel<bloodOrbLevel)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if(items.length<5)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// for(int i=0;i<5;i++)
|
||||
// {
|
||||
// ItemStack itemStackR = this.recipe[i];
|
||||
// ItemStack itemStackC = items[i];
|
||||
//
|
||||
// if(itemStackR==null&&itemStackC==null)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if(itemStackR==null||itemStackC==null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// Item itemR = itemStackR.getItem();
|
||||
// Item itemC = itemStackC.getItem();
|
||||
//
|
||||
// if(itemR.equals(itemC))
|
||||
// {
|
||||
// continue;
|
||||
// }else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue