LOTS of alchemy changes...

This commit is contained in:
WayofTime 2014-08-25 07:58:39 -04:00
parent 64ccc50698
commit 2b749000b6
99 changed files with 7488 additions and 659 deletions

View file

@ -1,24 +1,32 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
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.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 cpw.mods.fml.relauncher.ReflectionHelper;
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;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -40,51 +48,58 @@ public class RitualEffectContainment extends RitualEffect
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int d0 = 5;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, d0, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase livingEntity;
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x+0.5, y+0.5, z+0.5, d0, d0);
boolean flag = false;
while (iterator.hasNext())
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)
{
livingEntity = (EntityLivingBase) iterator.next();
if(!(entity instanceof EntityLivingBase))
{
continue;
}
EntityLivingBase livingEntity = (EntityLivingBase)entity;
if (livingEntity instanceof EntityPlayer)
{
continue;
}
//if (!(livingEntity.getEntityName().equals(owner)))
double xDif = livingEntity.posX - (x + 0.5);
double yDif = livingEntity.posY - (y + 3);
double zDif = livingEntity.posZ - (z + 0.5);
livingEntity.motionX = -0.05 * xDif;
livingEntity.motionY = -0.05 * yDif;
livingEntity.motionZ = -0.05 * zDif;
flag = true;
livingEntity.fallDistance = 0;
if(hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false))
{
double xDif = livingEntity.posX - (x + 0.5);
double yDif = livingEntity.posY - (y + 3);
double zDif = livingEntity.posZ - (z + 0.5);
livingEntity.motionX = -0.05 * xDif;
livingEntity.motionY = -0.05 * yDif;
livingEntity.motionZ = -0.05 * zDif;
flag = true;
//livingEntity.setVelocity(-0.05 * xDif, -0.05 * yDif, -0.05 * zDif);
if (world.rand.nextInt(10) == 0)
{
//PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(livingEntity.posX, livingEntity.posY, livingEntity.posZ, (short) 1));
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z);
}
livingEntity.fallDistance = 0;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
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(entity instanceof EntityCreeper)
{
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED);
((EntityCreeper)entity).setAttackTarget(null);
this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true);
}
}
}