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

@ -1,34 +1,27 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectAnimalGrowth extends RitualEffect
{
public static final int breedingCost = 50;
public static final int reductusDrain = 1;
public static final int virtusDrain = 10;
public static final int breedingCost = 50;
public static final int reductusDrain = 1;
public static final int virtusDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -46,7 +39,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect
}
double range = 2;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(range, 0, range);
List<EntityAgeable> list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
@ -60,74 +53,74 @@ public class RitualEffectAnimalGrowth extends RitualEffect
{
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
for(EntityAgeable entity : list)
for (EntityAgeable entity : list)
{
if (entity.getGrowingAge() < 0)
{
entity.addGrowth(5);
entityCount++;
}else
} else
{
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if(hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0)
{
EntityAnimal animal = (EntityAnimal)entity;
entity.setGrowingAge(Math.max(0, animal.getGrowingAge() - 20*2));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
entityCount++;
}
}
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if (hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0)
{
EntityAnimal animal = (EntityAnimal) entity;
entity.setGrowingAge(Math.max(0, animal.getGrowingAge() - 20 * 2));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
entityCount++;
}
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
if(hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost))
if (hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost))
{
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb);
TileEntity tile = world.getTileEntity(x, y+1, z);
IInventory inventory = null;
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}else
{
tile = world.getTileEntity(x, y-1, z);
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}
}
if(inventory != null)
{
for(EntityAnimal entityAnimal : animalList)
{
if(entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0)
{
continue;
}
hasVirtus = hasVirtus && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasLP = SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost);
for(int i=0; i<inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if(stack != null && entityAnimal.isBreedingItem(stack))
{
inventory.decrStackSize(i, 1);
entityAnimal.func_146082_f(null);
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, breedingCost);
break;
}
}
}
}
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb);
TileEntity tile = world.getTileEntity(x, y + 1, z);
IInventory inventory = null;
if (tile instanceof IInventory)
{
inventory = (IInventory) tile;
} else
{
tile = world.getTileEntity(x, y - 1, z);
if (tile instanceof IInventory)
{
inventory = (IInventory) tile;
}
}
if (inventory != null)
{
for (EntityAnimal entityAnimal : animalList)
{
if (entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0)
{
continue;
}
hasVirtus = hasVirtus && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasLP = SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost);
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null && entityAnimal.isBreedingItem(stack))
{
inventory.decrStackSize(i, 1);
entityAnimal.func_146082_f(null);
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, breedingCost);
break;
}
}
}
}
}
}
@ -139,9 +132,9 @@ public class RitualEffectAnimalGrowth extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
@ -159,5 +152,5 @@ public class RitualEffectAnimalGrowth extends RitualEffect
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
return animalGrowthRitual;
}
}
}

View file

@ -1,18 +1,18 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectApiaryOverclock extends RitualEffect
{
@ -35,7 +35,7 @@ public class RitualEffectApiaryOverclock extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
@ -46,55 +46,27 @@ public class RitualEffectApiaryOverclock extends RitualEffect
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
// TileEntity tile = world.getTileEntity(x, y+1, z);
//
// try{
// if(tile instanceof IBeeHousing && tile.getClass().getName().contains("Apiary"))
// {
// for (int i = 0; i < 10; i++)
// {
// PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(x, y+1, z, (short) 3));
// }
//
// for(int i=0; i<9; i++)
// {
// tile.updateEntity();
// }
//
// data.currentEssence = currentEssence - this.getCostPerRefresh();
// data.markDirty();
// }
// }catch (Exception e)
// {
//
// }
}
}
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 10;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> apiaryRitual = new ArrayList();
apiaryRitual.add(new RitualComponent(1,0,0, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(1,0,1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(1,0,-1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1,0,-1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1,0,1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1,0,0, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(0,0,-1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(0,0,1, RitualComponent.DUSK));
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> apiaryRitual = new ArrayList();
apiaryRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(0, 0, -1, RitualComponent.DUSK));
apiaryRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
return apiaryRitual;
}
}
}

View file

@ -1,34 +1,28 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectAutoAlchemy extends RitualEffect
{
public static final boolean fillToOne = true;
public static final int potentiaDrain = 2;
public static final boolean fillToOne = true;
public static final int potentiaDrain = 2;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -40,358 +34,355 @@ public class RitualEffectAutoAlchemy extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < this.getCostPerRefresh()*6)
if (currentEssence < this.getCostPerRefresh() * 6)
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int flag = 0;
TileEntity topEntity = world.getTileEntity(x, y+1, z);
if(!(topEntity instanceof TEAltar))
TileEntity topEntity = world.getTileEntity(x, y + 1, z);
if (!(topEntity instanceof TEAltar))
{
return;
return;
}
TEAltar tileAltar = (TEAltar)topEntity;
TEAltar tileAltar = (TEAltar) topEntity;
ItemStack targetStack = tileAltar.getStackInSlot(0);
if(targetStack == null)
if (targetStack == null)
{
return;
return;
}
ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(targetStack);
if(recipe!=null)
if (recipe != null)
{
TEWritingTable alchemyEntity;
IInventory outputInv = null;
IInventory inputInv1 = null;
IInventory inputInv2 = null;
TileEntity northEntity = world.getTileEntity(x,y,z-1);
TileEntity southEntity = world.getTileEntity(x,y,z+1);
TileEntity eastEntity = world.getTileEntity(x+1,y,z);
TileEntity westEntity = world.getTileEntity(x-1,y,z);
if(northEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable)northEntity;
if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
outputInv = (IInventory)southEntity;
}
if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory)eastEntity;
}
if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory)westEntity;
}
}else if(southEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable)southEntity;
if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
outputInv = (IInventory)northEntity;
}
if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory)eastEntity;
}
if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory)westEntity;
}
}else if(eastEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable)eastEntity;
if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
outputInv = (IInventory)westEntity;
}
if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory)northEntity;
}
if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory)southEntity;
}
}else if(westEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable)westEntity;
if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
outputInv = (IInventory)eastEntity;
}
if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory)northEntity;
}
if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory)southEntity;
}
}else
{
return;
}
if(alchemyEntity != null && hasPotentia)
{
alchemyEntity.setAccelerationTime(5);
if(alchemyEntity.isWorking())
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
}
if(outputInv!=null)
{
ItemStack outputStack = alchemyEntity.getStackInSlot(6);
if(outputStack!=null)
{
for(int i=0; i<outputInv.getSizeInventory(); i++)
{
ItemStack curStack = outputInv.getStackInSlot(i);
if(curStack==null)
{
ItemStack copyStack = outputStack.copy();
copyStack.stackSize = 1;
outputStack.stackSize--;
if(outputStack.stackSize<=0)
{
alchemyEntity.setInventorySlotContents(6, null);
}else
{
alchemyEntity.setInventorySlotContents(6, outputStack);
}
outputInv.setInventorySlotContents(i, copyStack);
flag++;
break;
}
else if(curStack.isItemEqual(outputStack)&&curStack.stackSize<curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(outputStack, curStack))
{
outputStack.stackSize--;
if(outputStack.stackSize<=0)
{
alchemyEntity.setInventorySlotContents(6, null);
}else
{
alchemyEntity.setInventorySlotContents(6, outputStack);
}
curStack.stackSize++;
outputInv.setInventorySlotContents(i, curStack);
flag++;
break;
}
}
}
TEWritingTable alchemyEntity;
IInventory outputInv = null;
IInventory inputInv1 = null;
IInventory inputInv2 = null;
for(int i=0; i<5;i++)
{
ItemStack recItem;
if(recipe.length<=i)
{
recItem = null;
}
else
{
recItem = recipe[i];
}
TileEntity northEntity = world.getTileEntity(x, y, z - 1);
TileEntity southEntity = world.getTileEntity(x, y, z + 1);
TileEntity eastEntity = world.getTileEntity(x + 1, y, z);
TileEntity westEntity = world.getTileEntity(x - 1, y, z);
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if((recItem==null&&alchStack!=null) || (alchStack!=null&&!(areItemStacksEqualWithWildcard(recItem,alchStack))))
{
for(int j=0;j<outputInv.getSizeInventory();j++)
{
ItemStack curStack = outputInv.getStackInSlot(j);
if(curStack==null)
{
ItemStack copyStack = alchStack.copy();
copyStack.stackSize = 1;
alchStack.stackSize--;
if(alchStack.stackSize<=0)
{
alchemyEntity.setInventorySlotContents(i+1, null);
}else
{
alchemyEntity.setInventorySlotContents(i+1, alchStack);
}
outputInv.setInventorySlotContents(j, copyStack);
flag++;
break;
}
else if(curStack.isItemEqual(alchStack)&&curStack.stackSize<curStack.getMaxStackSize()&&ItemStack.areItemStackTagsEqual(alchStack, curStack))
{
alchStack.stackSize--;
if(alchStack.stackSize<=0)
{
alchemyEntity.setInventorySlotContents(i+1, null);
}else
{
alchemyEntity.setInventorySlotContents(i+1, alchStack);
}
curStack.stackSize++;
outputInv.setInventorySlotContents(j, curStack);
flag++;
break;
}
}
continue;
}
}
}
if(world.getWorldTime()%10 == 0)
{
if(flag==0&&inputInv1!=null)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=(fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
for(int j=0;j<inputInv1.getSizeInventory();j++)
{
ItemStack curItem = inputInv1.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(areItemStacksEqualWithWildcard(recItem,curItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv1.setInventorySlotContents(j, null);
}else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
if(flag==0&&inputInv2!=null)
{
for(int i=0;i<recipe.length;i++)
{
ItemStack recItem = recipe[i];
if(recItem==null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=(fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
for(int j=0;j<inputInv2.getSizeInventory();j++)
{
ItemStack curItem = inputInv2.getStackInSlot(j);
if(curItem==null)
{
continue;
}
if(areItemStacksEqualWithWildcard(recItem,curItem))
{
if(alchStack==null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i+1, copyStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i+1, alchStack);
curItem.stackSize--;
if(curItem.stackSize<=0)
{
inputInv2.setInventorySlotContents(j, null);
}else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
}
if (northEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable) northEntity;
if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
outputInv = (IInventory) southEntity;
}
if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory) eastEntity;
}
if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory) westEntity;
}
} else if (southEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable) southEntity;
if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
outputInv = (IInventory) northEntity;
}
if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory) eastEntity;
}
if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory) westEntity;
}
} else if (eastEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable) eastEntity;
if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable))
{
outputInv = (IInventory) westEntity;
}
if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory) northEntity;
}
if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory) southEntity;
}
} else if (westEntity instanceof TEWritingTable)
{
alchemyEntity = (TEWritingTable) westEntity;
if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable))
{
outputInv = (IInventory) eastEntity;
}
if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable))
{
inputInv1 = (IInventory) northEntity;
}
if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable))
{
inputInv2 = (IInventory) southEntity;
}
} else
{
return;
}
if (alchemyEntity != null && hasPotentia)
{
alchemyEntity.setAccelerationTime(5);
if (alchemyEntity.isWorking())
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
}
if (outputInv != null)
{
ItemStack outputStack = alchemyEntity.getStackInSlot(6);
if (outputStack != null)
{
for (int i = 0; i < outputInv.getSizeInventory(); i++)
{
ItemStack curStack = outputInv.getStackInSlot(i);
if (curStack == null)
{
ItemStack copyStack = outputStack.copy();
copyStack.stackSize = 1;
outputStack.stackSize--;
if (outputStack.stackSize <= 0)
{
alchemyEntity.setInventorySlotContents(6, null);
} else
{
alchemyEntity.setInventorySlotContents(6, outputStack);
}
outputInv.setInventorySlotContents(i, copyStack);
flag++;
break;
} else if (curStack.isItemEqual(outputStack) && curStack.stackSize < curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(outputStack, curStack))
{
outputStack.stackSize--;
if (outputStack.stackSize <= 0)
{
alchemyEntity.setInventorySlotContents(6, null);
} else
{
alchemyEntity.setInventorySlotContents(6, outputStack);
}
curStack.stackSize++;
outputInv.setInventorySlotContents(i, curStack);
flag++;
break;
}
}
}
for (int i = 0; i < 5; i++)
{
ItemStack recItem;
if (recipe.length <= i)
{
recItem = null;
} else
{
recItem = recipe[i];
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1);
if ((recItem == null && alchStack != null) || (alchStack != null && !(areItemStacksEqualWithWildcard(recItem, alchStack))))
{
for (int j = 0; j < outputInv.getSizeInventory(); j++)
{
ItemStack curStack = outputInv.getStackInSlot(j);
if (curStack == null)
{
ItemStack copyStack = alchStack.copy();
copyStack.stackSize = 1;
alchStack.stackSize--;
if (alchStack.stackSize <= 0)
{
alchemyEntity.setInventorySlotContents(i + 1, null);
} else
{
alchemyEntity.setInventorySlotContents(i + 1, alchStack);
}
outputInv.setInventorySlotContents(j, copyStack);
flag++;
break;
} else if (curStack.isItemEqual(alchStack) && curStack.stackSize < curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(alchStack, curStack))
{
alchStack.stackSize--;
if (alchStack.stackSize <= 0)
{
alchemyEntity.setInventorySlotContents(i + 1, null);
} else
{
alchemyEntity.setInventorySlotContents(i + 1, alchStack);
}
curStack.stackSize++;
outputInv.setInventorySlotContents(j, curStack);
flag++;
break;
}
}
continue;
}
}
}
if (world.getWorldTime() % 10 == 0)
{
if (flag == 0 && inputInv1 != null)
{
for (int i = 0; i < recipe.length; i++)
{
ItemStack recItem = recipe[i];
if (recItem == null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1);
if (alchStack != null && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
for (int j = 0; j < inputInv1.getSizeInventory(); j++)
{
ItemStack curItem = inputInv1.getStackInSlot(j);
if (curItem == null)
{
continue;
}
if (areItemStacksEqualWithWildcard(recItem, curItem))
{
if (alchStack == null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i + 1, copyStack);
curItem.stackSize--;
if (curItem.stackSize <= 0)
{
inputInv1.setInventorySlotContents(j, null);
} else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
} else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i + 1, alchStack);
curItem.stackSize--;
if (curItem.stackSize <= 0)
{
inputInv1.setInventorySlotContents(j, null);
} else
{
inputInv1.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
if (flag == 0 && inputInv2 != null)
{
for (int i = 0; i < recipe.length; i++)
{
ItemStack recItem = recipe[i];
if (recItem == null)
{
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1);
if (alchStack != null && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
for (int j = 0; j < inputInv2.getSizeInventory(); j++)
{
ItemStack curItem = inputInv2.getStackInSlot(j);
if (curItem == null)
{
continue;
}
if (areItemStacksEqualWithWildcard(recItem, curItem))
{
if (alchStack == null)
{
ItemStack copyStack = recItem.copy();
copyStack.stackSize = 1;
alchemyEntity.setInventorySlotContents(i + 1, copyStack);
curItem.stackSize--;
if (curItem.stackSize <= 0)
{
inputInv2.setInventorySlotContents(j, null);
} else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
} else
{
alchStack.stackSize++;
alchemyEntity.setInventorySlotContents(i + 1, alchStack);
curItem.stackSize--;
if (curItem.stackSize <= 0)
{
inputInv2.setInventorySlotContents(j, null);
} else
{
inputInv2.setInventorySlotContents(j, curItem);
}
flag++;
break;
}
}
}
}
}
}
}
if (flag>0)
if (flag > 0)
{
world.markBlockForUpdate(x, y, z+1);
world.markBlockForUpdate(x, y, z-1);
world.markBlockForUpdate(x+1, y, z);
world.markBlockForUpdate(x-1, y, z);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*flag);
world.markBlockForUpdate(x, y, z + 1);
world.markBlockForUpdate(x, y, z - 1);
world.markBlockForUpdate(x + 1, y, z);
world.markBlockForUpdate(x - 1, y, z);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag);
}
}
}
@ -402,31 +393,31 @@ public class RitualEffectAutoAlchemy extends RitualEffect
return 10;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> autoAlchemyRitual = new ArrayList();
autoAlchemyRitual.add(new RitualComponent(1,0,1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(1,0,-1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(-1,0,-1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(-1,0,1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(2,0,2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(2,0,-2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-2,0,-2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-2,0,2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-3,0,-2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-2,0,-3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-3,0,2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-2,0,3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(3,0,-2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(2,0,-3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(3,0,2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(2,0,3, RitualComponent.FIRE));
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> autoAlchemyRitual = new ArrayList();
autoAlchemyRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.DUSK));
autoAlchemyRitual.add(new RitualComponent(2, 0, 2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(2, 0, -2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-2, 0, -2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-2, 0, 2, RitualComponent.WATER));
autoAlchemyRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(3, 0, -2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(2, 0, -3, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(3, 0, 2, RitualComponent.FIRE));
autoAlchemyRitual.add(new RitualComponent(2, 0, 3, RitualComponent.FIRE));
return autoAlchemyRitual;
}
public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack)
{
return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem());
}
}
public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack)
{
return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem());
}
}

View file

@ -1,8 +1,12 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import net.minecraft.block.Block;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
@ -13,19 +17,13 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectBiomeChanger extends RitualEffect
{
@ -52,8 +50,8 @@ public class RitualEffectBiomeChanger extends RitualEffect
}
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
int range = 10;
if (currentEssence < this.getCostPerRefresh())
@ -171,7 +169,7 @@ public class RitualEffectBiomeChanger extends RitualEffect
{
if (itemTest instanceof ItemBlock)
{
Block item = ((ItemBlock)itemTest).field_150939_a;
Block item = ((ItemBlock) itemTest).field_150939_a;
if (item == (Blocks.sand))
{
humidity -= 0.1f;
@ -258,11 +256,8 @@ public class RitualEffectBiomeChanger extends RitualEffect
if (Math.abs(rainfall - humidity) < acceptableRange && Math.abs(temperature - temp) < acceptableRange)
{
//if(biome.getEnableSnow()==wantsSnow)
{
biomeID = iteration;
break;
}
biomeID = iteration;
break;
}
iteration++;
@ -272,7 +267,6 @@ public class RitualEffectBiomeChanger extends RitualEffect
{
for (int j = 0; j < 2 * range + 1; j++)
{
//Testing of traversal of boolean matrix
if (boolList[i][j])
{
Chunk chunk = world.getChunkFromBlockCoords(x - range + i, z - range + j);
@ -292,7 +286,6 @@ public class RitualEffectBiomeChanger extends RitualEffect
byteArray[moduZ * 16 + moduX] = (byte) biomeID;
chunk.setBiomeArray(byteArray);
//world.setBlock(x-range+i, y+1, z-range+j, Block.blockClay);
}
}
}
@ -305,7 +298,6 @@ public class RitualEffectBiomeChanger extends RitualEffect
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 0;
}
@ -316,9 +308,9 @@ public class RitualEffectBiomeChanger extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> biomeChangerRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> biomeChangerRitual = new ArrayList();
biomeChangerRitual.add(new RitualComponent(1, 0, -2, RitualComponent.AIR));
biomeChangerRitual.add(new RitualComponent(1, 0, -3, RitualComponent.AIR));
biomeChangerRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
@ -436,5 +428,5 @@ public class RitualEffectBiomeChanger extends RitualEffect
biomeChangerRitual.add(new RitualComponent(-4, 0, -8, RitualComponent.WATER));
biomeChangerRitual.add(new RitualComponent(-4, 0, -9, RitualComponent.WATER));
return biomeChangerRitual;
}
}
}

View file

@ -1,37 +1,35 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectContainment extends RitualEffect
{
public static final String[] TIME_SINCE_IGNITED = new String[] { "timeSinceIgnited", "field_70833_d", "bq" };
public static final int crepitousDrain = 1;
public static final int terraeDrain = 3;
public static final int magicalesDrain = 10;
public static final String[] TIME_SINCE_IGNITED = new String[]{"timeSinceIgnited", "field_70833_d", "bq"};
public static final int crepitousDrain = 1;
public static final int terraeDrain = 3;
public static final int magicalesDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
@ -40,31 +38,31 @@ public class RitualEffectContainment extends RitualEffect
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int d0 = 5;
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x+0.5, y+0.5, z+0.5, d0, d0);
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0);
boolean flag = false;
boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
for(Entity entity : entityList)
for (Entity entity : entityList)
{
if(!(entity instanceof EntityLivingBase))
{
continue;
}
EntityLivingBase livingEntity = (EntityLivingBase)entity;
if (!(entity instanceof EntityLivingBase))
{
continue;
}
EntityLivingBase livingEntity = (EntityLivingBase) entity;
if (livingEntity instanceof EntityPlayer)
{
continue;
}
double xDif = livingEntity.posX - (x + 0.5);
double yDif = livingEntity.posY - (y + 3);
double zDif = livingEntity.posZ - (z + 0.5);
@ -74,30 +72,30 @@ public class RitualEffectContainment extends RitualEffect
flag = true;
livingEntity.fallDistance = 0;
if(hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false))
if (hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false))
{
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
}
if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id, 100, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
}
}
if(hasCrepitous && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false))
if (hasCrepitous && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false))
{
if(entity instanceof EntityCreeper)
{
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED);
((EntityCreeper)entity).setAttackTarget(null);
this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true);
}
if (entity instanceof EntityCreeper)
{
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED);
((EntityCreeper) entity).setAttackTarget(null);
this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true);
}
}
}
if (world.getWorldTime() % 2 == 0 && flag)
{
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
}
@ -108,10 +106,10 @@ public class RitualEffectContainment extends RitualEffect
return 1;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> containmentRitual = new ArrayList();
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> containmentRitual = new ArrayList();
containmentRitual.add(new RitualComponent(1, 0, 0, 3));
containmentRitual.add(new RitualComponent(-1, 0, 0, 3));
containmentRitual.add(new RitualComponent(0, 0, 1, 3));
@ -129,5 +127,5 @@ public class RitualEffectContainment extends RitualEffect
containmentRitual.add(new RitualComponent(-2, 5, 2, 3));
containmentRitual.add(new RitualComponent(-2, 5, -2, 3));
return containmentRitual;
}
}
}

View file

@ -1,8 +1,12 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
@ -10,26 +14,20 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectCrushing extends RitualEffect
{
public static final int crystallosDrain = 10;
public static final int orbisTerraeDrain = 10;
public static final int potentiaDrain = 10;
public static final int virtusDrain = 10;
public static final int incendiumDrain = 10;
public static final int crystallosDrain = 10;
public static final int orbisTerraeDrain = 10;
public static final int potentiaDrain = 10;
public static final int virtusDrain = 10;
public static final int incendiumDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -62,39 +60,47 @@ public class RitualEffectCrushing extends RitualEffect
return;
}
boolean hasRoom = false;
for(int i=0; i<tileEntity.getSizeInventory(); i++)
{
if(tileEntity.getStackInSlot(i) == null)
{
hasRoom = true;
break;
}
}
if(!hasRoom)
{
return; //Prevents overflow
}
boolean hasRoom = false;
for (int i = 0; i < tileEntity.getSizeInventory(); i++)
{
if (tileEntity.getStackInSlot(i) == null)
{
hasRoom = true;
break;
}
}
if (!hasRoom)
{
return; //Prevents overflow
}
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasIncendium = this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasIncendium = this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
boolean isSilkTouch = hasCrystallos;
int fortuneLevel = 0;
if(hasOrbisTerrae){fortuneLevel++;}
if(hasPotentia){fortuneLevel++;}
if(hasVirtus){fortuneLevel++;}
int fortuneLevel = 0;
if (hasOrbisTerrae)
{
fortuneLevel++;
}
if (hasPotentia)
{
fortuneLevel++;
}
if (hasVirtus)
{
fortuneLevel++;
}
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
//boolean flag = false;
for (int j = -3; j < 0; j++)
{
for (int i = -1; i <= 1; i++)
@ -111,100 +117,67 @@ public class RitualEffectCrushing extends RitualEffect
continue;
}
if(isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta))
if (isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta))
{
//int invSize = tileEntity.getSizeInventory();
ItemStack item = new ItemStack(block,1,meta);
ItemStack item = new ItemStack(block, 1, meta);
ItemStack copyStack = item.copyItemStack(item);
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
if(hasCrystallos)
if (hasCrystallos)
{
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(world, x + i, y + j, z + k, meta, fortuneLevel);
if (itemDropList != null)
{
int invSize = tileEntity.getSizeInventory();
for (ItemStack item : itemDropList)
{
hasIncendium = hasIncendium && this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
ItemStack copyStack = item.copyItemStack(item);
if (this.usesIncendium(copyStack))
{
copyStack = this.transformToNewItem(copyStack, hasIncendium, false);
this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true);
}
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
}
if (hasOrbisTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
}
if (hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
if (hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
}
}
}
else
{
ArrayList<ItemStack> itemDropList = block.getDrops(world, x + i, y + j, z + k, meta, fortuneLevel);
if (itemDropList != null)
{
int invSize = tileEntity.getSizeInventory();
for (ItemStack item : itemDropList)
{
hasIncendium = hasIncendium && this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
ItemStack copyStack = item.copyItemStack(item);
if(this.usesIncendium(copyStack))
{
copyStack = this.transformToNewItem(copyStack, hasIncendium, false);
this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true);
}
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
// for (int n = 0; n < invSize; n++)
// {
// if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
// {
// ItemStack itemStack = tileEntity.getStackInSlot(n);
//
// if (itemStack == null)
// {
// tileEntity.setInventorySlotContents(n, item);
// copyStack.stackSize = 0;
// } else
// {
// if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
// {
// int itemSize = itemStack.stackSize;
// int copySize = copyStack.stackSize;
// int maxSize = itemStack.getMaxStackSize();
//
// if (copySize + itemSize < maxSize)
// {
// copyStack.stackSize = 0;
// itemStack.stackSize = itemSize + copySize;
// tileEntity.setInventorySlotContents(n, itemStack);
// } else
// {
// copyStack.stackSize = itemSize + copySize - maxSize;
// itemStack.stackSize = maxSize;
// }
// }
// }
// }
// }
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
if(hasOrbisTerrae){this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);}
if(hasPotentia){this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);}
if(hasVirtus){this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);}
}
}
}
//if(flag)
world.setBlockToAir(x + i, y + j, z + k);
world.playSoundEffect(x + i, y + j, z + k, "mob.endermen.portal", 1.0F, 1.0F);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
return;
}
}
@ -212,114 +185,114 @@ public class RitualEffectCrushing extends RitualEffect
}
}
}
private boolean usesIncendium(ItemStack stack)
{
if(stack != null)
{
Item item = stack.getItem();
if(item instanceof ItemBlock)
{
Block block = ((ItemBlock)item).field_150939_a;
if (stack != null)
{
Item item = stack.getItem();
if (item instanceof ItemBlock)
{
Block block = ((ItemBlock) item).field_150939_a;
if(block == Blocks.cobblestone || block == Blocks.stone)
{
return true;
}
}else
{
}
}
return false;
if (block == Blocks.cobblestone || block == Blocks.stone)
{
return true;
}
} else
{
}
}
return false;
}
private ItemStack transformToNewItem(ItemStack stack, boolean hasIncendium, boolean hasCrepitous)
{
if(stack != null)
{
ItemStack copyStack = ItemStack.copyItemStack(stack);
int stackSize = copyStack.stackSize;
Item item = stack.getItem();
if(item instanceof ItemBlock)
{
Block block = ((ItemBlock)item).field_150939_a;
if(hasIncendium)
{
if(block == Blocks.cobblestone || block == Blocks.stone)
{
copyStack = new ItemStack(Blocks.netherrack, stackSize, 0);
}
}
}else
{
}
return copyStack;
}
return stack;
if (stack != null)
{
ItemStack copyStack = ItemStack.copyItemStack(stack);
int stackSize = copyStack.stackSize;
Item item = stack.getItem();
if (item instanceof ItemBlock)
{
Block block = ((ItemBlock) item).field_150939_a;
if (hasIncendium)
{
if (block == Blocks.cobblestone || block == Blocks.stone)
{
copyStack = new ItemStack(Blocks.netherrack, stackSize, 0);
}
}
} else
{
}
return copyStack;
}
return stack;
}
public boolean isSilkTouch(World world, int x, int y, int z)
{
int index = 0;
for(int i=-2; i<=2; i++)
{
for(int j=-2; j<=2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if(block == Blocks.gold_block)
int index = 0;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if (block == Blocks.gold_block)
{
index++;
index++;
}
}
}
}
return index>=12;
}
}
}
return index >= 12;
}
public int getFortuneLevel(World world, int x, int y, int z)
{
int index = 0;
for(int i=-2; i<=2; i++)
{
for(int j=-2; j<=2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if(block == Blocks.emerald_block || block == Blocks.diamond_block)
int index = 0;
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
int index1 = Math.abs(i);
int index2 = Math.abs(j);
if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2))
{
Block block = world.getBlock(x + i, y + 1, z + j);
if (block == Blocks.emerald_block || block == Blocks.diamond_block)
{
index++;
index++;
}
}
}
}
if(index>=12)
{
return 3;
}else if(index>=8)
{
return 2;
}else if(index>=4)
{
return 1;
}
return 0;
}
}
}
if (index >= 12)
{
return 3;
} else if (index >= 8)
{
return 2;
} else if (index >= 4)
{
return 1;
}
return 0;
}
@Override
@ -329,9 +302,9 @@ public class RitualEffectCrushing extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> crushingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> crushingRitual = new ArrayList();
crushingRitual.add(new RitualComponent(0, 0, 1, RitualComponent.EARTH));
crushingRitual.add(new RitualComponent(1, 0, 0, RitualComponent.EARTH));
crushingRitual.add(new RitualComponent(0, 0, -1, RitualComponent.EARTH));
@ -349,5 +322,5 @@ public class RitualEffectCrushing extends RitualEffect
crushingRitual.add(new RitualComponent(0, 1, 2, RitualComponent.AIR));
crushingRitual.add(new RitualComponent(0, 1, -2, RitualComponent.AIR));
return crushingRitual;
}
}
}

