Added the method to create the Omega armours, though it wasn't a secret for a while! :D

Added the ability to enchant omega armour in such a way that there won't be a single best method
A bunch of other stuff I can't remember. Fun times!
This commit is contained in:
WayofTime 2015-04-11 15:43:06 -04:00
parent afa3988a21
commit b725f7b814
34 changed files with 477 additions and 146 deletions

View file

@ -23,6 +23,8 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -36,6 +38,8 @@ public abstract class OmegaArmour extends BoundArmour
protected boolean storeYLevel = false;
protected boolean storeSeesSky = false;
public float reagentDrainPerDamage = 0.1f;
public OmegaArmour(int armorType)
{
super(armorType);
@ -94,13 +98,34 @@ public abstract class OmegaArmour extends BoundArmour
}
}
@Override
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.getItemDamage() > 0)
{
if (!player.capabilities.isCreativeMode)
{
if(EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75))
{
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player);
reagentAmount -= itemStack.getItemDamage() * reagentDrainPerDamage;
APISpellHelper.setPlayerCurrentReagentAmount(player, Math.max(0, reagentAmount));
itemStack.setItemDamage(0);
}
}
}
}
public void revertArmour(EntityPlayer player, ItemStack itemStack)
{
ItemStack stack = this.getContainedArmourStack(itemStack);
player.inventory.armorInventory[3-this.armorType] = stack;
}
public ItemStack getSubstituteStack(ItemStack boundStack, int stability, int affinity, int enchantability, Random rand)
public ItemStack getSubstituteStack(ItemStack boundStack, int stability, int affinity, int enchantability, int enchantmentLevel, Random rand)
{
ItemStack omegaStack = new ItemStack(this);
if(boundStack != null && boundStack.hasTagCompound())
@ -110,13 +135,16 @@ public abstract class OmegaArmour extends BoundArmour
}
this.setContainedArmourStack(omegaStack, boundStack);
SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack));
this.setItemEnchantability(omegaStack, 70);
this.setItemEnchantability(omegaStack, Math.min(enchantability, 70));
List enchantList = new ArrayList();
for(int i=0; i<100; i++)
int adjustedEnchantLevel = Math.min(enchantmentLevel, 30);
int additionalPasses = enchantmentLevel - adjustedEnchantLevel;
for(int i=0; i<1+additionalPasses; i++)
{
List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, 30);
List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, adjustedEnchantLevel);
if(lst != null)
{
enchantList.addAll(lst);