1.7.2 commit
This commit is contained in:
parent
92e097eaa2
commit
9aaa65feb4
548 changed files with 46982 additions and 2 deletions
|
@ -0,0 +1,19 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
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;
|
||||
|
||||
public class SummoningHelper
|
||||
{
|
||||
private int id;
|
||||
|
||||
public SummoningHelper(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public EntityLivingBase getEntity(World worldObj)
|
||||
{
|
||||
if (this.id == AlchemicalWizardry.entityFallenAngelID)
|
||||
{
|
||||
return new EntityFallenAngel(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityLowerGuardianID)
|
||||
{
|
||||
return new EntityLowerGuardian(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityBileDemonID)
|
||||
{
|
||||
return new EntityBileDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityWingedFireDemonID)
|
||||
{
|
||||
return new EntityWingedFireDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entitySmallEarthGolemID)
|
||||
{
|
||||
return new EntitySmallEarthGolem(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityIceDemonID)
|
||||
{
|
||||
return new EntityIceDemon(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityBoulderFistID)
|
||||
{
|
||||
return new EntityBoulderFist(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityShadeID)
|
||||
{
|
||||
return new EntityShade(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityAirElementalID)
|
||||
{
|
||||
return new EntityAirElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityWaterElementalID)
|
||||
{
|
||||
return new EntityWaterElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityEarthElementalID)
|
||||
{
|
||||
return new EntityEarthElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityFireElementalID)
|
||||
{
|
||||
return new EntityFireElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityShadeElementalID)
|
||||
{
|
||||
return new EntityShadeElemental(worldObj);
|
||||
}
|
||||
|
||||
if (this.id == AlchemicalWizardry.entityHolyElementalID)
|
||||
{
|
||||
return new EntityHolyElemental(worldObj);
|
||||
}
|
||||
|
||||
return new EntityPig(worldObj);
|
||||
}
|
||||
|
||||
public int getSummoningHelperID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
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.getItem() == recipeItemStack.getItem())
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
public class MeteorParadigm
|
||||
{
|
||||
public List<MeteorParadigmComponent> componentList = new ArrayList();
|
||||
public ItemStack focusStack;
|
||||
public int radius;
|
||||
public static int maxChance = 1000;
|
||||
|
||||
public MeteorParadigm(ItemStack focusStack, int radius)
|
||||
{
|
||||
this.focusStack = focusStack;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public void parseStringArray(String[] oreArray)
|
||||
{
|
||||
for (int i = 0; i + 1 < oreArray.length; i += 2)
|
||||
{
|
||||
String oreName = oreArray[i];
|
||||
int oreChance = Integer.parseInt(oreArray[i + 1]);
|
||||
MeteorParadigmComponent mpc = new MeteorParadigmComponent(oreName, oreChance);
|
||||
componentList.add(mpc);
|
||||
}
|
||||
}
|
||||
|
||||
public void createMeteorImpact(World world, int x, int y, int z)
|
||||
{
|
||||
world.createExplosion(null, x, y, z, radius * 4, AlchemicalWizardry.doMeteorsDestroyBlocks);
|
||||
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for (int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!world.isAirBlock(x + i, y + j, z + k))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int randNum = world.rand.nextInt(maxChance);
|
||||
boolean hasPlacedBlock = false;
|
||||
|
||||
for (MeteorParadigmComponent mpc : componentList)
|
||||
{
|
||||
if (mpc == null || !mpc.isValidBlockParadigm())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
randNum -= mpc.getChance();
|
||||
|
||||
if (randNum < 0)
|
||||
{
|
||||
ItemStack blockStack = mpc.getValidBlockParadigm();
|
||||
world.setBlock(x + i, y + j, z + k, Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(), 3);
|
||||
hasPlacedBlock = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPlacedBlock)
|
||||
{
|
||||
world.setBlock(x + i, y + j, z + k, Blocks.stone, 0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MeteorParadigmComponent
|
||||
{
|
||||
public String oreDictName;
|
||||
public int chance;
|
||||
|
||||
public MeteorParadigmComponent(String dictName, int chance)
|
||||
{
|
||||
this.oreDictName = dictName;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public boolean isValidBlockParadigm()
|
||||
{
|
||||
if (this.getValidBlockParadigm() != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOreDictName()
|
||||
{
|
||||
return this.oreDictName;
|
||||
}
|
||||
|
||||
public int getChance()
|
||||
{
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
public ItemStack getValidBlockParadigm()
|
||||
{
|
||||
List<ItemStack> list = OreDictionary.getOres(getOreDictName());
|
||||
|
||||
for (ItemStack stack : list)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MeteorRegistry
|
||||
{
|
||||
public static List<MeteorParadigm> paradigmList = new ArrayList();
|
||||
|
||||
public static void registerMeteorParadigm(MeteorParadigm paradigm)
|
||||
{
|
||||
paradigmList.add(paradigm);
|
||||
}
|
||||
|
||||
public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius)
|
||||
{
|
||||
if (stack != null && oreList != null)
|
||||
{
|
||||
MeteorParadigm meteor = new MeteorParadigm(stack, radius);
|
||||
meteor.parseStringArray(oreList);
|
||||
paradigmList.add(meteor);
|
||||
}
|
||||
}
|
||||
|
||||
public static void createMeteorImpact(World world, int x, int y, int z, int paradigmID)
|
||||
{
|
||||
if (paradigmID < paradigmList.size())
|
||||
{
|
||||
paradigmList.get(paradigmID).createMeteorImpact(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getParadigmIDForItem(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < paradigmList.size(); i++)
|
||||
{
|
||||
ItemStack focusStack = paradigmList.get(i).focusStack;
|
||||
|
||||
if (focusStack != null && focusStack.getItem()== stack.getItem() && (focusStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || focusStack.getItemDamage() == stack.getItemDamage()))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean isValidParadigmItem(ItemStack stack)
|
||||
{
|
||||
return getParadigmIDForItem(stack) != -1;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue