API at 99%

This commit is contained in:
WayofTime 2014-04-04 07:36:41 -04:00
parent 30e18429ec
commit 446b98219e
11 changed files with 117 additions and 104 deletions

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
import WayofTime.alchemicalWizardry.common.summoning.SummoningRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View file

@ -16,6 +16,7 @@ import net.minecraft.world.World;
import thaumcraft.api.ItemApi;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
@ -66,9 +67,7 @@ public class RitualEffectSoulBound extends RitualEffect
while (iterator.hasNext())
{
item = (EntityItem) iterator.next();
// double xDif = item.posX - (xCoord+0.5);
// double yDif = item.posY - (yCoord+1);
// double zDif = item.posZ - (zCoord+0.5);
ItemStack itemStack = item.getEntityItem();
if (itemStack == null)
@ -76,55 +75,13 @@ public class RitualEffectSoulBound extends RitualEffect
continue;
}
ItemStack itemGoggles = null;
if (AlchemicalWizardry.isThaumcraftLoaded)
if(BindingRegistry.isRequiredItemValid(itemStack))
{
itemGoggles = ItemApi.getItem("itemGoggles", 0);
}
if (itemStack.itemID == ModItems.apprenticeBloodOrb.itemID)
{
ritualStone.setVar1(ModItems.energyBlaster.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack)+1);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
} else if (itemStack.itemID == Item.swordDiamond.itemID)
{
ritualStone.setVar1(ModItems.energySword.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
} else if (itemStack.itemID == Item.pickaxeDiamond.itemID)
{
ritualStone.setVar1(ModItems.boundPickaxe.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
} else if (itemStack.itemID == Item.axeDiamond.itemID)
{
ritualStone.setVar1(ModItems.boundAxe.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
} else if (itemStack.itemID == Item.shovelDiamond.itemID)
{
ritualStone.setVar1(ModItems.boundShovel.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
} else if (itemGoggles != null && itemGoggles.isItemEqual(itemStack))
{
ritualStone.setVar1(ModItems.sanguineHelmet.itemID);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
return;
item.setDead();
break;
}
if (world.rand.nextInt(10) == 0)
@ -181,7 +138,8 @@ public class RitualEffectSoulBound extends RitualEffect
if (ritualStone.getCooldown() <= 0)
{
ItemStack spawnedItem = new ItemStack(ritualStone.getVar1(), 1, 0);
ItemStack spawnedItem = BindingRegistry.getOutputForIndex(ritualStone.getVar1()-1);
if (spawnedItem != null)
{

View file

@ -1,19 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
public class SummoningFallenAngel extends SummoningHelper
{
public SummoningFallenAngel(int id)
{
super(id);
// TODO Auto-generated constructor stub
}
public EntityLivingBase getEntity(World worldObj)
{
return new EntityFallenAngel(worldObj);
}
}

View file

@ -1,19 +1,30 @@
package WayofTime.alchemicalWizardry.common.summoning;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningHelper;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
public class SummoningHelper
public class SummoningHelperAW extends SummoningHelper
{
private int id;
public SummoningHelper(int id)
public SummoningHelperAW(int id)
{
this.id = id;
super(id);
}
public EntityLivingBase getEntity(World worldObj)

View file

@ -1,70 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class SummoningRegistry
{
public static List<SummoningRegistryComponent> summoningList = new ArrayList();
public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3, int amountUsed, int bloodOrbLevel)
{
summoningList.add(new SummoningRegistryComponent(s, ring1, ring2, ring3, amountUsed, bloodOrbLevel));
}
public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return true;
}
}
return false;
}
public static SummoningRegistryComponent getRegistryComponent(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return src;
}
}
return null;
}
public static EntityLivingBase getEntity(World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return src.getEntity(worldObj);
}
}
return null;
}
public static EntityLivingBase getEntityWithID(World worldObj, int id)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getSummoningHelperID() == id)
{
return src.getEntity(worldObj);
}
}
return null;
}
}

View file

@ -1,231 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class SummoningRegistryComponent
{
public ItemStack[] ring1 = new ItemStack[6];
public ItemStack[] ring2 = new ItemStack[6];
public ItemStack[] ring3 = new ItemStack[6];
public SummoningHelper summoningHelper;
public int summoningCost;
public int bloodOrbLevel;
public SummoningRegistryComponent(SummoningHelper s, ItemStack[] newRing1, ItemStack[] newRing2, ItemStack[] newRing3, int amount, int bloodOrbLevel)
{
this.summoningHelper = s;
this.ring1 = newRing1;
this.ring2 = newRing2;
this.ring3 = newRing3;
this.summoningCost = amount;
this.bloodOrbLevel = bloodOrbLevel;
if (this.ring1.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring1.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring1[i];
}
}
this.ring1 = newRecipe;
}
if (this.ring2.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring2.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring2[i];
}
}
this.ring2 = newRecipe;
}
if (this.ring3.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring3.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring3[i];
}
}
this.ring3 = newRecipe;
}
}
public boolean compareRing(int ring, ItemStack[] checkedRingRecipe)
{
ItemStack[] recipe;
if (checkedRingRecipe.length < 6)
{
return false;
}
switch (ring)
{
case 1:
recipe = ring1;
break;
case 2:
recipe = ring2;
break;
case 3:
recipe = ring3;
break;
default:
recipe = ring1;
}
if (recipe.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > recipe.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = recipe[i];
}
}
recipe = newRecipe;
}
boolean[] checkList = new boolean[6];
for (int i = 0; i < 6; i++)
{
checkList[i] = false;
}
for (int i = 0; i < 6; i++)
{
ItemStack recipeItemStack = recipe[i];
if (recipeItemStack == null)
{
continue;
}
boolean test = false;
for (int j = 0; j < 6; j++)
{
if (checkList[j])
{
continue;
}
ItemStack checkedItemStack = checkedRingRecipe[j];
if (checkedItemStack == null)
{
continue;
}
boolean quickTest = false;
if (recipeItemStack.getItem() instanceof ItemBlock)
{
if (checkedItemStack.getItem() instanceof ItemBlock)
{
quickTest = true;
}
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
{
quickTest = true;
}
if (!quickTest)
{
continue;
}
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.itemID == recipeItemStack.itemID)
{
test = true;
checkList[j] = true;
break;
}
}
if (!test)
{
return false;
}
}
return true;
}
public int getSummoningCost()
{
return summoningCost;
}
public EntityLivingBase getEntity(World world)
{
return this.summoningHelper.getEntity(world);
}
public int getBloodOrbLevel()
{
return this.bloodOrbLevel;
}
public ItemStack[] getRingRecipeForRing(int ring)
{
switch (ring)
{
case 1:
return ring1;
case 2:
return ring2;
case 3:
return ring3;
default:
return null;
}
}
public int getSummoningHelperID()
{
return this.summoningHelper.getSummoningHelperID();
}
}

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.PlinthComponent;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.summoning.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.summoning.SummoningRegistryComponent;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;