Anti-comments sweep!

This commit is contained in:
Tombenpotter 2014-10-13 22:33:20 +02:00
parent e6a10f3f06
commit dea1f87078
454 changed files with 23594 additions and 26739 deletions

View file

@ -2,26 +2,26 @@ package WayofTime.alchemicalWizardry.common.alchemy;
import net.minecraft.potion.Potion;
public class CombinedPotionComponent
public class CombinedPotionComponent
{
public Potion result;
public Potion pot1;
public Potion pot2;
public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2)
{
this.result = result;
this.pot1 = pot1;
this.pot2 = pot2;
}
public boolean isRecipeValid(Potion test1, Potion test2)
{
return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1);
}
public boolean isRecipeValid(int test1, int test2)
{
return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id);
}
public Potion result;
public Potion pot1;
public Potion pot2;
public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2)
{
this.result = result;
this.pot1 = pot1;
this.pot2 = pot2;
}
public boolean isRecipeValid(Potion test1, Potion test2)
{
return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1);
}
public boolean isRecipeValid(int test1, int test2)
{
return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id);
}
}

View file

@ -1,182 +1,182 @@
package WayofTime.alchemicalWizardry.common.alchemy;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
public class CombinedPotionRegistry
public class CombinedPotionRegistry
{
public static List<CombinedPotionComponent> potionList = new ArrayList();
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2)
{
potionList.add(new CombinedPotionComponent(result, pot1, pot2));
}
public static boolean isRecipeValid(Potion pot1, Potion pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
public static boolean isRecipeValid(int pot1, int pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
public static Potion getPotion(Potion pot1, Potion pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
public static Potion getPotion(int pot1, int pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
public static ItemStack applyPotionEffect(ItemStack stack)
{
if(stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return null;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null)
{
return stack;
}
boolean isDone = false;
for(AlchemyPotionHelper helper1 : list)
{
if(isDone)
{
continue;
}
for(int i=0; i<list.size(); i++)
{
if(isDone)
{
continue;
}
AlchemyPotionHelper helper2 = list.get(i);
PotionEffect potEffect = getResultantPotion(helper1, helper2);
if(potEffect != null)
{
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
list.remove(helper1);
list.remove(helper2);
list.add(potHelper);
isDone = true;
}
}
}
if(isDone)
{
AlchemyFlask.setEffects(stack, list);
return stack;
}
return null;
}
public static boolean hasCombinablePotionEffect(ItemStack stack)
{
if(stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return false;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null)
{
return false;
}
for(AlchemyPotionHelper helper1 : list)
{
for(AlchemyPotionHelper helper2 : list)
{
int pot1 = helper1.getPotionID();
int pot2 = helper2.getPotionID();
if(isRecipeValid(pot1, pot2))
{
return true;
}
}
}
return false;
}
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
{
if(potE1 == null || potE2 == null)
{
return null;
}
int pot1 = potE1.getPotionID();
int pot2 = potE2.getPotionID();
if(isRecipeValid(pot1, pot2))
{
int duration = (int)((potE1.getTickDuration()* Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor()))/2.0);
int amplifier = (potE1.getConcentration() + potE2.getConcentration())/2;
Potion pot = getPotion(pot1, pot2);
return new PotionEffect(pot.id, duration, amplifier);
}
return null;
}
public static List<CombinedPotionComponent> potionList = new ArrayList();
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2)
{
potionList.add(new CombinedPotionComponent(result, pot1, pot2));
}
public static boolean isRecipeValid(Potion pot1, Potion pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
public static boolean isRecipeValid(int pot1, int pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
public static Potion getPotion(Potion pot1, Potion pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
public static Potion getPotion(int pot1, int pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
public static ItemStack applyPotionEffect(ItemStack stack)
{
if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return null;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if (list == null)
{
return stack;
}
boolean isDone = false;
for (AlchemyPotionHelper helper1 : list)
{
if (isDone)
{
continue;
}
for (int i = 0; i < list.size(); i++)
{
if (isDone)
{
continue;
}
AlchemyPotionHelper helper2 = list.get(i);
PotionEffect potEffect = getResultantPotion(helper1, helper2);
if (potEffect != null)
{
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
list.remove(helper1);
list.remove(helper2);
list.add(potHelper);
isDone = true;
}
}
}
if (isDone)
{
AlchemyFlask.setEffects(stack, list);
return stack;
}
return null;
}
public static boolean hasCombinablePotionEffect(ItemStack stack)
{
if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return false;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if (list == null)
{
return false;
}
for (AlchemyPotionHelper helper1 : list)
{
for (AlchemyPotionHelper helper2 : list)
{
int pot1 = helper1.getPotionID();
int pot2 = helper2.getPotionID();
if (isRecipeValid(pot1, pot2))
{
return true;
}
}
}
return false;
}
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
{
if (potE1 == null || potE2 == null)
{
return null;
}
int pot1 = potE1.getPotionID();
int pot2 = potE2.getPotionID();
if (isRecipeValid(pot1, pot2))
{
int duration = (int) ((potE1.getTickDuration() * Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor())) / 2.0);
int amplifier = (potE1.getConcentration() + potE2.getConcentration()) / 2;
Potion pot = getPotion(pot1, pot2);
return new PotionEffect(pot.id, duration, amplifier);
}
return null;
}
}

View file

@ -1,6 +1,5 @@
package WayofTime.alchemicalWizardry.common.alchemy;
public interface ICombinationalCatalyst
public interface ICombinationalCatalyst
{
}