Adding build files and a few needed tweaks

This commit is contained in:
WayofTime 2014-10-03 10:08:21 -04:00
parent e4ef150dbd
commit 297567a417
25 changed files with 7164 additions and 216 deletions

View file

@ -14,6 +14,7 @@ import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
@ -293,7 +294,7 @@ public class AlchemicalWizardryEventHooks
int posX = (int) Math.round(entity.posX - 0.5f);
int posY = (int) Math.round(entity.posY);
int posZ = (int) Math.round(entity.posZ - 0.5f);
int d0 = i;
int d0 = (int)((i+1)*2.5);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
Iterator iterator = list.iterator();
@ -312,29 +313,38 @@ public class AlchemicalWizardryEventHooks
{
continue;
}
Entity throwingEntity = null;
if (projectile instanceof EntityArrow)
{
if (((EntityArrow) projectile).shootingEntity == null)
{
} else if (!(((EntityArrow) projectile).shootingEntity == null) && ((EntityArrow) projectile).shootingEntity.equals(entity))
{
break;
}
throwingEntity = ((EntityArrow) projectile).shootingEntity;
} else if (projectile instanceof EnergyBlastProjectile)
{
if (!(((EnergyBlastProjectile) projectile).shootingEntity == null) && ((EnergyBlastProjectile) projectile).shootingEntity.equals(entity))
{
break;
}
throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity;
}else if(projectile instanceof EntityThrowable)
{
throwingEntity = ((EntityThrowable) projectile).getThrower();
}
if(throwingEntity != null && throwingEntity.equals(entity))
{
continue;
}
double delX = projectile.posX - entity.posX;
double delY = projectile.posY - entity.posY;
double delZ = projectile.posZ - entity.posZ;
if(throwingEntity != null)
{
delX = -projectile.posX + throwingEntity.posX;
delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight());
delZ = -projectile.posZ + throwingEntity.posZ;
}
double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ);
//NOTE: It appears that it constantly reverses the direction.
//Any way to do it only once? Or find the shooting entity?
delX /= curVel;
delY /= curVel;
delZ /= curVel;

View file

@ -33,16 +33,8 @@ public class RitualEffectAnimalGrowth extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -87,8 +79,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);

View file

@ -13,30 +13,28 @@ 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;
public class RitualEffectAutoAlchemy extends RitualEffect
{
public static final boolean fillToOne = true;
public static final int potentiaDrain = 2;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -44,16 +42,11 @@ public class RitualEffectAutoAlchemy extends RitualEffect
if (currentEssence < this.getCostPerRefresh()*6)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int flag = 0;
TileEntity topEntity = world.getTileEntity(x, y+1, z);
@ -147,6 +140,15 @@ public class RitualEffectAutoAlchemy extends RitualEffect
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);
@ -264,7 +266,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=(fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
@ -327,7 +329,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
continue;
}
ItemStack alchStack = alchemyEntity.getStackInSlot(i+1);
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=alchStack.getMaxStackSize()))
if(alchStack!=null&&((!areItemStacksEqualWithWildcard(recItem,alchStack))||alchStack.stackSize>=(fillToOne ? 1 : alchStack.getMaxStackSize())))
{
continue;
}
@ -389,8 +391,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
world.markBlockForUpdate(x, y, z-1);
world.markBlockForUpdate(x+1, y, z);
world.markBlockForUpdate(x-1, y, z);
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()*flag);
}
}
}

View file

@ -23,6 +23,7 @@ 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;
@ -32,14 +33,6 @@ public class RitualEffectBiomeChanger extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int cooldown = ritualStone.getCooldown();
World world = ritualStone.getWorld();
@ -58,7 +51,7 @@ public class RitualEffectBiomeChanger extends RitualEffect
return;
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
int range = 10;
@ -304,8 +297,7 @@ public class RitualEffectBiomeChanger extends RitualEffect
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
ritualStone.setActive(false);
}
}

View file

@ -31,16 +31,8 @@ public class RitualEffectContainment extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -105,8 +97,7 @@ public class RitualEffectContainment extends RitualEffect
if (world.getWorldTime() % 2 == 0 && flag)
{
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
}

View file

@ -34,16 +34,8 @@ public class RitualEffectCrushing extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
if (world.getWorldTime() % 10 != 5)
@ -210,10 +202,8 @@ public class RitualEffectCrushing extends RitualEffect
//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);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
return;
}

View file

@ -17,6 +17,7 @@ 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;
@ -27,16 +28,8 @@ public class RitualEffectEllipsoid extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -113,8 +106,7 @@ public class RitualEffectEllipsoid extends RitualEffect
}
}
data.currentEssence = currentEssence - cost;
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, cost);
}
}

View file

@ -22,6 +22,7 @@ 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;
@ -33,16 +34,8 @@ public class RitualEffectEvaporation extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -177,8 +170,7 @@ public class RitualEffectEvaporation extends RitualEffect
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
ritualStone.setActive(false);
}

View file

@ -40,16 +40,8 @@ public class RitualEffectExpulsion extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -113,8 +105,7 @@ public class RitualEffectExpulsion extends RitualEffect
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh());
}
}

View file

@ -11,28 +11,28 @@ 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;
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;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -47,8 +47,12 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
ritualStone.setCooldown(0);
}
int range = 20;
int verticalRange = 30;
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);
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));
int entityCount = 0;
boolean flag = false;
@ -60,23 +64,32 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
if (currentEssence < this.getCostPerRefresh() * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (EntityLivingBase entity : entities)
{
entity.fallDistance = 0;
flag = true;
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
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);
}
}
}
}
@ -138,4 +151,27 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal
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;
}
}
}
}