View file

@ -1,26 +1,22 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectEllipsoid extends RitualEffect
{
@ -34,24 +30,24 @@ public class RitualEffectEllipsoid extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
TileEntity tile = world.getTileEntity(x, y+1, z);
if(!(tile instanceof IInventory) || ((IInventory)tile).getSizeInventory() < 3)
{
return;
}
ItemStack item1 = ((IInventory) tile).getStackInSlot(0);
ItemStack item2 = ((IInventory) tile).getStackInSlot(1);
ItemStack item3 = ((IInventory) tile).getStackInSlot(2);
int xSize = item1 == null ? 0 : item1.stackSize;
int ySize = item2 == null ? 0 : item2.stackSize;
int zSize = item3 == null ? 0 : item3.stackSize;
int cost = (int)Math.pow((xSize+1)*(ySize+1)*(zSize+1),0.333);
TileEntity tile = world.getTileEntity(x, y + 1, z);
if (!(tile instanceof IInventory) || ((IInventory) tile).getSizeInventory() < 3)
{
return;
}
ItemStack item1 = ((IInventory) tile).getStackInSlot(0);
ItemStack item2 = ((IInventory) tile).getStackInSlot(1);
ItemStack item3 = ((IInventory) tile).getStackInSlot(2);
int xSize = item1 == null ? 0 : item1.stackSize;
int ySize = item2 == null ? 0 : item2.stackSize;
int zSize = item3 == null ? 0 : item3.stackSize;
int cost = (int) Math.pow((xSize + 1) * (ySize + 1) * (zSize + 1), 0.333);
if (currentEssence < cost)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
@ -64,48 +60,41 @@ public class RitualEffectEllipsoid extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
//if(tile instanceof IInventory)
int refresh = 1000;
int j = (int) (world.getWorldTime() % (ySize * 2 + 1)) - ySize;
for (int i = -xSize; i <= xSize; i++)
{
int refresh = 1000;
int j = (int)(world.getWorldTime()%(ySize*2+1)) - ySize;
for (int i = -xSize; i <= xSize; i++)
{
// for (int j = -ySize; j <= ySize; j++)
for (int k = -zSize; k <= zSize; k++)
{
for(int k = -zSize; k <= zSize; k++)
if (Math.pow(i * (ySize - 0.50f) * (zSize - 0.50f), 2) + Math.pow(j * (xSize - 0.50f) * (zSize - 0.50f), 2) + Math.pow(k * (xSize - 0.50f) * (ySize - 0.50f), 2) <= Math.pow((xSize - 1 + 0.50f) * (ySize - 1 + 0.50f) * (zSize - 1 + 0.50f), 2))
{
if (Math.pow(i*(ySize - 0.50f)*(zSize - 0.50f),2) + Math.pow(j*(xSize - 0.50f)*(zSize - 0.50f),2) + Math.pow(k*(xSize - 0.50f)*(ySize - 0.50f),2) <= Math.pow((xSize - 1 + 0.50f)*(ySize - 1 + 0.50f)*(zSize - 1 + 0.50f), 2))
continue;
}
if (Math.pow(i * (ySize + 0.50f) * (zSize + 0.50f), 2) + Math.pow(j * (xSize + 0.50f) * (zSize + 0.50f), 2) + Math.pow(k * (xSize + 0.50f) * (ySize + 0.50f), 2) >= Math.pow((xSize + 0.50f) * (ySize + 0.50f) * (zSize + 0.50f), 2))
{
continue;
}
Block block = world.getBlock(x + i, y + j, z + k);
if (block.isAir(world, x + i, y + j, z + k))
{
TESpectralBlock.createSpectralBlockAtLocation(world, x + i, y + j, z + k, refresh);
} else
{
TileEntity tile1 = world.getTileEntity(x + i, y + j, z + k);
if (tile instanceof TESpectralBlock)
{
continue;
((TESpectralBlock) tile1).resetDuration(refresh);
}
if (Math.pow(i*(ySize + 0.50f)*(zSize + 0.50f),2) + Math.pow(j*(xSize + 0.50f)*(zSize + 0.50f),2) + Math.pow(k*(xSize + 0.50f)*(ySize + 0.50f),2) >= Math.pow((xSize + 0.50f)*(ySize + 0.50f)*(zSize + 0.50f), 2))
{
continue;
}
Block block = world.getBlock(x+i, y+j, z+k);
if(block.isAir(world, x+i, y+j, z+k))
{
//world.setBlock(x+i, y+j, z+k, Blocks.stone);
TESpectralBlock.createSpectralBlockAtLocation(world, x+i, y+j, z+k, refresh);
}
else
{
TileEntity tile1 = world.getTileEntity(x+i, y+j, z+k);
if(tile instanceof TESpectralBlock)
{
((TESpectralBlock) tile1).resetDuration(refresh);
}
}
}
}
}
}
SoulNetworkHandler.syphonFromNetwork(owner, cost);
}
}
@ -117,51 +106,51 @@ public class RitualEffectEllipsoid extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.WATER));
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
ellipsoidRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(4, 0, 0, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5, 0, 0, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5, 0, -1, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(5, 0, -2, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-4, 0, 0, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5, 0, 0, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5, 0, 1, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(-5, 0, 2, RitualComponent.FIRE));
ellipsoidRitual.add(new RitualComponent(0, 0, 4, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0, 0, 5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(1, 0, 5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(2, 0, 5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0, 0, -4, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(0, 0, -5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(-1, 0, -5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(-2, 0, -5, RitualComponent.AIR));
ellipsoidRitual.add(new RitualComponent(3, 0, 1, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(3, 0, 2, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(3, 0, 3, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(2, 0, 3, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.EARTH));
ellipsoidRitual.add(new RitualComponent(1, 0, -3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(2, 0, -3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(3, 0, -3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(3, 0, -2, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-3, 0, 3, RitualComponent.WATER));
ellipsoidRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.WATER));
return ellipsoidRitual;
}
}
}

View file

@ -1,32 +1,20 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectEvaporation extends RitualEffect
{
@ -40,7 +28,7 @@ public class RitualEffectEvaporation extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < 0)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
@ -53,22 +41,22 @@ public class RitualEffectEvaporation extends RitualEffect
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
Block block1 = world.getBlock(x, y-1, z);
int range = this.getRadiusForModifierBlock(block1);
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
Block block1 = world.getBlock(x, y - 1, z);
int range = this.getRadiusForModifierBlock(block1);
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
for (int i = 0; i < 2 * range + 1; i++)
{
for (int j = 0; j < 2 * range + 1; j++)
{
for(int k = 0; k < 2 * range + 1; k++)
{
for (int k = 0; k < 2 * range + 1; k++)
{
boolList[i][j][k] = false;
}
}
}
}
boolList[range][range][range] = true;
boolean isReady = false;
@ -80,14 +68,14 @@ public class RitualEffectEvaporation extends RitualEffect
{
for (int j = 0; j < 2 * range + 1; j++)
{
for(int k=0; k<2*range+1;k++)
{
for (int k = 0; k < 2 * range + 1; k++)
{
if (boolList[i][j][k])
{
if (i - 1 >= 0 && !boolList[i - 1][j][k])
{
Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
if(world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i - 1][j][k] = true;
isReady = false;
@ -97,17 +85,17 @@ public class RitualEffectEvaporation extends RitualEffect
if (j - 1 >= 0 && !boolList[i][j - 1][k])
{
Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k);
if(world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j - 1][k] = true;
isReady = false;
}
}
if(k - 1 >=0 && !boolList[i][j][k - 1])
if (k - 1 >= 0 && !boolList[i][j][k - 1])
{
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
if(world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer)
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j][k - 1] = true;
isReady = false;
@ -117,7 +105,7 @@ public class RitualEffectEvaporation extends RitualEffect
if (i + 1 <= 2 * range && !boolList[i + 1][j][k])
{
Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
if(world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i + 1][j][k] = true;
isReady = false;
@ -127,52 +115,52 @@ public class RitualEffectEvaporation extends RitualEffect
if (j + 1 <= 2 * range && !boolList[i][j + 1][k])
{
Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
if(world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j + 1][k] = true;
isReady = false;
}
}
if(k + 1 <= 2*range && !boolList[i][j][k+1])
if (k + 1 <= 2 * range && !boolList[i][j][k + 1])
{
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
if(world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer)
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer)
{
boolList[i][j][k+1] = true;
boolList[i][j][k + 1] = true;
isReady = false;
}
}
}
}
}
}
}
}
for (int i = 0; i < 2 * range + 1; i++)
{
for (int j = 0; j < 2 * range + 1; j++)
{
for(int k=0; k<2*range+1;k++)
{
if(!boolList[i][j][k])
{
continue;
}
Block block = world.getBlock(x+i-range, y+j-range, z+k-range);
if(block == ModBlocks.blockSpectralContainer)
{
world.setBlockToAir(x+i-range, y+j-range, z+k-range);
}
}
for (int k = 0; k < 2 * range + 1; k++)
{
if (!boolList[i][j][k])
{
continue;
}
Block block = world.getBlock(x + i - range, y + j - range, z + k - range);
if (block == ModBlocks.blockSpectralContainer)
{
world.setBlockToAir(x + i - range, y + j - range, z + k - range);
}
}
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
ritualStone.setActive(false);
ritualStone.setActive(false);
}
}
@ -183,76 +171,76 @@ public class RitualEffectEvaporation extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.DUSK));
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
ellipsoidRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(4, 0, 0, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5, 0, 0, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(5, 0, -2, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-4, 0, 0, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5, 0, 0, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-5, 0, 2, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0, 0, 4, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, 5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2, 0, 5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0, 0, -4, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1, 0, -5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2, 0, -5, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3, 0, 1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3, 0, 2, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3, 0, 3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2, 0, 3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(1, 0, -3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(2, 0, -3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3, 0, -3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(3, 0, -2, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3, 0, 3, RitualComponent.DUSK));
ellipsoidRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.DUSK));
return ellipsoidRitual;
}
}
public int getRadiusForModifierBlock(Block block)
{
if(block == null)
{
return 10;
}
if(block == Blocks.diamond_block)
{
return 30;
}
if(block == Blocks.gold_block)
{
return 20;
}
if(block == Blocks.iron_block)
{
return 15;
}
return 10;
}
{
if (block == null)
{
return 10;
}
if (block == Blocks.diamond_block)
{
return 30;
}
if (block == Blocks.gold_block)
{
return 20;
}
if (block == Blocks.iron_block)
{
return 15;
}
return 10;
}
}

View file

