This commit is contained in:
WayofTime 2014-01-17 14:18:41 -05:00
parent 8601e9faff
commit 8f4b0bdc47

View file

@ -173,559 +173,6 @@ public class TEMasterStone extends TileEntity
public void performRitual(World world, int x, int y, int z, int ritualID)
{
Rituals.performEffect(this, ritualID);
/*
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;
switch (ritualID)
{
case 1:
if (world.isAirBlock(x, y + 1, z))
{
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
for (int i = 0; i < 10; i++)
{
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short)3));
}
world.setBlock(x, y + 1, z, Block.waterMoving.blockID, 0, 3);
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
case 2:
if (world.isAirBlock(x, y + 1, z))
{
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
for (int i = 0; i < 10; i++)
{
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short)3));
}
world.setBlock(x, y + 1, z, Block.lavaMoving.blockID, 0, 3);
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
case 3:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}else
{
if (world.getWorldTime() % 20 != 0)
{
return;
}
boolean flag = false;
for(int i=-1; i<=1; i++)
{
for(int j=-1;j<=1;j++)
{
int id = world.getBlockId(x+i, y + 2, z+j);
Block block = Block.blocksList[id];
if (block instanceof IPlantable)
{
{
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(xCoord+i, yCoord + 2, zCoord+j, (short)3));
block.updateTick(world, x+i, y + 2, z+j, world.rand);
flag = true;
}
}
}
}
if(flag)
{
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
case 4:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
int d0 = 0;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = Math.min((double)this.worldObj.getHeight(), (double)(this.yCoord + 1+d0));
List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase entityplayer;
boolean flag = false;
while (iterator.hasNext())
{
entityplayer = (EntityLivingBase)iterator.next();
if (!(entityplayer.getEntityName().equals(owner)))
{
double xDif = entityplayer.posX - xCoord;
double yDif = entityplayer.posY - (yCoord + 1);
double zDif = entityplayer.posZ - zCoord;
entityplayer.motionX=0.1*xDif;
entityplayer.motionY=0.1*yDif;
entityplayer.motionZ=0.1*zDif;
entityplayer.fallDistance = 0;
if(!(entityplayer instanceof EntityPlayer))
{
flag=true;
}
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
}
if (worldObj.getWorldTime() % 2 == 0 && flag)
{
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
case 5:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
int d0 = 5;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand(d0, d0, d0);
List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase livingEntity;
boolean flag = false;
while (iterator.hasNext())
{
livingEntity = (EntityLivingBase)iterator.next();
if (livingEntity instanceof EntityPlayer)
{
continue;
}
if (!(livingEntity.getEntityName().equals(owner)))
{
double xDif = livingEntity.posX - (xCoord + 0.5);
double yDif = livingEntity.posY - (yCoord + 3);
double zDif = livingEntity.posZ - (zCoord + 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));
}
livingEntity.fallDistance = 0;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
}
if (worldObj.getWorldTime() % 2 == 0 && flag)
{
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
case 6:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
if (var1 == 0)
{
int d0 = 0;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord + 1, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 2), (double)(this.zCoord + 1)).expand(d0, d0, d0);
List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityItem item;
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;
}
if (itemStack.itemID == AlchemicalWizardry.apprenticeBloodOrb.itemID)
{
var1 = AlchemicalWizardry.energyBlaster.itemID;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
cooldown--;
item.setDead();
return;
}
else if (itemStack.itemID == Item.swordDiamond.itemID)
{
var1 = AlchemicalWizardry.energySword.itemID;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
cooldown--;
item.setDead();
return;
}
else if (itemStack.itemID == Item.pickaxeDiamond.itemID)
{
var1 = AlchemicalWizardry.boundPickaxe.itemID;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
cooldown--;
item.setDead();
return;
}
else if (itemStack.itemID == Item.axeDiamond.itemID)
{
var1 = AlchemicalWizardry.boundAxe.itemID;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
cooldown--;
item.setDead();
return;
}
else if (itemStack.itemID == Item.shovelDiamond.itemID)
{
var1 = AlchemicalWizardry.boundShovel.itemID;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
cooldown--;
item.setDead();
return;
}
if (world.rand.nextInt(10) == 0)
{
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(item.posX, item.posY, item.posZ, (short)1));
}
}
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
else
{
cooldown--;
if (world.rand.nextInt(20) == 0)
{
int lightningPoint = world.rand.nextInt(8);
switch (lightningPoint)
{
case 0:
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 3, z + 0));
break;
case 1:
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 3, z + 0));
break;
case 2:
world.addWeatherEffect(new EntityLightningBolt(world, x + 0, y + 3, z + 4));
break;
case 3:
world.addWeatherEffect(new EntityLightningBolt(world, x + 0, y + 3, z - 4));
break;
case 4:
world.addWeatherEffect(new EntityLightningBolt(world, x + 3, y + 3, z + 3));
break;
case 5:
world.addWeatherEffect(new EntityLightningBolt(world, x - 3, y + 3, z + 3));
break;
case 6:
world.addWeatherEffect(new EntityLightningBolt(world, x + 3, y + 3, z - 3));
break;
case 7:
world.addWeatherEffect(new EntityLightningBolt(world, x - 3, y + 3, z - 3));
break;
}
}
if (cooldown <= 0)
{
EntityItem newItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, new ItemStack(var1, 1, 0));
worldObj.spawnEntityInWorld(newItem);
isActive = false;
}
}
}
break;
case 7:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
int d0 = 0;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord + 1, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 2), (double)(this.zCoord + 1)).expand(d0, d0, d0);
List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityItem item;
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;
}
if (itemStack.itemID == AlchemicalWizardry.boundHelmet.itemID)
{
var1 = 5;
}
else if (itemStack.itemID == AlchemicalWizardry.boundPlate.itemID)
{
var1 = 8;
}else if (itemStack.itemID == AlchemicalWizardry.boundLeggings.itemID)
{
var1 = 7;
}else if (itemStack.itemID == AlchemicalWizardry.boundBoots.itemID)
{
var1 = 4;
}else if(itemStack.itemID == AlchemicalWizardry.sigilOfHolding.itemID)
{
var1 = -1;
}
if(var1>0)
{
item.setDead();
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));
NBTTagCompound itemTag = itemStack.stackTagCompound;
ItemStack[] inv = ((BoundArmour)itemStack.getItem()).getInternalInventory(itemStack);
if(inv!=null)
{
for(ItemStack internalItem : inv)
{
if(internalItem!=null)
{
EntityItem newItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, internalItem.copy());
worldObj.spawnEntityInWorld(newItem);
}
}
}
EntityItem newItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, new ItemStack(Block.blocksList[AlchemicalWizardry.bloodSocket.blockID],var1));
worldObj.spawnEntityInWorld(newItem);
isActive=false;
break;
}else if(var1 ==-1)
{
item.setDead();
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));
NBTTagCompound itemTag = itemStack.stackTagCompound;
ItemStack[] inv = ((SigilOfHolding)itemStack.getItem()).getInternalInventory(itemStack);
if(inv!=null)
{
for(ItemStack internalItem : inv)
{
if(internalItem!=null)
{
EntityItem newItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, internalItem.copy());
worldObj.spawnEntityInWorld(newItem);
}
}
}
EntityItem newItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, new ItemStack(AlchemicalWizardry.sigilOfHolding.itemID,1,0));
worldObj.spawnEntityInWorld(newItem);
isActive=false;
break;
}
if (world.rand.nextInt(10) == 0)
{
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(item.posX, item.posY, item.posZ, (short)1));
}
}
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
break;
case 8:
if (currentEssence < Rituals.getCostPerRefresh(ritualID))
{
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
else
{
int d0 = 0;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)this.xCoord, (double)this.yCoord+1, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 2), (double)(this.zCoord + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = Math.min((double)this.worldObj.getHeight(), (double)(this.yCoord + 2+d0));
List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase entityplayer;
boolean flag = false;
while (iterator.hasNext())
{
entityplayer = (EntityLivingBase)iterator.next();
if(entityplayer instanceof EntityPlayer)
{
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(entityplayer.motionX, 1, entityplayer.motionZ), (Player)entityplayer);
entityplayer.motionY=1;
entityplayer.fallDistance = 0;
flag=true;
}else
//if (!(entityplayer.getEntityName().equals(owner)))
{
// double xDif = entityplayer.posX - xCoord;
// double yDif = entityplayer.posY - (yCoord + 1);
// double zDif = entityplayer.posZ - zCoord;
//entityplayer.motionX=0.1*xDif;
entityplayer.motionY=1;
//entityplayer.motionZ=0.1*zDif;
entityplayer.fallDistance = 0;
flag=true;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
}
}
if (worldObj.getWorldTime() % 2 == 0 && flag)
{
data.currentEssence = currentEssence - Rituals.getCostPerRefresh(ritualID);
data.markDirty();
}
}
break;
default:
return;
}
*/
}
public String getOwner()