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

@ -1,18 +1,14 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
@ -22,12 +18,16 @@ import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import com.google.common.collect.HashMultiset;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundAxe extends ItemAxe implements IBindable
{
public float efficiencyOnProperMaterial = 12.0F;

View file

@ -1,5 +1,24 @@
package WayofTime.alchemicalWizardry.common.items;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
@ -10,26 +29,6 @@ import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import java.util.ArrayList;
import java.util.List;
public class BoundShovel extends ItemSpade implements IBindable
{

View file

@ -8,8 +8,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySlime;

View file

@ -0,0 +1,42 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemEnchantmentGlyphBlock extends ItemBlock
{
public ItemEnchantmentGlyphBlock(Block block)
{
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
name = "enchantability";
break;
case 1:
name = "enchantmentLevel";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
@Override
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -0,0 +1,38 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemStabilityGlyphBlock extends ItemBlock
{
public ItemStabilityGlyphBlock(Block block)
{
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
name = "stability1";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
@Override
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -373,7 +373,14 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
this.setIsInvisible(itemStack, player.isPotionActive(Potion.invisibility.id));
if (itemStack.getItemDamage() > 0)
this.repairArmour(world, player, itemStack);
return;
}
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.getItemDamage() > 0)
{
EnergyItems.checkAndSetItemOwner(itemStack, player);
@ -385,8 +392,6 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
}
}
}
return;
}
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, EntityPlayer par3Entity, int par4, boolean par5)

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);