@ -1,9 +1,14 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -11,31 +16,22 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RitualEffectExpulsion extends RitualEffect
{
public static final int virtusDrain = 10;
public static final int potentiaDrain = 10;
public static final int tennebraeDrain = 5;
public static final int virtusDrain = 10;
public static final int potentiaDrain = 10;
public static final int tennebraeDrain = 5;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -52,99 +48,93 @@ public class RitualEffectExpulsion extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
boolean flag = false;
TileEntity tile = world.getTileEntity(x, y+1, z);
TileEntity tile = world.getTileEntity(x, y + 1, z);
IInventory inventoryTile = null;
if(tile instanceof IInventory)
if (tile instanceof IInventory)
{
inventoryTile = (IInventory)tile;
inventoryTile = (IInventory) tile;
}
for(EntityPlayer entityplayer : playerList)
for (EntityPlayer entityplayer : playerList)
{
String playerString = SpellHelper.getUsername(entityplayer);
String playerString = SpellHelper.getUsername(entityplayer);
if (!playerString.equals(owner))
{
if(inventoryTile != null)
{
for(int i=0; i<inventoryTile.getSizeInventory(); i++)
{
ItemStack stack = inventoryTile.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof IBindable && EnergyItems.getOwnerName(stack).equals(playerString))
{
continue;
}
}
}
// if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
// {
// continue;
// }
if (inventoryTile != null)
{
for (int i = 0; i < inventoryTile.getSizeInventory(); i++)
{
ItemStack stack = inventoryTile.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof IBindable && EnergyItems.getOwnerName(stack).equals(playerString))
{
continue;
}
}
}
flag = teleportRandomly(entityplayer, teleportDistance) || flag;
}
}
if (flag)
{
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
if (hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if (hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh());
}
}
boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
if(hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000))
if (hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000))
{
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
boolean flag = false;
for(EntityLivingBase livingEntity : livingList)
for (EntityLivingBase livingEntity : livingList)
{
if(livingEntity instanceof EntityPlayer)
{
continue;
}
flag = teleportRandomly(livingEntity, teleportDistance) || flag;
if (livingEntity instanceof EntityPlayer)
{
continue;
}
flag = teleportRandomly(livingEntity, teleportDistance) || flag;
}
if(flag)
if (flag)
{
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, 1000);
if (hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if (hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, 1000);
}
}
}
@ -154,7 +144,7 @@ public class RitualEffectExpulsion extends RitualEffect
{
return 1000;
}
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
{
double x = entityLiving.posX;
@ -180,7 +170,6 @@ public class RitualEffectExpulsion extends RitualEffect
}
return true;
//return SpellTeleport.teleportTo(entityLiving, d0, d1, d2,x,y,z);
}
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
@ -250,9 +239,6 @@ public class RitualEffectExpulsion extends RitualEffect
double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
}
// this.worldObj.playSoundEffect(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
// this.playSound("mob.endermen.portal", 1.0F, 1.0F);
return true;
}
}
@ -275,10 +261,7 @@ public class RitualEffectExpulsion extends RitualEffect
{
entityLiving.mountEntity((Entity) null);
}
entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
// this.getThrower().fallDistance = 0.0F;
// this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage);
}
}
}
@ -288,58 +271,58 @@ public class RitualEffectExpulsion extends RitualEffect
}
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> expulsionRitual = new ArrayList();
expulsionRitual.add(new RitualComponent(2,0,2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2,0,1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(1,0,2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2,0,-2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2,0,-1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-1,0,2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2,0,2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2,0,1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(1,0,-2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2,0,-2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2,0,-1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-1,0,-2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(4,0,2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(5,0,2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(4,0,-2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(5,0,-2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-4,0,2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-5,0,2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-4,0,-2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-5,0,-2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2,0,4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2,0,5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2,0,4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2,0,5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2,0,-4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2,0,-5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2,0,-4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2,0,-5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(0,0,6, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(0,0,-6, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(6,0,0, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-6,0,0, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-5,0,0, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-6,0,1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-6,0,-1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(5,0,0, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(6,0,1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(6,0,-1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(0,0,5, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(1,0,6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-1,0,6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(0,0,-5, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(1,0,-6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-1,0,-6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(4,0,4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(4,0,-4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(-4,0,4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(-4,0,-4, RitualComponent.FIRE));
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> expulsionRitual = new ArrayList();
expulsionRitual.add(new RitualComponent(2, 0, 2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2, 0, 1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(1, 0, 2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2, 0, -2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(2, 0, -1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2, 0, 2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(1, 0, -2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2, 0, -2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(4, 0, 2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(5, 0, 2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(4, 0, -2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(5, 0, -2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-4, 0, 2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-5, 0, 2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-4, 0, -2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-5, 0, -2, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2, 0, 4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2, 0, 5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2, 0, 4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2, 0, 5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2, 0, -4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(2, 0, -5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2, 0, -4, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(-2, 0, -5, RitualComponent.AIR));
expulsionRitual.add(new RitualComponent(0, 0, 6, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(0, 0, -6, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(6, 0, 0, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-6, 0, 0, RitualComponent.EARTH));
expulsionRitual.add(new RitualComponent(-5, 0, 0, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-6, 0, 1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-6, 0, -1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(5, 0, 0, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(6, 0, 1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(6, 0, -1, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(1, 0, 6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-1, 0, 6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(1, 0, -6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(-1, 0, -6, RitualComponent.DUSK));
expulsionRitual.add(new RitualComponent(4, 0, 4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(4, 0, -4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(-4, 0, 4, RitualComponent.FIRE));
expulsionRitual.add(new RitualComponent(-4, 0, -4, RitualComponent.FIRE));
return expulsionRitual;
}
}
}

View file

@ -1,32 +1,26 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fall damage in the area of effect
{
public static final int terraeDrain = 1;
public static final int orbisTerraeDrain = 1;
public static final int aetherDrain = 1;
public static final int costCooldown = 10;
public static final int terraeDrain = 1;
public static final int orbisTerraeDrain = 1;
public static final int aetherDrain = 1;
public static final int costCooldown = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -48,9 +42,9 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
}
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
int range = this.getHorizontalRangeForReagent(hasTerrae, hasOrbisTerrae);
int verticalRange = hasAether ? 60 : 30;
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range));
@ -74,21 +68,21 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
if(flag && world.getWorldTime() % costCooldown == 0)
if (flag && world.getWorldTime() % costCooldown == 0)
{
if(hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if(hasOrbisTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
}
if(hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if (hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if (hasOrbisTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
}
if (hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
}
}
}
@ -106,9 +100,9 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> featheredEarthRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> featheredEarthRitual = new ArrayList();
featheredEarthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK));
featheredEarthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK));
featheredEarthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
@ -150,28 +144,28 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
featheredEarthRitual.add(new RitualComponent(-5, 5, -4, RitualComponent.AIR));
featheredEarthRitual.add(new RitualComponent(-3, 5, -4, RitualComponent.AIR));
return featheredEarthRitual;
}
}
public int getHorizontalRangeForReagent(boolean hasTerrae, boolean hasOrbisTerrae)
{
if(hasOrbisTerrae)
{
if(hasTerrae)
{
return 64;
}else
{
return 45;
}
}else
{
if(hasTerrae)
{
return 30;
}else
{
return 20;
}
}
if (hasOrbisTerrae)
{
if (hasTerrae)
{
return 64;
} else
{
return 45;
}
} else
{
if (hasTerrae)
{
return 30;
} else
{
return 20;
}
}
}
}

View file

@ -1,29 +1,22 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectFeatheredKnife extends RitualEffect
{
public final int amount = 100;
public static final int sanctusDrain = 5;
public static final int reductusDrain = 3;
public static final int magicalesDrain = 2;
@ -34,14 +27,14 @@ public class RitualEffectFeatheredKnife extends RitualEffect
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int timeDelay = hasPotentia ? 10 : 20;
if (world.getWorldTime() % timeDelay != 0)
@ -71,65 +64,65 @@ public class RitualEffectFeatheredKnife extends RitualEffect
{
return;
}
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
double range = hasReductus ? 8 : 15;
double vertRange = hasReductus ? 8 : 20;
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange);
int entityCount = 0;
boolean flag = false;
if (currentEssence < this.getCostPerRefresh() * list.size())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
EntityPlayer ownerPlayer = SpellHelper.getPlayerForUsername(owner);
for(EntityPlayer player : list)
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
EntityPlayer ownerPlayer = SpellHelper.getPlayerForUsername(owner);
for (EntityPlayer player : list)
{
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
double threshold = hasSanctus ? 0.7d : 0.3d;
if((hasMagicales && player == ownerPlayer) || !hasMagicales)
{
if (!SpellHelper.isFakePlayer(world, player))
if ((hasMagicales && player == ownerPlayer) || !hasMagicales)
{
if (!SpellHelper.isFakePlayer(world, player))
{
if (player.getHealth()/player.getMaxHealth() > threshold)
if (player.getHealth() / player.getMaxHealth() > threshold)
{
player.setHealth(player.getHealth() - 1);
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, false);
if(hasSanctus)
if (hasSanctus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
}
if(hasMagicales)
if (hasMagicales)
{
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
break;
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
break;
}
}
}
}
}
}
if(entityCount > 0)
if (entityCount > 0)
{
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
if (hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if (hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
}
}
@ -141,9 +134,9 @@ public class RitualEffectFeatheredKnife extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> featheredKnifeRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> featheredKnifeRitual = new ArrayList();
featheredKnifeRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK));
featheredKnifeRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK));
featheredKnifeRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
@ -185,5 +178,5 @@ public class RitualEffectFeatheredKnife extends RitualEffect
featheredKnifeRitual.add(new RitualComponent(-3, 0, 3, RitualComponent.AIR));
featheredKnifeRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.AIR));
return featheredKnifeRitual;
}
}
}

View file

@ -1,29 +1,26 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectFlight extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int reductusDrain = 5;
public static final int reagentCooldown = 50;
public static final int aetherDrain = 10;
public static final int reductusDrain = 5;
public static final int reagentCooldown = 50;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -42,7 +39,7 @@ public class RitualEffectFlight extends RitualEffect
axis.minY = 0;
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
int entityCount = 0;
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
@ -56,30 +53,30 @@ public class RitualEffectFlight extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
entityCount = 0;
EntityPlayer ownerEntity = SpellHelper.getPlayerForUsername(owner);
entityCount = 0;
EntityPlayer ownerEntity = SpellHelper.getPlayerForUsername(owner);
for (EntityPlayer entity : entities)
{
if(hasReductus && entity != ownerEntity)
{
continue;
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, hasAether ? 30*20 : 20, 0));
entityCount ++;
if (hasReductus && entity != ownerEntity)
{
continue;
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, hasAether ? 30 * 20 : 20, 0));
entityCount++;
}
if(entityCount > 0 && world.getWorldTime() % reagentCooldown == 0)
if (entityCount > 0 && world.getWorldTime() % reagentCooldown == 0)
{
if(hasAether)
{
if (hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
if (hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
}
@ -97,90 +94,90 @@ public class RitualEffectFlight extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> flightRitual = new ArrayList();
flightRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, -1, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(2, 0, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 0, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 0, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(2, 0, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(1, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(1, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-1, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, 1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, -1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, 1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, -4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-4, 0, -3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-3, 0, 4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(4, 0, -3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(3, 0, -4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-4, 0, 3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(3, 0, 4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(4, 0, 3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-1, 1, 0, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 1, 0, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(0, 1, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(0, 1, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(2, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, -2, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, 2, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(-4, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(4, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, -4, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, 4, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(-5, 1, 0, RitualComponent.AIR));
flightRitual.add(new RitualComponent(5, 1, 0, RitualComponent.AIR));
flightRitual.add(new RitualComponent(0, 1, -5, RitualComponent.AIR));
flightRitual.add(new RitualComponent(0, 1, 5, RitualComponent.AIR));
flightRitual.add(new RitualComponent(5, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(-5, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK));
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> flightRitual = new ArrayList();
flightRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, -1, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(2, 0, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 0, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 0, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(2, 0, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(1, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(1, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-1, 0, -3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, 1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(3, 0, -1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, 1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 0, -4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-4, 0, -3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-3, 0, 4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(4, 0, -3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(3, 0, -4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-4, 0, 3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(3, 0, 4, RitualComponent.WATER));
flightRitual.add(new RitualComponent(4, 0, 3, RitualComponent.WATER));
flightRitual.add(new RitualComponent(-1, 1, 0, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 1, 0, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(0, 1, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(0, 1, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(2, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, -2, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, 2, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(-4, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(4, 1, 0, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, -4, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(0, 1, 4, RitualComponent.BLANK));
flightRitual.add(new RitualComponent(-5, 1, 0, RitualComponent.AIR));
flightRitual.add(new RitualComponent(5, 1, 0, RitualComponent.AIR));
flightRitual.add(new RitualComponent(0, 1, -5, RitualComponent.AIR));
flightRitual.add(new RitualComponent(0, 1, 5, RitualComponent.AIR));
flightRitual.add(new RitualComponent(5, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(-5, 0, 0, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK));
flightRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK));
for (int i = 2; i <= 4; i++)
{
flightRitual.add(new RitualComponent(-i, 2, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 2, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 2, -i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 2, i, RitualComponent.EARTH));
}
for (int i = 2; i <= 4; i++)
{
flightRitual.add(new RitualComponent(-i, 2, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 2, 0, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 2, -i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(0, 2, i, RitualComponent.EARTH));
}
flightRitual.add(new RitualComponent(2, 4, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 4, 2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 4, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 4, -2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(2, 4, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-1, 4, 2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 4, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-1, 4, -2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(2, 4, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 4, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(2, 4, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 4, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-4, 2, -4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(4, 2, 4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(4, 2, -4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-4, 2, 4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(2, 4, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 4, 2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 4, 1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(1, 4, -2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(2, 4, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-1, 4, 2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-2, 4, -1, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-1, 4, -2, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(2, 4, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 4, 2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(2, 4, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-2, 4, -2, RitualComponent.AIR));
flightRitual.add(new RitualComponent(-4, 2, -4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(4, 2, 4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(4, 2, -4, RitualComponent.FIRE));
flightRitual.add(new RitualComponent(-4, 2, 4, RitualComponent.FIRE));
for (int i = -1; i <= 1; i++)
{
flightRitual.add(new RitualComponent(3, 4, i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 4, i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 4, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 4, -3, RitualComponent.EARTH));
}
return flightRitual;
}
for (int i = -1; i <= 1; i++)
{
flightRitual.add(new RitualComponent(3, 4, i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(-3, 4, i, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 4, 3, RitualComponent.EARTH));
flightRitual.add(new RitualComponent(i, 4, -3, RitualComponent.EARTH));
}
return flightRitual;
}
}

View file

@ -1,8 +1,10 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemFood;
@ -10,15 +12,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.FoodStats;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectFullStomach extends RitualEffect
{
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -34,15 +34,15 @@ public class RitualEffectFullStomach extends RitualEffect
{
return;
}
double horizRange = 16;
double vertRange = 16;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x+0.5, y+0.5, z+0.5, horizRange, vertRange);
if(playerList == null)
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizRange, vertRange);
if (playerList == null)
{
return;
return;
}
if (currentEssence < this.getCostPerRefresh() * playerList.size())
@ -50,52 +50,52 @@ public class RitualEffectFullStomach extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
TileEntity tile = world.getTileEntity(x, y+1, z);
IInventory inventory = null;
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}else
{
tile = world.getTileEntity(x, y-1, z);
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}
}
int count = 0;
if(inventory != null)
{
for(EntityPlayer player : playerList)
{
FoodStats foodStats = player.getFoodStats();
float satLevel = foodStats.getSaturationLevel();
for(int i=0; i<inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemFood)
{
ItemFood foodItem = (ItemFood)stack.getItem();
int regularHeal = foodItem.func_150905_g(stack);
float saturatedHeal = foodItem.func_150906_h(stack) * regularHeal * 2.0f;
if(saturatedHeal + satLevel <= 20)
{
foodStats.setFoodSaturationLevel(saturatedHeal + satLevel);
inventory.decrStackSize(i, 1);
count++;
break;
}
}
}
}
}
TileEntity tile = world.getTileEntity(x, y + 1, z);
IInventory inventory = null;
if (tile instanceof IInventory)
{
inventory = (IInventory) tile;
} else
{
tile = world.getTileEntity(x, y - 1, z);
if (tile instanceof IInventory)
{
inventory = (IInventory) tile;
}
}
int count = 0;
if (inventory != null)
{
for (EntityPlayer player : playerList)
{
FoodStats foodStats = player.getFoodStats();
float satLevel = foodStats.getSaturationLevel();
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof ItemFood)
{
ItemFood foodItem = (ItemFood) stack.getItem();
int regularHeal = foodItem.func_150905_g(stack);
float saturatedHeal = foodItem.func_150906_h(stack) * regularHeal * 2.0f;
if (saturatedHeal + satLevel <= 20)
{
foodStats.setFoodSaturationLevel(saturatedHeal + satLevel);
inventory.decrStackSize(i, 1);
count++;
break;
}
}
}
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * count);
}
}
@ -107,9 +107,9 @@ public class RitualEffectFullStomach extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> fullRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> fullRitual = new ArrayList();
fullRitual.add(new RitualComponent(0, 0, 3, RitualComponent.FIRE));
fullRitual.add(new RitualComponent(0, 0, -3, RitualComponent.FIRE));
fullRitual.add(new RitualComponent(3, 0, 0, RitualComponent.FIRE));
@ -118,7 +118,7 @@ public class RitualEffectFullStomach extends RitualEffect
fullRitual.add(new RitualComponent(1, 0, -1, RitualComponent.AIR));
fullRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.AIR));
fullRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.AIR));
fullRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
fullRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
fullRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
@ -127,12 +127,12 @@ public class RitualEffectFullStomach extends RitualEffect
fullRitual.add(new RitualComponent(1, 0, -2, RitualComponent.AIR));
fullRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.AIR));
fullRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.AIR));
fullRitual.add(new RitualComponent(4, 0, 4, RitualComponent.WATER));
fullRitual.add(new RitualComponent(4, 0, -4, RitualComponent.WATER));
fullRitual.add(new RitualComponent(-4, 0, -4, RitualComponent.WATER));
fullRitual.add(new RitualComponent(-4, 0, 4, RitualComponent.WATER));
fullRitual.add(new RitualComponent(4, 0, 3, RitualComponent.EARTH));
fullRitual.add(new RitualComponent(3, 0, 4, RitualComponent.EARTH));
fullRitual.add(new RitualComponent(-4, 0, 3, RitualComponent.EARTH));
@ -143,5 +143,5 @@ public class RitualEffectFullStomach extends RitualEffect
fullRitual.add(new RitualComponent(-3, 0, 4, RitualComponent.EARTH));
return fullRitual;
}
}
}

View file

@ -1,29 +1,25 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFarmland;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectGrowth extends RitualEffect
{
private static final int aquasalusDrain = 10;
private static final int terraeDrain = 20;
private static final int orbisTerraeDrain = 20;
private static final int virtusDrain = 10;
private static final int aquasalusDrain = 10;
private static final int terraeDrain = 20;
private static final int orbisTerraeDrain = 20;
private static final int virtusDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -35,38 +31,38 @@ public class RitualEffectGrowth extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < this.getCostPerRefresh()*9)
if (currentEssence < this.getCostPerRefresh() * 9)
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae);
int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae);
if (world.getWorldTime() % speed != 0)
{
return;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
int hydrationRange = hasVirtus ? 4 : 1;
for(int i=-hydrationRange; i<=hydrationRange; i++)
{
for(int j=-hydrationRange; j<=hydrationRange; j++)
{
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
if(SpellHelper.hydrateSoil(world, x + i, y + 1, z + j))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
}
if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
int hydrationRange = hasVirtus ? 4 : 1;
for (int i = -hydrationRange; i <= hydrationRange; i++)
{
for (int j = -hydrationRange; j <= hydrationRange; j++)
{
if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
if (SpellHelper.hydrateSoil(world, x + i, y + 1, z + j))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
}
int flag = 0;
@ -90,14 +86,14 @@ public class RitualEffectGrowth extends RitualEffect
if (flag > 0)
{
if(hasTerrae)
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
if(hasOrbisTerrae)
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
if(hasVirtus)
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
if (hasTerrae)
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
if (hasOrbisTerrae)
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
if (hasVirtus)
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*flag);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag);
}
}
}
@ -109,9 +105,9 @@ public class RitualEffectGrowth extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> growthRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> growthRitual = new ArrayList();
growthRitual.add(new RitualComponent(1, 0, 0, 1));
growthRitual.add(new RitualComponent(-1, 0, 0, 1));
growthRitual.add(new RitualComponent(0, 0, 1, 1));
@ -121,28 +117,28 @@ public class RitualEffectGrowth extends RitualEffect
growthRitual.add(new RitualComponent(-1, 0, -1, 3));
growthRitual.add(new RitualComponent(1, 0, -1, 3));
return growthRitual;
}
}
public int getSpeedForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
{
if(hasOrbisTerrae)
{
if(hasTerrae)
{
return 10;
}else
{
return 15;
}
}else
{
if(hasTerrae)
{
return 20;
}else
{
return 30;
}
}
if (hasOrbisTerrae)
{
if (hasTerrae)
{
return 10;
} else
{
return 15;
}
} else
{
if (hasTerrae)
{
return 20;
} else
{
return 30;
}
}
}
}

View file

@ -1,30 +1,27 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectHarvest extends RitualEffect
{
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
@ -49,23 +46,23 @@ public class RitualEffectHarvest extends RitualEffect
{
return;
}
Block block = world.getBlock(x, y-1, z);
Block block = world.getBlock(x, y - 1, z);
int flag = 0;
int range = this.getRadiusForModifierBlock(block);
int vertRange = 4;
int vertRange = 4;
for (int i = -range; i <= range; i++)
{
for (int j = -vertRange; j <= vertRange; j++)
{
for(int k = -range; k<=range; k++)
{
if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount)
for (int k = -range; k <= range; k++)
{
if (HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount)
{
flag++;
flag++;
}
}
}
}
}
@ -74,70 +71,70 @@ public class RitualEffectHarvest extends RitualEffect
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * Math.min(maxCount, flag));
}
}
}
}
@Override
public int getCostPerRefresh()
{
return 20;
}
@Override
public int getCostPerRefresh()
{
return 20;
}
public int getRadiusForModifierBlock(Block block)
{
if(block == null)
{
return 4;
}
if(block == Blocks.diamond_block)
{
return 15;
}
if(block == Blocks.gold_block)
{
return 10;
}
if(block == Blocks.iron_block)
{
return 6;
}
return 4;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> harvestRitual = new ArrayList();
public int getRadiusForModifierBlock(Block block)
{
if (block == null)
{
return 4;
}
if (block == Blocks.diamond_block)
{
return 15;
}
if (block == Blocks.gold_block)
{
return 10;
}
if (block == Blocks.iron_block)
{
return 6;
}
return 4;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> harvestRitual = new ArrayList();
harvestRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(2, 0, 0, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(0, 0, 2, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(0, 0, -2, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(3, 0, 1, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(3, 0, -1, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-3, 0, 1, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(1, 0, 3, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(1, 0, -3, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-1, 0, -3, RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(2, 0, 3, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(3, 0, 2, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(2, 0, -3, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(3, 0, -2, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.WATER));
harvestRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
harvestRitual.add(new RitualComponent(2,0,0,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-2,0,0,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(0,0,2,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(0,0,-2,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(3,0,1,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(3,0,-1,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-3,0,1,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-3,0,-1,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(1,0,3,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-1,0,3,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(1,0,-3,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(-1,0,-3,RitualComponent.EARTH));
harvestRitual.add(new RitualComponent(2,0,3,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(3,0,2,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(2,0,-3,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-3,0,2,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-2,0,3,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(3,0,-2,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-2,0,-3,RitualComponent.WATER));
harvestRitual.add(new RitualComponent(-3,0,-2,RitualComponent.WATER));
return harvestRitual;
}
}
}

View file

@ -1,30 +1,26 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectHealing extends RitualEffect
{
public static final int reductusDrain = 10;
public static final int virtusDrain = 10;
public static final int praesidiumDrain = 2;
public static final int reductusDrain = 10;
public static final int virtusDrain = 10;
public static final int praesidiumDrain = 2;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -37,22 +33,22 @@ public class RitualEffectHealing extends RitualEffect
int z = ritualStone.getZCoord();
int timeDelay = 50;
if (world.getWorldTime() % timeDelay != 0)
{
return;
}
boolean hasPraesidium = this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, false);
int range = 15 * (hasPraesidium ? 3 : 1);
int vertRange = 15 * (hasPraesidium ? 3 : 1);
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange);
int entityCount = 0;
boolean flag = false;
for(EntityLivingBase livingEntity : list)
for (EntityLivingBase livingEntity : list)
{
if (livingEntity instanceof EntityPlayer)
{
@ -62,64 +58,64 @@ public class RitualEffectHealing extends RitualEffect
entityCount++;
}
}
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
int cost = this.getCostPerRefresh() * (hasVirtus ? 3 : 1);
int potency = hasVirtus ? 1 : 0;
int potency = hasVirtus ? 1 : 0;
if (currentEssence < cost * entityCount)
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
entityCount = 0;
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
for(EntityLivingBase livingEntity : list)
entityCount = 0;
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
for (EntityLivingBase livingEntity : list)
{
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if(hasReductus && !(livingEntity instanceof EntityPlayer))
{
continue;
}
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if (hasReductus && !(livingEntity instanceof EntityPlayer))
{
continue;
}
if (livingEntity.getHealth() + 0.1f < livingEntity.getMaxHealth())
{
PotionEffect effect = livingEntity.getActivePotionEffect(Potion.regeneration);
if(effect == null || (effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay))
{
if(!hasVirtus || (this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false)))
{
livingEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency));
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if (livingEntity instanceof EntityPlayer)
PotionEffect effect = livingEntity.getActivePotionEffect(Potion.regeneration);
if (effect == null || (effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay))
{
if (!hasVirtus || (this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false)))
{
livingEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency));
if (hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if (hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if (livingEntity instanceof EntityPlayer)
{
entityCount += 10;
} else
{
entityCount++;
}
}
}
}
}
}
}
if(entityCount > 0)
if (entityCount > 0)
{
if(hasPraesidium)
{
this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true);
}
if (hasPraesidium)
{
this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, cost * entityCount);
}
}
@ -128,14 +124,13 @@ public class RitualEffectHealing extends RitualEffect
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 20;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> healingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> healingRitual = new ArrayList();
healingRitual.add(new RitualComponent(4, 0, 0, RitualComponent.AIR));
healingRitual.add(new RitualComponent(5, 0, -1, RitualComponent.AIR));
healingRitual.add(new RitualComponent(5, 0, 1, RitualComponent.AIR));
@ -181,5 +176,5 @@ public class RitualEffectHealing extends RitualEffect
healingRitual.add(new RitualComponent(-5, -1, -4, RitualComponent.EARTH));
healingRitual.add(new RitualComponent(-5, 0, -5, RitualComponent.EARTH));
return healingRitual;
}
}
}

View file

@ -1,30 +1,25 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectInterdiction extends RitualEffect
{
public static final int aetherDrain = 1;
public static final int magicalesDrain = 1;
public static final int aetherDrain = 1;
public static final int magicalesDrain = 1;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -43,15 +38,15 @@ public class RitualEffectInterdiction extends RitualEffect
{
int d0 = 5;
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, d0, d0);
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0);
boolean flag = false;
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
boolean playerFlag = false;
for(EntityLivingBase entityLiving : list)
for (EntityLivingBase entityLiving : list)
{
if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer)entityLiving).equals(owner))))
if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer) entityLiving).equals(owner))))
{
double xDif = entityLiving.posX - x;
double yDif = entityLiving.posY - (y + 1);
@ -59,65 +54,59 @@ public class RitualEffectInterdiction extends RitualEffect
entityLiving.motionX = 0.1 * xDif;
entityLiving.motionY = 0.1 * yDif;
entityLiving.motionZ = 0.1 * zDif;
if(hasOffensa && entityLiving instanceof EntityPlayer)
if (hasOffensa && entityLiving instanceof EntityPlayer)
{
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityLiving, 0.1 * xDif, 0.1 * yDif, 0.1 * zDif);
playerFlag = true;
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) entityLiving, 0.1 * xDif, 0.1 * yDif, 0.1 * zDif);
playerFlag = true;
}
entityLiving.fallDistance = 0;
flag = true;
//entityLiving.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
}
if(playerFlag)
if (playerFlag)
{
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
}
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
if(hasAether)
if (hasAether)
{
int aetherDrainRate = 10;
int horizontalRadius = 5;
int verticalRadius = 5;
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(horizontalRadius, verticalRadius, horizontalRadius));
if(itemList != null)
{
boolean itemFlag = false;
for(EntityItem entity : itemList)
{
double xDif = entity.posX - x;
int aetherDrainRate = 10;
int horizontalRadius = 5;
int verticalRadius = 5;
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(horizontalRadius, verticalRadius, horizontalRadius));
if (itemList != null)
{
boolean itemFlag = false;
for (EntityItem entity : itemList)
{
double xDif = entity.posX - x;
double yDif = entity.posY - (y + 1);
double zDif = entity.posZ - z;
entity.motionX = 0.1 * xDif;
entity.motionY = 0.1 * yDif;
entity.motionZ = 0.1 * zDif;
itemFlag = true;
}
if(itemFlag)
{
flag = true;
if(world.getWorldTime() % aetherDrainRate == 0)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
}
}
}
if (itemFlag)
{
flag = true;
if (world.getWorldTime() % aetherDrainRate == 0)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
}
}
}
if (world.getWorldTime() % 2 == 0 && flag)
{
@ -133,9 +122,9 @@ public class RitualEffectInterdiction extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> interdictionRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> interdictionRitual = new ArrayList();
interdictionRitual.add(new RitualComponent(1, 0, 0, 4));
interdictionRitual.add(new RitualComponent(-1, 0, 0, 4));
interdictionRitual.add(new RitualComponent(0, 0, 1, 4));
@ -145,5 +134,5 @@ public class RitualEffectInterdiction extends RitualEffect
interdictionRitual.add(new RitualComponent(-1, 0, -1, 4));
interdictionRitual.add(new RitualComponent(1, 0, -1, 4));
return interdictionRitual;
}
}
}

View file

@ -1,40 +1,32 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFurnace;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.BlockFurnace;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectItemSuction extends RitualEffect
{
public static final int reductusDrain = 1;
public static final int timeDelayMin = 60;
public static final int reductusDrain = 1;
public static final int timeDelayMin = 60;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
@ -56,99 +48,63 @@ public class RitualEffectItemSuction extends RitualEffect
{
return;
}
if (currentEssence < this.getCostPerRefresh()*100)
if (currentEssence < this.getCostPerRefresh() * 100)
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
List<EntityItem> itemDropList = SpellHelper.getItemsInRange(world, x+0.5f, y+0.5f, z+0.5f, 10, 10);
List<EntityItem> itemDropList = SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, 10, 10);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
int count = 0;
if (itemDropList != null)
{
int invSize = tileEntity.getSizeInventory();
for (EntityItem itemEntity : itemDropList)
{
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if(hasReductus && itemEntity.age < this.timeDelayMin)
{
continue;
}
ItemStack item = itemEntity.getEntityItem();
ItemStack copyStack = itemEntity.getEntityItem().copy();
int pastAmount = copyStack.stackSize;
// for (int n = 0; n < invSize; n++)
// {
// if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
// {
// ItemStack itemStack = tileEntity.getStackInSlot(n);
//
// if (itemStack == null)
// {
// tileEntity.setInventorySlotContents(n, item);
// copyStack.stackSize = 0;
// } else
// {
// if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
// {
// int itemSize = itemStack.stackSize;
// int copySize = copyStack.stackSize;
// int maxSize = itemStack.getMaxStackSize();
//
// if (copySize + itemSize < maxSize)
// {
// copyStack.stackSize = 0;
// itemStack.stackSize = itemSize + copySize;
// tileEntity.setInventorySlotContents(n, itemStack);
// } else
// {
// copyStack.stackSize = itemSize + copySize - maxSize;
// itemStack.stackSize = maxSize;
// }
// }
// }
// }
// }
//count++;
ItemStack newStack = SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
if(newStack != null && newStack.stackSize < pastAmount)
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if (hasReductus && itemEntity.age < this.timeDelayMin)
{
count++;
if(newStack.stackSize<=0)
continue;
}
ItemStack item = itemEntity.getEntityItem();
ItemStack copyStack = itemEntity.getEntityItem().copy();
int pastAmount = copyStack.stackSize;
ItemStack newStack = SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
if (newStack != null && newStack.stackSize < pastAmount)
{
count++;
if (newStack.stackSize <= 0)
{
itemEntity.setDead();
itemEntity.getEntityItem().stackSize = newStack.stackSize;
itemEntity.setDead();
itemEntity.getEntityItem().stackSize = newStack.stackSize;
}
if (newStack.stackSize > 0)
{
itemEntity.getEntityItem().stackSize = newStack.stackSize;
}
if(hasReductus)
if (hasReductus)
{
BlockFurnace d;
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
BlockFurnace d;
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
}
}
if(count>0)
if (count > 0)
{
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*Math.min(count, 100));
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * Math.min(count, 100));
return;
}
}
}
}
@Override
@ -158,9 +114,9 @@ public class RitualEffectItemSuction extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> suctionRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> suctionRitual = new ArrayList();
suctionRitual.add(new RitualComponent(2, 0, 0, RitualComponent.AIR));
suctionRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.AIR));
suctionRitual.add(new RitualComponent(0, 0, 2, RitualComponent.AIR));
@ -174,5 +130,5 @@ public class RitualEffectItemSuction extends RitualEffect
suctionRitual.add(new RitualComponent(0, -1, 1, RitualComponent.AIR));
suctionRitual.add(new RitualComponent(0, -1, -1, RitualComponent.AIR));
return suctionRitual;
}
}
}

View file

@ -1,27 +1,25 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectJumping extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -32,9 +30,9 @@ public class RitualEffectJumping extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
double range = 0.5;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+1.5, z+0.5, range, range);
double range = 0.5;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range);
if (currentEssence < this.getCostPerRefresh() * livingList.size())
{
@ -42,25 +40,25 @@ public class RitualEffectJumping extends RitualEffect
} else
{
int flag = 0;
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
for(EntityLivingBase livingEntity : livingList)
for (EntityLivingBase livingEntity : livingList)
{
if(livingEntity.isSneaking())
{
continue;
}
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
if (livingEntity.isSneaking())
{
continue;
}
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
double motionY = 1.5 * (hasAether ? 2 : 1);
if (livingEntity instanceof EntityPlayer)
{
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ);
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
flag++;
@ -70,24 +68,24 @@ public class RitualEffectJumping extends RitualEffect
livingEntity.fallDistance = 0;
flag++;
}
if(hasAether)
if (hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasTerrae)
if (hasTerrae)
{
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 5 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 5 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
}
}
if (flag > 0)
{
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*flag);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag);
}
}
}
@ -99,9 +97,9 @@ public class RitualEffectJumping extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> jumpingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> jumpingRitual = new ArrayList();
for (int i = -1; i <= 1; i++)
{
@ -111,5 +109,5 @@ public class RitualEffectJumping extends RitualEffect
jumpingRitual.add(new RitualComponent(1, i, -1, RitualComponent.AIR));
}
return jumpingRitual;
}
}
}

View file

@ -1,38 +1,36 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectLava extends RitualEffect
{
public static final int sanctusDrain = 20;
public static final int offensaDrain = 50;
public static final int reductusDrain = 5;
public static final int fireFuseCost = 1000;
public static final int sanctusDrain = 20;
public static final int offensaDrain = 50;
public static final int reductusDrain = 5;
public static final int fireFuseCost = 1000;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -44,47 +42,47 @@ public class RitualEffectLava extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if(this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost))
if (this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost))
{
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 5;
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 5;
List<EntityLivingBase> entityList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
EntityPlayer player = SpellHelper.getPlayerForUsername(owner);
for(EntityLivingBase entity : entityList)
for (EntityLivingBase entity : entityList)
{
if(entity != player && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
{
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if(entity instanceof EntityPlayer)
{
if(drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, fireFuseCost);
}
if (entity != player && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
{
if (hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if (entity instanceof EntityPlayer)
{
if (drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id, 100, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, fireFuseCost);
}
}
}
Block block = world.getBlock(x, y + 1, z);
if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer))
{
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (int i = 0; i < 10; i++)
@ -95,47 +93,45 @@ public class RitualEffectLava extends RitualEffect
world.setBlock(x, y + 1, z, Blocks.lava, 0, 3);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}else
} else
{
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
if(!hasSanctus)
{
return;
}
TileEntity tile = world.getTileEntity(x, y + 1, z);
if(tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false);
if(amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
if (!hasSanctus)
{
return;
}
TileEntity tile = world.getTileEntity(x, y + 1, z);
if (tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false);
if (amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
}
}
}
}
}
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 500;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> lavaRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> lavaRitual = new ArrayList();
lavaRitual.add(new RitualComponent(1, 0, 0, 2));
lavaRitual.add(new RitualComponent(-1, 0, 0, 2));
lavaRitual.add(new RitualComponent(0, 0, 1, 2));
lavaRitual.add(new RitualComponent(0, 0, -1, 2));
return lavaRitual;
}
}
}