View file

@ -33,16 +33,8 @@ public class RitualEffectFeatheredKnife extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -136,8 +128,8 @@ public class RitualEffectFeatheredKnife extends RitualEffect
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
}
}

View file

@ -22,21 +22,14 @@ public class RitualEffectFlight extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int reductusDrain = 5;
public static final int reagentCooldown = 5;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -63,14 +56,31 @@ public class RitualEffectFlight extends RitualEffect
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
entityCount = 0;
EntityPlayer ownerEntity = SpellHelper.getPlayerForUsername(owner);
for (EntityPlayer entity : entities)
{
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, 20, 0));
if(hasReductus && entity != ownerEntity)
{
continue;
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, hasAether ? 100 : 20, 0));
entityCount ++;
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
if(entityCount > 0 && world.getWorldTime() % reagentCooldown == 0)
{
if(hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
}
}

View file

@ -5,34 +5,32 @@ 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;
public class RitualEffectInterdiction extends RitualEffect
{
public static final int aetherDrain = 1;
public static final int magicalesDrain = 1;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -40,51 +38,90 @@ public class RitualEffectInterdiction 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);
axisalignedbb.maxY = Math.min((double) world.getHeight(), (double) (y + 1 + d0));
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase entityplayer;
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;
while (iterator.hasNext())
for(EntityLivingBase entityLiving : list)
{
entityplayer = (EntityLivingBase) iterator.next();
if (!(entityplayer instanceof EntityPlayer && (SpellHelper.getUsername((EntityPlayer)entityplayer).equals(owner))))
if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer)entityLiving).equals(owner))))
{
double xDif = entityplayer.posX - x;
double yDif = entityplayer.posY - (y + 1);
double zDif = entityplayer.posZ - z;
entityplayer.motionX = 0.1 * xDif;
entityplayer.motionY = 0.1 * yDif;
entityplayer.motionZ = 0.1 * zDif;
entityplayer.fallDistance = 0;
if (!(entityplayer instanceof EntityPlayer))
double xDif = entityLiving.posX - x;
double yDif = entityLiving.posY - (y + 1);
double zDif = entityLiving.posZ - z;
entityLiving.motionX = 0.1 * xDif;
entityLiving.motionY = 0.1 * yDif;
entityLiving.motionZ = 0.1 * zDif;
if(hasOffensa && entityLiving instanceof EntityPlayer)
{
flag = true;
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityLiving, 0.1 * xDif, 0.1 * yDif, 0.1 * zDif);
playerFlag = true;
}
entityLiving.fallDistance = 0;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
flag = true;
//entityLiving.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
}
if(playerFlag)
{
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
}
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
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;
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 (world.getWorldTime() % 2 == 0 && flag)
{
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh());
}
}
}

View file

@ -38,16 +38,8 @@ public class RitualEffectWater extends RitualEffect
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
@ -132,8 +124,7 @@ public class RitualEffectWater extends RitualEffect
}
world.setBlock(x, y + 1, z, Blocks.water, 0, 3);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}else
{
@ -152,8 +143,7 @@ public class RitualEffectWater extends RitualEffect
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
}

View file

@ -32,6 +32,8 @@ public class TEWritingTable extends TileEntity implements IInventory
private int progressNeeded = 100;
private int amountUsed;
private int accelerationTime;
public static final int sizeInv = 7;
public TEWritingTable()
@ -140,6 +142,8 @@ public class TEWritingTable extends TileEntity implements IInventory
progress = tagCompound.getInteger("progress");
amountUsed = tagCompound.getInteger("amountUsed");
accelerationTime = tagCompound.getInteger("accelerationTime");
}
@Override
@ -164,6 +168,8 @@ public class TEWritingTable extends TileEntity implements IInventory
tagCompound.setTag("Inventory", itemList);
tagCompound.setInteger("progress", progress);
tagCompound.setInteger("amountUsed", amountUsed);
tagCompound.setInteger("accelerationTime", accelerationTime);
}
@Override
@ -455,6 +461,11 @@ public class TEWritingTable extends TileEntity implements IInventory
// }
// }
if(accelerationTime > 0)
{
accelerationTime--;
}
if (containsPotionFlask() && containsRegisteredPotionIngredient())
{
if (containsCatalyst())
@ -752,10 +763,12 @@ public class TEWritingTable extends TileEntity implements IInventory
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
int acceleration = this.getSpeedIncrease();
if (getStackInSlot(6) == null)
{
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed))
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed*acceleration))
{
return;
}
@ -765,7 +778,7 @@ public class TEWritingTable extends TileEntity implements IInventory
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
progress++;
progress+=acceleration;
if (progress >= progressNeeded)
{
@ -793,12 +806,12 @@ public class TEWritingTable extends TileEntity implements IInventory
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed))
if (!EnergyItems.syphonWhileInContainer(getStackInSlot(0), amountUsed*acceleration))
{
return;
}
progress++;
progress+=acceleration;
if (progress >= progressNeeded)
{
@ -885,4 +898,19 @@ public class TEWritingTable extends TileEntity implements IInventory
return null;
}
public int getSpeedIncrease()
{
return accelerationTime > 0 ? 5 : 1;
}
public boolean isWorking()
{
return this.progress > 0;
}
public void setAccelerationTime(int accelerationTime)
{
this.accelerationTime = accelerationTime;
}
}