View file

@ -1,31 +1,28 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectLeap extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
public static final int reductusDrain = 10;
public static final int tenebraeDrain = 10;
public static final int sanctusDrain = 10;
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
public static final int reductusDrain = 10;
public static final int tenebraeDrain = 10;
public static final int sanctusDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -38,43 +35,46 @@ public class RitualEffectLeap extends RitualEffect
int z = ritualStone.getZCoord();
double range = 2.0;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, range);
if(livingList == null){return;}
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
if (livingList == null)
{
return;
}
if (currentEssence < this.getCostPerRefresh() * livingList.size())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean hasTenebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
int direction = ritualStone.getDirection();
int direction = ritualStone.getDirection();
int flag = 0;
for(EntityLivingBase livingEntity : livingList)
for (EntityLivingBase livingEntity : livingList)
{
if(livingEntity.isSneaking())
if (livingEntity.isSneaking())
{
continue;
continue;
}
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
hasTenebrae = hasTenebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
double motionY = hasTerrae ? 0.6 : 1.2;
double speed = hasAether ? 6.0 : 3.0;
if (!(hasTenebrae || hasSanctus)|| livingEntity instanceof EntityPlayer)
double motionY = hasTerrae ? 0.6 : 1.2;
double speed = hasAether ? 6.0 : 3.0;
if (!(hasTenebrae || hasSanctus) || livingEntity instanceof EntityPlayer)
{
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
@ -82,30 +82,30 @@ public class RitualEffectLeap extends RitualEffect
switch (direction)
{
case 1:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, -speed);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, -speed);
break;
case 2:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, speed, motionY, 0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, speed, motionY, 0);
break;
case 3:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, speed);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, speed);
break;
case 4:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, -speed, motionY, 0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, -speed, motionY, 0);
break;
}
flag++;
} else
{
if((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild()))
{
continue;
}
if ((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild()))
{
continue;
}
livingEntity.motionY = motionY;
switch (direction)
@ -131,36 +131,36 @@ public class RitualEffectLeap extends RitualEffect
break;
}
if(hasTenebrae)
if (hasTenebrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
}
if(hasSanctus)
if (hasSanctus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
}
livingEntity.fallDistance = 0;
flag++;
}
if(hasAether)
if (hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasTerrae)
if (hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if(hasReductus)
if (hasReductus)
{
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3*20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
}
if (flag > 0)
@ -177,9 +177,9 @@ public class RitualEffectLeap extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> leapingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> leapingRitual = new ArrayList();
leapingRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
leapingRitual.add(new RitualComponent(1, 0, -1, RitualComponent.AIR));
leapingRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.AIR));
@ -190,5 +190,5 @@ public class RitualEffectLeap extends RitualEffect
leapingRitual.add(new RitualComponent(-2, 0, i, RitualComponent.AIR));
}
return leapingRitual;
}
}
}

View file

@ -1,23 +1,19 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectLifeConduit extends RitualEffect
{
@ -54,120 +50,118 @@ public class RitualEffectLifeConduit extends RitualEffect
{
return;
}
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
int d0 = 15;
int vertRange = 20;
EntityPlayer entityOwner = null;
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x, y, z, d0, vertRange);
for(EntityPlayer player : list)
for (EntityPlayer player : list)
{
if(SpellHelper.getUsername(player).equals(owner))
{
entityOwner = player;
}
if (SpellHelper.getUsername(player).equals(owner))
{
entityOwner = player;
}
}
if (entityOwner == null)
{
return;
}
int fillAmount = Math.min(currentEssence/2,tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid,10000), false));
int fillAmount = Math.min(currentEssence / 2, tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false));
{
tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid,fillAmount), true);
if(entityOwner.getHealth() > 2.0f && fillAmount != 0)
{
entityOwner.setHealth(2.0f);
}
SoulNetworkHandler.syphonFromNetwork(owner, fillAmount*2);
tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true);
if (entityOwner.getHealth() > 2.0f && fillAmount != 0)
{
entityOwner.setHealth(2.0f);
}
SoulNetworkHandler.syphonFromNetwork(owner, fillAmount * 2);
}
}
@Override
public int getCostPerRefresh()
{
return 0;
return 0;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> conduitRitual = new ArrayList();
conduitRitual.add(new RitualComponent(-1,0,-1,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-1,0,1,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(1,0,1,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(1,0,-1,RitualComponent.FIRE));
for(int i=0; i<4; i++)
{
conduitRitual.add(new RitualComponent(-2,i,-2,RitualComponent.AIR));
conduitRitual.add(new RitualComponent(-2,i,2,RitualComponent.AIR));
conduitRitual.add(new RitualComponent(2,i,2,RitualComponent.AIR));
conduitRitual.add(new RitualComponent(2,i,-2,RitualComponent.AIR));
}
conduitRitual.add(new RitualComponent(4,1,4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4,1,-4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4,1,-4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4,1,4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(3,1,4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4,1,3,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-3,1,4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4,1,3,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(3,1,-4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4,1,-3,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-3,1,-4,RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4,1,-3,RitualComponent.EARTH));
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> conduitRitual = new ArrayList();
for(int i=0; i<2; i++)
{
conduitRitual.add(new RitualComponent(4,i+2,4,RitualComponent.WATER));
conduitRitual.add(new RitualComponent(4,i+2,-4,RitualComponent.WATER));
conduitRitual.add(new RitualComponent(-4,i+2,-4,RitualComponent.WATER));
conduitRitual.add(new RitualComponent(-4,i+2,4,RitualComponent.WATER));
}
conduitRitual.add(new RitualComponent(4,4,4,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(4,4,-4,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-4,4,-4,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-4,4,4,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(6,0,5,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(5,0,6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6,0,5,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-5,0,6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(6,0,-5,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(5,0,-6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6,0,-5,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-5,0,-6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(1, 0, 1, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(1, 0, -1, RitualComponent.FIRE));
for (int i = 0; i < 4; i++)
{
conduitRitual.add(new RitualComponent(-2, i, -2, RitualComponent.AIR));
conduitRitual.add(new RitualComponent(-2, i, 2, RitualComponent.AIR));
conduitRitual.add(new RitualComponent(2, i, 2, RitualComponent.AIR));
conduitRitual.add(new RitualComponent(2, i, -2, RitualComponent.AIR));
}
conduitRitual.add(new RitualComponent(4, 1, 4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4, 1, -4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4, 1, -4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4, 1, 4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(3, 1, 4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4, 1, 3, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-3, 1, 4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4, 1, 3, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(3, 1, -4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(4, 1, -3, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-3, 1, -4, RitualComponent.EARTH));
conduitRitual.add(new RitualComponent(-4, 1, -3, RitualComponent.EARTH));
for (int i = 0; i < 2; i++)
{
conduitRitual.add(new RitualComponent(4, i + 2, 4, RitualComponent.WATER));
conduitRitual.add(new RitualComponent(4, i + 2, -4, RitualComponent.WATER));
conduitRitual.add(new RitualComponent(-4, i + 2, -4, RitualComponent.WATER));
conduitRitual.add(new RitualComponent(-4, i + 2, 4, RitualComponent.WATER));
}
conduitRitual.add(new RitualComponent(4, 4, 4, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(4, 4, -4, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-4, 4, -4, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-4, 4, 4, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(6, 0, 5, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(5, 0, 6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6, 0, 5, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-5, 0, 6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(6, 0, -5, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(5, 0, -6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6, 0, -5, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-5, 0, -6, RitualComponent.FIRE));
for (int i = 0; i < 2; i++)
{
conduitRitual.add(new RitualComponent(6, i, 6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(6, i, -6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6, i, 6, RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6, i, -6, RitualComponent.FIRE));
}
for (int i = 0; i < 3; i++)
{
conduitRitual.add(new RitualComponent(6, i + 2, 6, RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(6, i + 2, -6, RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(-6, i + 2, 6, RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(-6, i + 2, -6, RitualComponent.BLANK));
}
conduitRitual.add(new RitualComponent(6, 5, 6, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(6, 5, -6, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-6, 5, 6, RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-6, 5, -6, RitualComponent.DUSK));
for(int i=0; i<2; i++)
{
conduitRitual.add(new RitualComponent(6,i,6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(6,i,-6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6,i,6,RitualComponent.FIRE));
conduitRitual.add(new RitualComponent(-6,i,-6,RitualComponent.FIRE));
}
for(int i=0; i<3; i++)
{
conduitRitual.add(new RitualComponent(6,i+2,6,RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(6,i+2,-6,RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(-6,i+2,6,RitualComponent.BLANK));
conduitRitual.add(new RitualComponent(-6,i+2,-6,RitualComponent.BLANK));
}
conduitRitual.add(new RitualComponent(6,5,6,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(6,5,-6,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-6,5,6,RitualComponent.DUSK));
conduitRitual.add(new RitualComponent(-6,5,-6,RitualComponent.DUSK));
return conduitRitual;
}
}
}

View file

@ -1,37 +1,30 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
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 RitualEffectMagnetic extends RitualEffect
{
private static final int potentiaDrain = 10;
private static final int terraeDrain = 10;
private static final int orbisTerraeDrain = 10;
private static final int potentiaDrain = 10;
private static final int terraeDrain = 10;
private static final int orbisTerraeDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
@ -39,20 +32,20 @@ public class RitualEffectMagnetic extends RitualEffect
int z = ritualStone.getZCoord();
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
if(world.getWorldTime() % (hasPotentia ? 10 : 40) != 0)
if (world.getWorldTime() % (hasPotentia ? 10 : 40) != 0)
{
return;
return;
}
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
int radius = this.getRadiusForReagents(hasTerrae, hasOrbisTerrae);
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int xRep = 0;
@ -79,7 +72,6 @@ public class RitualEffectMagnetic extends RitualEffect
if (replace)
{
//boolean hasReplaced = false;
for (int j = y - 1; j >= 0; j--)
{
for (int i = -radius; i <= radius; i++)
@ -103,26 +95,25 @@ public class RitualEffectMagnetic extends RitualEffect
if (oreName.contains("ore"))
{
//TODO
//Allow swapping code. This means the searched block is an ore.
BlockTeleposer.swapBlocks(world, world, x + i, j, z + k, xRep, yRep, zRep);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
if(hasPotentia)
if (hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
if(hasTerrae)
if (hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if(hasOrbisTerrae)
if (hasOrbisTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
}
return;
}
}
@ -140,9 +131,9 @@ public class RitualEffectMagnetic extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> magneticRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> magneticRitual = new ArrayList();
magneticRitual.add(new RitualComponent(1, 0, 1, RitualComponent.EARTH));
magneticRitual.add(new RitualComponent(1, 0, -1, RitualComponent.EARTH));
magneticRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.EARTH));
@ -160,28 +151,28 @@ public class RitualEffectMagnetic extends RitualEffect
magneticRitual.add(new RitualComponent(-2, 2, 0, RitualComponent.FIRE));
magneticRitual.add(new RitualComponent(0, 2, -2, RitualComponent.FIRE));
return magneticRitual;
}
}
public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
{
if(hasTerrae)
{
if(hasOrbisTerrae)
{
return 31;
}else
{
return 7;
}
}else
{
if(hasOrbisTerrae)
{
return 12;
}else
{
return 3;
}
}
}
{
if (hasTerrae)
{
if (hasOrbisTerrae)
{
return 31;
} else
{
return 7;
}
} else
{
if (hasOrbisTerrae)
{
return 12;
} else
{
return 3;
}
}
}
}

View file

@ -1,26 +1,23 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class RitualEffectSoulBound extends RitualEffect
{
@ -58,9 +55,6 @@ 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)
@ -69,13 +63,13 @@ public class RitualEffectSoulBound extends RitualEffect
}
if(BindingRegistry.isRequiredItemValid(itemStack))
if (BindingRegistry.isRequiredItemValid(itemStack))
{
ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack)+1);
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();
break;
item.setDead();
break;
}
if (world.rand.nextInt(10) == 0)
@ -131,8 +125,8 @@ public class RitualEffectSoulBound extends RitualEffect
if (ritualStone.getCooldown() <= 0)
{
ItemStack spawnedItem = BindingRegistry.getOutputForIndex(ritualStone.getVar1()-1);
ItemStack spawnedItem = BindingRegistry.getOutputForIndex(ritualStone.getVar1() - 1);
if (spawnedItem != null)
{
@ -159,9 +153,9 @@ public class RitualEffectSoulBound extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> boundSoulRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> boundSoulRitual = new ArrayList();
boundSoulRitual.add(new RitualComponent(3, 0, 0, 2));
boundSoulRitual.add(new RitualComponent(-3, 0, 0, 2));
boundSoulRitual.add(new RitualComponent(0, 0, 3, 2));
@ -187,5 +181,5 @@ public class RitualEffectSoulBound extends RitualEffect
boundSoulRitual.add(new RitualComponent(-3, 1, 3, 0));
boundSoulRitual.add(new RitualComponent(-3, 1, -3, 0));
return boundSoulRitual;
}
}
}

View file

@ -1,23 +1,17 @@
package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectSpawnWard extends RitualEffect
{
@Override
@ -31,57 +25,52 @@ public class RitualEffectSpawnWard extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
// if (world.getWorldTime() % 20 != 0)
// {
// return;
// }
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if(AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension));
if(list != null)
{
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
{
boolean hasFoundAndRemoved = false;
for(CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if(xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
}
}else
{
list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
}else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if (AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension));
if (list != null)
{
if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange)))
{
boolean hasFoundAndRemoved = false;
for (CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if (xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
}
} else
{
list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
} else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
@ -94,26 +83,26 @@ public class RitualEffectSpawnWard extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> wardRitualRitual = new ArrayList();
for(int i=2; i<=4; i++)
{
if(i <= 3)
{
wardRitualRitual.add(new RitualComponent(0, 0, i, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(0, 0, -i, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(i, 0, 0, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(-i, 0, 0, RitualComponent.AIR));
}
wardRitualRitual.add(new RitualComponent(i, 0, i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(i, 0, -i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(-i, 0, -i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(-i, 0, i, RitualComponent.FIRE));
}
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> wardRitualRitual = new ArrayList();
for (int i = 2; i <= 4; i++)
{
if (i <= 3)
{
wardRitualRitual.add(new RitualComponent(0, 0, i, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(0, 0, -i, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(i, 0, 0, RitualComponent.AIR));
wardRitualRitual.add(new RitualComponent(-i, 0, 0, RitualComponent.AIR));
}
wardRitualRitual.add(new RitualComponent(i, 0, i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(i, 0, -i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(-i, 0, -i, RitualComponent.FIRE));
wardRitualRitual.add(new RitualComponent(-i, 0, i, RitualComponent.FIRE));
}
wardRitualRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK));
wardRitualRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK));
wardRitualRitual.add(new RitualComponent(5, 0, 0, RitualComponent.DUSK));
@ -127,7 +116,7 @@ public class RitualEffectSpawnWard extends RitualEffect
wardRitualRitual.add(new RitualComponent(5, 0, -6, RitualComponent.WATER));
wardRitualRitual.add(new RitualComponent(-6, 0, -5, RitualComponent.WATER));
wardRitualRitual.add(new RitualComponent(-5, 0, -6, RitualComponent.WATER));
return wardRitualRitual;
}
}
}

View file

@ -1,24 +1,22 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectSummonMeteor extends RitualEffect
{
@ -64,35 +62,35 @@ public class RitualEffectSummonMeteor extends RitualEffect
int meteorID = MeteorRegistry.getParadigmIDForItem(entityItem.getEntityItem());
EntityMeteor meteor = new EntityMeteor(world, x + 0.5f, 257, z + 0.5f, meteorID);
meteor.motionY = -1.0f;
if(this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, 1000, true))
if (this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, 1000, true))
{
meteor.hasTerrae = true;
meteor.hasTerrae = true;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, 1000, true))
if (this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, 1000, true))
{
meteor.hasOrbisTerrae = true;
meteor.hasOrbisTerrae = true;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, 1000, true))
if (this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, 1000, true))
{
meteor.hasCrystallos = true;
meteor.hasCrystallos = true;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, 1000, true))
if (this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, 1000, true))
{
meteor.hasIncendium = true;
meteor.hasIncendium = true;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, 1000, true))
if (this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, 1000, true))
{
meteor.hasTennebrae = true;
meteor.hasTennebrae = true;
}
entityItem.setDead();
world.spawnEntityInWorld(meteor);
ritualStone.setActive(false);
break;
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
@ -104,9 +102,9 @@ public class RitualEffectSummonMeteor extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> meteorRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> meteorRitual = new ArrayList();
meteorRitual.add(new RitualComponent(2, 0, 0, RitualComponent.FIRE));
meteorRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.FIRE));
meteorRitual.add(new RitualComponent(0, 0, 2, RitualComponent.FIRE));
@ -210,5 +208,5 @@ public class RitualEffectSummonMeteor extends RitualEffect
meteorRitual.add(new RitualComponent(-3, 4, -2, RitualComponent.FIRE));
meteorRitual.add(new RitualComponent(-3, 4, -3, RitualComponent.FIRE));
return meteorRitual;
}
}
}

View file

@ -1,30 +1,27 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectSupression extends RitualEffect
{
public static final int aquasalusDrain = 15;
public static final int aetherDrain = 15;
public static final int aquasalusDrain = 15;
public static final int aetherDrain = 15;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -35,27 +32,27 @@ public class RitualEffectSupression extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
Block blockish = world.getBlock(x, y-1, z);
Block blockish = world.getBlock(x, y - 1, z);
boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false);
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
int costMod = this.getCostModifier(blockish);
int radius = this.getRadiusForReagents(hasAether, hasAquasalus);
int masterRadius = radius;
int yIndex = (int)(world.getWorldTime() % (2*radius + 1))-radius;
int yIndex = (int) (world.getWorldTime() % (2 * radius + 1)) - radius;
boolean expansion = false;
if(ritualStone.getVar1()<(radius+1))
if (ritualStone.getVar1() < (radius + 1))
{
expansion = true;
radius = ritualStone.getVar1();
ritualStone.setVar1(ritualStone.getVar1() + 1);
expansion = true;
radius = ritualStone.getVar1();
ritualStone.setVar1(ritualStone.getVar1() + 1);
}
if (currentEssence < this.getCostPerRefresh()*costMod)
if (currentEssence < this.getCostPerRefresh() * costMod)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
@ -71,46 +68,45 @@ public class RitualEffectSupression extends RitualEffect
{
for (int j = (expansion ? -radius : yIndex); j <= (expansion ? radius : yIndex); j++)
{
for(int k = -radius; k <= radius; k++)
for (int k = -radius; k <= radius; k++)
{
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
{
continue;
}
Block block = world.getBlock(x+i, y+j, z+k);
if(SpellHelper.isBlockFluid(block))
{
TESpectralContainer.createSpectralBlockAtLocation(world, x+i, y+j, z+k, 3*masterRadius);
}
else
{
TileEntity tile = world.getTileEntity(x+i, y+j, z+k);
if(tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).resetDuration(3*masterRadius);
}
}
Block block = world.getBlock(x + i, y + j, z + k);
if (SpellHelper.isBlockFluid(block))
{
TESpectralContainer.createSpectralBlockAtLocation(world, x + i, y + j, z + k, 3 * masterRadius);
} else
{
TileEntity tile = world.getTileEntity(x + i, y + j, z + k);
if (tile instanceof TESpectralContainer)
{
((TESpectralContainer) tile).resetDuration(3 * masterRadius);
}
}
}
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*costMod);
if(world.getWorldTime() % 100 == 0)
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * costMod);
if (world.getWorldTime() % 100 == 0)
{
if(hasAquasalus)
if (hasAquasalus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
if(hasAether)
if (hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
}
}
}
}
@ -120,70 +116,50 @@ public class RitualEffectSupression extends RitualEffect
return 2;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> supressionRitual = new ArrayList();
supressionRitual.add(new RitualComponent(2,0,2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(2,0,-2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2,0,2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2,0,-2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2,0,-1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-1,0,-2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-2,0,1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(1,0,-2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(2,0,1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(1,0,2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(2,0,-1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-1,0,2, RitualComponent.AIR));
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> supressionRitual = new ArrayList();
supressionRitual.add(new RitualComponent(2, 0, 2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(2, 0, -2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2, 0, 2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2, 0, -2, RitualComponent.WATER));
supressionRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(1, 0, -2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(1, 0, 2, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
supressionRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.AIR));
return supressionRitual;
}
public int getCostModifier(Block block)
{
// if(block == null)
// {
// return 1;
// }
//
// if(block == Blocks.diamond_block)
// {
// return 20;
// }
//
// if(block == Blocks.gold_block)
// {
// return 10;
// }
//
// if(block == Blocks.iron_block)
// {
// return 5;
// }
return 1;
}
public int getRadiusForReagents(boolean hasAether, boolean hasAquasalus)
{
if(hasAether)
{
if(hasAquasalus)
{
return 30;
}else
{
return 20;
}
}else
{
if(hasAquasalus)
{
return 15;
}else
{
return 10;
}
}
}
}
public int getCostModifier(Block block)
{
return 1;
}
public int getRadiusForReagents(boolean hasAether, boolean hasAquasalus)
{
if (hasAether)
{
if (hasAquasalus)
{
return 30;
} else
{
return 20;
}
} else
{
if (hasAquasalus)
{
return 15;
} else
{
return 10;
}
}
}
}

View file

@ -1,16 +1,5 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
@ -18,17 +7,26 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class RitualEffectUnbinding extends RitualEffect
{
public static final int sanctusDrain = 1000;
public static final int sanctusDrain = 1000;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -50,38 +48,35 @@ public class RitualEffectUnbinding extends RitualEffect
List list = world.getEntitiesWithinAABB(EntityItem.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityItem item;
boolean drain = false;
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)
{
continue;
}
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
if(hasSanctus)
if (hasSanctus)
{
if(itemStack.getItem() instanceof IBindable && !EnergyItems.getOwnerName(itemStack).equals(""))
{
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z - 5));
if (itemStack.getItem() instanceof IBindable && !EnergyItems.getOwnerName(itemStack).equals(""))
{
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z - 5));
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z + 5));
world.addWeatherEffect(new EntityLightningBolt(world, x - 5, y + 1, z));
world.addWeatherEffect(new EntityLightningBolt(world, x + 5, y + 1, z));
EnergyItems.setItemOwner(itemStack, "");
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
drain = true;
ritualStone.setActive(false);
break;
}
EnergyItems.setItemOwner(itemStack, "");
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
drain = true;
ritualStone.setActive(false);
break;
}
}
if (itemStack.getItem() == ModItems.boundHelmet)
@ -157,16 +152,15 @@ public class RitualEffectUnbinding extends RitualEffect
break;
}
}
if(drain)
if (drain)
{
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
if (world.rand.nextInt(10) == 0)
{
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z);
@ -176,14 +170,13 @@ public class RitualEffectUnbinding extends RitualEffect
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 0;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> unbindingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> unbindingRitual = new ArrayList();
unbindingRitual.add(new RitualComponent(-2, 0, 0, 4));
unbindingRitual.add(new RitualComponent(2, 0, 0, 4));
unbindingRitual.add(new RitualComponent(0, 0, 2, 4));
@ -217,5 +210,5 @@ public class RitualEffectUnbinding extends RitualEffect
unbindingRitual.add(new RitualComponent(0, 0, 5, 2));
unbindingRitual.add(new RitualComponent(0, 0, -5, 2));
return unbindingRitual;
}
}
}

View file

@ -1,23 +1,17 @@
package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectVeilOfEvil extends RitualEffect
{
@Override
@ -31,57 +25,52 @@ public class RitualEffectVeilOfEvil extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
// if (world.getWorldTime() % 20 != 0)
// {
// return;
// }
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if(AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.forceSpawnMap.get(new Integer(dimension));
if(list != null)
{
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
{
boolean hasFoundAndRemoved = false;
for(CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if(xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
}
}else
{
list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
}else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if (AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.forceSpawnMap.get(new Integer(dimension));
if (list != null)
{
if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange)))
{
boolean hasFoundAndRemoved = false;
for (CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if (xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
}
} else
{
list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
} else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x, y, z, horizRange, vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
@ -94,10 +83,10 @@ public class RitualEffectVeilOfEvil extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> veilRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> veilRitual = new ArrayList();
veilRitual.add(new RitualComponent(1, 0, 2, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(2, 0, 1, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(1, 0, -2, RitualComponent.DUSK));
@ -106,30 +95,30 @@ public class RitualEffectVeilOfEvil extends RitualEffect
veilRitual.add(new RitualComponent(2, 0, -1, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(3, 0, 3, RitualComponent.FIRE));
veilRitual.add(new RitualComponent(-3, 0, 3, RitualComponent.FIRE));
veilRitual.add(new RitualComponent(3, 0, -3, RitualComponent.FIRE));
veilRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.FIRE));
for(int i=0; i<=1; i++)
{
veilRitual.add(new RitualComponent((4+i), i, 0, RitualComponent.DUSK));
veilRitual.add(new RitualComponent((4+i), i, -1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent((4+i), i, 1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-(4+i), i, 0, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(-(4+i), i, -1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-(4+i), i, 1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(0, i, (4+i), RitualComponent.DUSK));
veilRitual.add(new RitualComponent(1, i, (4+i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-1, i, (4+i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(0, i, -(4+i), RitualComponent.DUSK));
veilRitual.add(new RitualComponent(1, i, -(4+i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-1, i, -(4+i), RitualComponent.BLANK));
for (int i = 0; i <= 1; i++)
{
veilRitual.add(new RitualComponent((4 + i), i, 0, RitualComponent.DUSK));
veilRitual.add(new RitualComponent((4 + i), i, -1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent((4 + i), i, 1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-(4 + i), i, 0, RitualComponent.DUSK));
veilRitual.add(new RitualComponent(-(4 + i), i, -1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-(4 + i), i, 1, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(0, i, (4 + i), RitualComponent.DUSK));
veilRitual.add(new RitualComponent(1, i, (4 + i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-1, i, (4 + i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(0, i, -(4 + i), RitualComponent.DUSK));
veilRitual.add(new RitualComponent(1, i, -(4 + i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-1, i, -(4 + i), RitualComponent.BLANK));
veilRitual.add(new RitualComponent(4, i, 5, RitualComponent.EARTH));
veilRitual.add(new RitualComponent(5, i, 4, RitualComponent.EARTH));
veilRitual.add(new RitualComponent(4, i, -5, RitualComponent.EARTH));
@ -139,12 +128,12 @@ public class RitualEffectVeilOfEvil extends RitualEffect
veilRitual.add(new RitualComponent(-4, i, -5, RitualComponent.EARTH));
veilRitual.add(new RitualComponent(-5, i, -4, RitualComponent.EARTH));
}
veilRitual.add(new RitualComponent(5, 1, 5, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-5, 1, 5, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(5, 1, -5, RitualComponent.BLANK));
veilRitual.add(new RitualComponent(-5, 1, -5, RitualComponent.BLANK));
return veilRitual;
}
}
}

View file

@ -1,121 +1,118 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectWater extends RitualEffect
{
public static final int aquasalusDrain = 5;
public static final int offensaDrain = 20;
public static final int sanctusDrain = 5;
public static final int reductusDrain = 2;
public static final int crystallosDrain = 10;
public static final int aquasalusDrain = 5;
public static final int offensaDrain = 20;
public static final int sanctusDrain = 5;
public static final int reductusDrain = 2;
public static final int crystallosDrain = 10;
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false);
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
if(hasAquasalus)
if (hasAquasalus)
{
int hydrationRange = 4;
int vertRange = 3;
for(int i=-hydrationRange; i<=hydrationRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-hydrationRange; k<=hydrationRange; k++)
{
if(SpellHelper.hydrateSoil(world, x+i, y+j, z+k))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
int hydrationRange = 4;
int vertRange = 3;
for (int i = -hydrationRange; i <= hydrationRange; i++)
{
for (int j = -vertRange; j <= vertRange; j++)
{
for (int k = -hydrationRange; k <= hydrationRange; k++)
{
if (SpellHelper.hydrateSoil(world, x + i, y + j, z + k))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
}
if(hasOffensa)
if (hasOffensa)
{
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 10;
List<Entity> list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
for(Entity entity : list)
{
if(entity instanceof EntityLivingBase)
{
EntityLivingBase livingEntity = (EntityLivingBase) entity;
if(livingEntity == SpellHelper.getPlayerForUsername(owner))
{
continue;
}
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if(livingEntity instanceof EntityPlayer)
{
if(drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
}
}
}
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 10;
List<Entity> list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
for (Entity entity : list)
{
if (entity instanceof EntityLivingBase)
{
EntityLivingBase livingEntity = (EntityLivingBase) entity;
if (livingEntity == SpellHelper.getPlayerForUsername(owner))
{
continue;
}
if (hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if (livingEntity instanceof EntityPlayer)
{
if (drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
}
}
}
}
Block block = world.getBlock(x, y + 1, z);
if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer))
{
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (int i = 0; i < 10; i++)
@ -126,61 +123,61 @@ public class RitualEffectWater extends RitualEffect
world.setBlock(x, y + 1, z, Blocks.water, 0, 3);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}else
} else
{
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
if(!hasSanctus)
{
return;
}
TileEntity tile = world.getTileEntity(x, y + 1, z);
if(tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false);
if(amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
if (!hasSanctus)
{
return;
}
TileEntity tile = world.getTileEntity(x, y + 1, z);
if (tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false);
if (amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
}
if(hasCrystallos)
if (hasCrystallos)
{
int range = 2;
for(int i=-range; i<=range; i++)
{
for(int j=-range; j<=range; j++)
{
for(int k=-range; k<=range; k++)
{
hasCrystallos = hasCrystallos && this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
if(hasCrystallos)
{
boolean success = false;
if(!world.isAirBlock(x+i, y+j, z+k) && SpellHelper.freezeWaterBlock(world, x+i, y+j, z+k))
{
success = true;
}else
{
if(world.rand.nextInt(100) == 0 && world.isSideSolid(x+i, y+j-1, z+k, ForgeDirection.UP))
{
success = true;
}
}
if(success)
{
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
}
}
}
}
int range = 2;
for (int i = -range; i <= range; i++)
{
for (int j = -range; j <= range; j++)
{
for (int k = -range; k <= range; k++)
{
hasCrystallos = hasCrystallos && this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
if (hasCrystallos)
{
boolean success = false;
if (!world.isAirBlock(x + i, y + j, z + k) && SpellHelper.freezeWaterBlock(world, x + i, y + j, z + k))
{
success = true;
} else
{
if (world.rand.nextInt(100) == 0 && world.isSideSolid(x + i, y + j - 1, z + k, ForgeDirection.UP))
{
success = true;
}
}
if (success)
{
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
}
}
}
}
}
}
@ -190,13 +187,13 @@ public class RitualEffectWater extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> waterRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> waterRitual = new ArrayList();
waterRitual.add(new RitualComponent(-1, 0, 1, 1));
waterRitual.add(new RitualComponent(-1, 0, -1, 1));
waterRitual.add(new RitualComponent(1, 0, -1, 1));
waterRitual.add(new RitualComponent(1, 0, 1, 1));
return waterRitual;
}
}
}

View file

@ -1,25 +1,19 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualEffectWellOfSuffering extends RitualEffect
{
@ -30,7 +24,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
@ -77,14 +71,14 @@ public class RitualEffectWellOfSuffering extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for(EntityLivingBase livingEntity : list)
for (EntityLivingBase livingEntity : list)
{
if (livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass()))
{
continue;
}
if(livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1))
if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1))
{
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, true);
@ -102,9 +96,9 @@ public class RitualEffectWellOfSuffering extends RitualEffect
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> wellOfSufferingRitual = new ArrayList();
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> wellOfSufferingRitual = new ArrayList();
wellOfSufferingRitual.add(new RitualComponent(1, 0, 1, RitualComponent.FIRE));
wellOfSufferingRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.FIRE));
wellOfSufferingRitual.add(new RitualComponent(1, 0, -1, RitualComponent.FIRE));
@ -142,5 +136,5 @@ public class RitualEffectWellOfSuffering extends RitualEffect
wellOfSufferingRitual.add(new RitualComponent(-4, 1, 0, RitualComponent.AIR));
wellOfSufferingRitual.add(new RitualComponent(0, 1, -4, RitualComponent.AIR));
return wellOfSufferingRitual;
}
}
}