Testing
This commit is contained in:
commit
8601e9faff
498 changed files with 45817 additions and 0 deletions
|
@ -0,0 +1,43 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
public class RitualComponent
|
||||
{
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int stoneType;
|
||||
public static final int BLANK = 0;
|
||||
public static final int WATER = 1;
|
||||
public static final int FIRE = 2;
|
||||
public static final int EARTH = 3;
|
||||
public static final int AIR = 4;
|
||||
public static final int DUSK = 5;
|
||||
|
||||
public RitualComponent(int x, int y, int z, int stoneType)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.stoneType = stoneType;
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public int getStoneType()
|
||||
{
|
||||
return this.stoneType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public abstract class RitualEffect
|
||||
{
|
||||
public abstract void performEffect(TEMasterStone ritualStone);
|
||||
|
||||
public abstract int getCostPerRefresh();
|
||||
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class RitualEffectAnimalGrowth extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.getWorldTime() % 20 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int d0 = 2;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y + 1, (double)z, (double)(x + 1), (double)(y + 3), (double)(z + 1)).expand(d0, 0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityAgeable entity;
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
{
|
||||
entity = (EntityAgeable)iterator1.next();
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entity = (EntityAgeable)iterator2.next();
|
||||
|
||||
if (entity.getGrowingAge() < 0)
|
||||
{
|
||||
entity.addGrowth(5);
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,332 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
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;
|
||||
|
||||
public class RitualEffectBiomeChanger extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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();
|
||||
|
||||
if (cooldown > 0)
|
||||
{
|
||||
ritualStone.setCooldown(cooldown - 1);
|
||||
|
||||
if (ritualStone.worldObj.rand.nextInt(15) == 0)
|
||||
{
|
||||
ritualStone.worldObj.addWeatherEffect(new EntityLightningBolt(ritualStone.worldObj, ritualStone.xCoord - 1 + ritualStone.worldObj.rand.nextInt(3), ritualStone.yCoord + 1, ritualStone.zCoord - 1 + ritualStone.worldObj.rand.nextInt(3)));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
int range = 10;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean[][] boolList = new boolean[range * 2 + 1][range * 2 + 1];
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
boolList[i][j] = false;
|
||||
}
|
||||
}
|
||||
|
||||
boolList[range][range] = true;
|
||||
boolean isReady = false;
|
||||
|
||||
while (!isReady)
|
||||
{
|
||||
isReady = true;
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
if (boolList[i][j])
|
||||
{
|
||||
if (i - 1 >= 0 && !boolList[i - 1][j])
|
||||
{
|
||||
int id = world.getBlockId(x - range + i - 1, y + 1, z - range + j);
|
||||
Block block = Block.blocksList[id];
|
||||
|
||||
if (!AlchemicalWizardry.largeBloodStoneBrick.equals(block) && !AlchemicalWizardry.bloodStoneBrick.equals(block))
|
||||
{
|
||||
boolList[i - 1][j] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j - 1 >= 0 && !boolList[i][j - 1])
|
||||
{
|
||||
int id = world.getBlockId(x - range + i, y + 1, z - range + j - 1);
|
||||
Block block = Block.blocksList[id];
|
||||
|
||||
if (!AlchemicalWizardry.largeBloodStoneBrick.equals(block) && !AlchemicalWizardry.bloodStoneBrick.equals(block))
|
||||
{
|
||||
boolList[i][j - 1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i + 1 <= 2 * range && !boolList[i + 1][j])
|
||||
{
|
||||
int id = world.getBlockId(x - range + i + 1, y + 1, z - range + j);
|
||||
Block block = Block.blocksList[id];
|
||||
|
||||
if (!AlchemicalWizardry.largeBloodStoneBrick.equals(block) && !AlchemicalWizardry.bloodStoneBrick.equals(block))
|
||||
{
|
||||
boolList[i + 1][j] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j + 1 <= 2 * range && !boolList[i][j + 1])
|
||||
{
|
||||
int id = world.getBlockId(x - range + i, y + 1, z - range + j + 1);
|
||||
Block block = Block.blocksList[id];
|
||||
|
||||
if (!AlchemicalWizardry.largeBloodStoneBrick.equals(block) && !AlchemicalWizardry.bloodStoneBrick.equals(block))
|
||||
{
|
||||
boolList[i][j + 1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float temperature = 0.5f;
|
||||
float humidity = 0.5f;
|
||||
float acceptableRange = 0.1f;
|
||||
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
if (i == 0 && j == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isItemConsumed = false;
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x + i, y, z + j);
|
||||
|
||||
if (!(tileEntity instanceof TEPlinth))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TEPlinth tilePlinth = (TEPlinth)tileEntity;
|
||||
ItemStack itemStack = tilePlinth.getStackInSlot(0);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (item instanceof ItemBlock)
|
||||
{
|
||||
if (item.itemID == (Block.sand.blockID))
|
||||
{
|
||||
humidity -= 0.1f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.blockLapis.blockID))
|
||||
{
|
||||
humidity += 0.4f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.sand.blockID))
|
||||
{
|
||||
humidity -= 0.1f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.sandStone.blockID))
|
||||
{
|
||||
humidity -= 0.2f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.netherrack.blockID))
|
||||
{
|
||||
humidity -= 0.4f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.coalBlock.blockID))
|
||||
{
|
||||
temperature += 0.2f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.ice.blockID))
|
||||
{
|
||||
temperature -= 0.4f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.itemID == (Block.blockSnow.blockID))
|
||||
{
|
||||
temperature -= 0.2f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
}
|
||||
else if (item.equals(Item.dyePowder) && itemStack.getItemDamage() == 4)
|
||||
{
|
||||
humidity += 0.1f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.equals(Item.bucketLava))
|
||||
{
|
||||
temperature += 0.4f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.equals(Item.bucketWater))
|
||||
{
|
||||
humidity += 0.2f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.equals(Item.coal))
|
||||
{
|
||||
temperature += 0.1f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
else if (item.equals(Item.snowball))
|
||||
{
|
||||
temperature -= 0.1f;
|
||||
isItemConsumed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isItemConsumed)
|
||||
{
|
||||
tilePlinth.setInventorySlotContents(0, null);
|
||||
world.markBlockForUpdate(x + i, y, z + j);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + i, y + 1, z + j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean wantsSnow = false;
|
||||
boolean wantsRain = true;
|
||||
int biomeID = 1;
|
||||
BiomeGenBase[] biomeList = BiomeGenBase.biomeList;
|
||||
int iteration = 0;
|
||||
|
||||
for (BiomeGenBase biome : biomeList)
|
||||
{
|
||||
if (biome == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float temp = biome.temperature;
|
||||
float rainfall = biome.rainfall;
|
||||
temperature = Math.min(2.0f, Math.max(0.0f, temperature));
|
||||
humidity = Math.min(2.0f, Math.max(0.0f, humidity));
|
||||
|
||||
if (Math.abs(rainfall - humidity) < acceptableRange && Math.abs(temperature - temp) < acceptableRange)
|
||||
{
|
||||
//if(biome.getEnableSnow()==wantsSnow)
|
||||
{
|
||||
biomeID = iteration;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
iteration++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
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);
|
||||
byte[] byteArray = chunk.getBiomeArray();
|
||||
int moduX = (x - range + i) % 16;
|
||||
int moduZ = (z - range + j) % 16;
|
||||
|
||||
if (moduX < 0)
|
||||
{
|
||||
moduX = moduX + 16;
|
||||
}
|
||||
|
||||
if (moduZ < 0)
|
||||
{
|
||||
moduZ = moduZ + 16;
|
||||
}
|
||||
|
||||
byteArray[moduZ * 16 + moduX] = (byte)biomeID;
|
||||
chunk.setBiomeArray(byteArray);
|
||||
//world.setBlock(x-range+i, y+1, z-range+j, Block.blockClay.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class RitualEffectContainment extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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)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;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
livingEntity = (EntityLivingBase)iterator.next();
|
||||
|
||||
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.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 (world.getWorldTime() % 2 == 0 && flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class RitualEffectCrushing extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
|
||||
if (world.getWorldTime() % 40 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
TileEntity tile = world.getBlockTileEntity(x, y + 1, z);
|
||||
IInventory tileEntity;
|
||||
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
tileEntity = (IInventory)tile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tileEntity.getSizeInventory() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
//boolean flag = false;
|
||||
for (int j = -3; j < 0; j++)
|
||||
{
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
for (int k = -1; k <= 1; k++)
|
||||
{
|
||||
int blockID = world.getBlockId(x + i, y + j, z + k);
|
||||
Block block = Block.blocksList[blockID];
|
||||
int meta = world.getBlockMetadata(x + i, y + j, z + k);
|
||||
|
||||
if (block != null)
|
||||
{
|
||||
if ((block.equals(AlchemicalWizardry.ritualStone) || block.equals(AlchemicalWizardry.blockMasterStone)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> itemDropList = block.getBlockDropped(world, x + i, y + j, z + k, meta, 0);
|
||||
|
||||
if (itemDropList != null)
|
||||
{
|
||||
int invSize = tileEntity.getSizeInventory();
|
||||
|
||||
for (ItemStack item : itemDropList)
|
||||
{
|
||||
ItemStack copyStack = item.copyItemStack(item);
|
||||
|
||||
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, copyStack);
|
||||
copyStack.stackSize = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemStack.getItem().equals(copyStack.getItem()))
|
||||
{
|
||||
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(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();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
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;
|
||||
|
||||
public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fall damage in the area of effect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z + 4));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z - 4));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z - 4));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z + 4));
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
int range = 20;
|
||||
int verticalRange = 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;
|
||||
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (EntityLivingBase entity : entities)
|
||||
{
|
||||
entity.fallDistance = 0;
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RitualEffectFeatheredKnife extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 20;
|
||||
public final int amount = 100;
|
||||
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.getWorldTime() % this.timeDelay != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
TEAltar tileAltar = null;
|
||||
boolean testFlag = false;
|
||||
|
||||
for (int i = -5; i <= 5; i++)
|
||||
{
|
||||
for (int j = -5; j <= 5; j++)
|
||||
{
|
||||
for (int k = -10; k <= 10; k++)
|
||||
{
|
||||
if (world.getBlockTileEntity(x + i, y + k, z + j) instanceof TEAltar)
|
||||
{
|
||||
tileAltar = (TEAltar)world.getBlockTileEntity(x + i, y + k, z + j);
|
||||
testFlag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!testFlag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 15;
|
||||
int vertRange = 20;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y, (double)z, (double)(x + 1), (double)(y + 1), (double)(z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityPlayer entity;
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
{
|
||||
entity = (EntityPlayer)iterator1.next();
|
||||
|
||||
if (entity.getClass().equals(EntityPlayerMP.class) || entity.getClass().equals(EntityPlayer.class))
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entity = (EntityPlayer)iterator2.next();
|
||||
|
||||
//entity = (EntityPlayer)iterator1.next();
|
||||
if (entity.getClass().equals(EntityPlayerMP.class) || entity.getClass().equals(EntityPlayer.class))
|
||||
{
|
||||
if (entity.getHealth() > 6.2f)
|
||||
{
|
||||
entity.setHealth(entity.getHealth() - 1);
|
||||
entityCount++;
|
||||
tileAltar.sacrificialDaggerCall(this.amount, false);
|
||||
}
|
||||
}
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 20;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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;
|
||||
|
||||
public class RitualEffectFlight extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
//TODO Cool stuffs
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
int range = 20;
|
||||
int verticalRange = 30;
|
||||
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range);
|
||||
axis.maxY = 256;
|
||||
axis.minY = 0;
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
|
||||
int entityCount = 0;
|
||||
|
||||
for (EntityPlayer entity : entities)
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (EntityPlayer entity : entities)
|
||||
{
|
||||
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, 20, 0));
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
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 net.minecraftforge.common.IPlantable;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class RitualEffectGrowth extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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(x + i, y + 2, z + j, (short)3));
|
||||
block.updateTick(world, x + i, y + 2, z + j, world.rand);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class RitualEffectHealing extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 50;
|
||||
//public final int amount = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.getWorldTime() % this.timeDelay != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 10;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y, (double)z, (double)(x + 1), (double)(y + 1), (double)(z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityLivingBase entity;
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
{
|
||||
entity = (EntityLivingBase)iterator1.next();
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
entityCount += 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entity = (EntityLivingBase)iterator2.next();
|
||||
|
||||
if (entity.getHealth() + 0.1f < entity.getMaxHealth())
|
||||
{
|
||||
entity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, 0));
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
|
||||
//entity.attackEntityFrom(DamageSource.outOfWorld, 1);
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
entityCount += 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
//tileAltar.sacrificialDaggerCall(this.amount, true);
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 20;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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;
|
||||
|
||||
public class RitualEffectInterdiction extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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)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;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
entityplayer = (EntityLivingBase)iterator.next();
|
||||
|
||||
if (!(entityplayer.getEntityName().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))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
}
|
||||
|
||||
if (world.getWorldTime() % 2 == 0 && flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class RitualEffectJumping extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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)x, (double)y + 1, (double)z, (double)(x + 1), (double)(y + 2), (double)(z + 1)).expand(d0, d0, d0);
|
||||
List list = world.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.5, entityplayer.motionZ), (Player)entityplayer);
|
||||
entityplayer.motionY = 1.5;
|
||||
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.5;
|
||||
//entityplayer.motionZ=0.1*zDif;
|
||||
entityplayer.fallDistance = 0;
|
||||
flag = true;
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class RitualEffectLava extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.isAirBlock(x, y + 1, z))
|
||||
{
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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(x, y, z, (short)3));
|
||||
}
|
||||
|
||||
world.setBlock(x, y + 1, z, Block.lavaMoving.blockID, 0, 3);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 500;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class RitualEffectLeap extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
int direction = ritualStone.getDirection();
|
||||
int d0 = 2;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y - 1, (double)z, (double)(x + 1), (double)(y + 2), (double)(z + 1)).expand(d0, 0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityLivingBase entityplayer;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
entityplayer = (EntityLivingBase)iterator.next();
|
||||
|
||||
if (entityplayer instanceof EntityPlayer)
|
||||
{
|
||||
entityplayer.motionY = 1.2;
|
||||
entityplayer.fallDistance = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(0, 1.2, -3.0), (Player)entityplayer);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(3.0, 1.2, 0), (Player)entityplayer);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(0, 1.2, 3.0), (Player)entityplayer);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(-3.0, 1.2, 0), (Player)entityplayer);
|
||||
break;
|
||||
}
|
||||
|
||||
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.2;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
entityplayer.motionX = 0.0;
|
||||
entityplayer.motionZ = -3.0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
entityplayer.motionX = 3.0;
|
||||
entityplayer.motionZ = 0.0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
entityplayer.motionX = 0.0;
|
||||
entityplayer.motionZ = -3.0;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
entityplayer.motionX = -3.0;
|
||||
entityplayer.motionZ = 0.0;
|
||||
break;
|
||||
}
|
||||
|
||||
//entityplayer.motionZ=0.1*zDif;
|
||||
entityplayer.fallDistance = 0;
|
||||
flag = true;
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
||||
public class RitualEffectMagnetic extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.getWorldTime() % 40 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
int xRep = 0;
|
||||
int yRep = 0;
|
||||
int zRep = 0;
|
||||
boolean replace = false;
|
||||
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
for (int k = -1; k <= 1; k++)
|
||||
{
|
||||
if ((!replace) && world.isAirBlock(x + i, y + j, z + k))
|
||||
{
|
||||
xRep = x + i;
|
||||
yRep = y + j;
|
||||
zRep = z + k;
|
||||
replace = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (replace)
|
||||
{
|
||||
//boolean hasReplaced = false;
|
||||
for (int j = y - 1; j >= 0; j--)
|
||||
{
|
||||
for (int i = -3; i <= 3; i++)
|
||||
{
|
||||
for (int k = -3; k <= 3; k++)
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x + i, j, z + k)];
|
||||
int meta = world.getBlockMetadata(x + i, j, z + k);
|
||||
|
||||
if (block == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(block, 1, meta);
|
||||
int id = OreDictionary.getOreID(itemStack);
|
||||
|
||||
if (id != -1)
|
||||
{
|
||||
String oreName = OreDictionary.getOreName(id);
|
||||
|
||||
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);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import thaumcraft.api.ItemApi;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class RitualEffectSoulBound extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ritualStone.getVar1() == 0)
|
||||
{
|
||||
int d0 = 0;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y + 1, (double)z, (double)(x + 1), (double)(y + 2), (double)(z + 1)).expand(d0, d0, d0);
|
||||
List list = world.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;
|
||||
}
|
||||
|
||||
ItemStack itemGoggles = null;
|
||||
|
||||
if (AlchemicalWizardry.isThaumcraftLoaded)
|
||||
{
|
||||
itemGoggles = ItemApi.getItem("itemGoggles", 0);
|
||||
}
|
||||
|
||||
if (itemStack.itemID == AlchemicalWizardry.apprenticeBloodOrb.itemID)
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.energyBlaster.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
else if (itemStack.itemID == Item.swordDiamond.itemID)
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.energySword.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
else if (itemStack.itemID == Item.pickaxeDiamond.itemID)
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.boundPickaxe.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
else if (itemStack.itemID == Item.axeDiamond.itemID)
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.boundAxe.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
else if (itemStack.itemID == Item.shovelDiamond.itemID)
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.boundShovel.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
else if (itemGoggles != null && itemGoggles.isItemEqual(itemStack))
|
||||
{
|
||||
ritualStone.setVar1(AlchemicalWizardry.sanguineHelmet.itemID);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
item.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(10) == 0)
|
||||
{
|
||||
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(item.posX, item.posY, item.posZ, (short)1));
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
|
||||
|
||||
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 (ritualStone.getCooldown() <= 0)
|
||||
{
|
||||
ItemStack spawnedItem = new ItemStack(ritualStone.getVar1(), 1, 0);
|
||||
|
||||
if (spawnedItem != null)
|
||||
{
|
||||
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, spawnedItem);
|
||||
world.spawnEntityInWorld(newItem);
|
||||
}
|
||||
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
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;
|
||||
|
||||
public class RitualEffectSummonMeteor extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
List<EntityItem> entities = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
|
||||
if (entities == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (EntityItem entityItem : entities)
|
||||
{
|
||||
if (entityItem != null && MeteorRegistry.isValidParadigmItem(entityItem.getEntityItem()))
|
||||
{
|
||||
int meteorID = MeteorRegistry.getParadigmIDForItem(entityItem.getEntityItem());
|
||||
EntityMeteor meteor = new EntityMeteor(world, x + 0.5f, 257, z + 0.5f, meteorID);
|
||||
meteor.motionY = -1.0f;
|
||||
entityItem.setDead();
|
||||
world.spawnEntityInWorld(meteor);
|
||||
ritualStone.setActive(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// EnergyBlastProjectile proj = new EnergyBlastProjectile(world, x, y+20, z);
|
||||
// proj.motionX = 0.0d;
|
||||
// proj.motionZ = 0.0d;
|
||||
// proj.motionY = -1.0d;
|
||||
// world.spawnEntityInWorld(proj);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.nbt.NBTTagCompound;
|
||||
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.common.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class RitualEffectUnbinding extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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)x, (double)y + 1, (double)z, (double)(x + 1), (double)(y + 2), (double)(z + 1)).expand(d0, d0, d0);
|
||||
List list = world.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)
|
||||
{
|
||||
ritualStone.setVar1(5);
|
||||
}
|
||||
else if (itemStack.itemID == AlchemicalWizardry.boundPlate.itemID)
|
||||
{
|
||||
ritualStone.setVar1(8);
|
||||
}
|
||||
else if (itemStack.itemID == AlchemicalWizardry.boundLeggings.itemID)
|
||||
{
|
||||
ritualStone.setVar1(7);
|
||||
}
|
||||
else if (itemStack.itemID == AlchemicalWizardry.boundBoots.itemID)
|
||||
{
|
||||
ritualStone.setVar1(4);
|
||||
}
|
||||
else if (itemStack.itemID == AlchemicalWizardry.sigilOfHolding.itemID)
|
||||
{
|
||||
ritualStone.setVar1(-1);
|
||||
}
|
||||
|
||||
if (ritualStone.getVar1() > 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(world, x + 0.5, y + 1, z + 0.5, internalItem.copy());
|
||||
world.spawnEntityInWorld(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, new ItemStack(Block.blocksList[AlchemicalWizardry.bloodSocket.blockID], ritualStone.getVar1()));
|
||||
world.spawnEntityInWorld(newItem);
|
||||
ritualStone.setActive(false);
|
||||
break;
|
||||
}
|
||||
else if (ritualStone.getVar1() == -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(world, x + 0.5, y + 1, z + 0.5, internalItem.copy());
|
||||
world.spawnEntityInWorld(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, new ItemStack(AlchemicalWizardry.sigilOfHolding.itemID, 1, 0));
|
||||
world.spawnEntityInWorld(newItem);
|
||||
ritualStone.setActive(false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(10) == 0)
|
||||
{
|
||||
PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(item.posX, item.posY, item.posZ, (short)1));
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.block.Block;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class RitualEffectWater extends RitualEffect
|
||||
{
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.isAirBlock(x, y + 1, z))
|
||||
{
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
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(x, y, z, (short)3));
|
||||
}
|
||||
|
||||
world.setBlock(x, y + 1, z, Block.waterMoving.blockID, 0, 3);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 25;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
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 cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class RitualEffectWellOfSuffering extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 25;
|
||||
public final int amount = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(TEMasterStone 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;
|
||||
World world = ritualStone.worldObj;
|
||||
int x = ritualStone.xCoord;
|
||||
int y = ritualStone.yCoord;
|
||||
int z = ritualStone.zCoord;
|
||||
|
||||
if (world.getWorldTime() % this.timeDelay != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
TEAltar tileAltar = null;
|
||||
boolean testFlag = false;
|
||||
|
||||
for (int i = -5; i <= 5; i++)
|
||||
{
|
||||
for (int j = -5; j <= 5; j++)
|
||||
{
|
||||
for (int k = -10; k <= 10; k++)
|
||||
{
|
||||
if (world.getBlockTileEntity(x + i, y + k, z + j) instanceof TEAltar)
|
||||
{
|
||||
tileAltar = (TEAltar)world.getBlockTileEntity(x + i, y + k, z + j);
|
||||
testFlag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!testFlag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 5;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)x, (double)y, (double)z, (double)(x + 1), (double)(y + 1), (double)(z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityLivingBase entity;
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
{
|
||||
entity = (EntityLivingBase)iterator1.next();
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
entity = (EntityLivingBase)iterator2.next();
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
entity.attackEntityFrom(DamageSource.outOfWorld, 1);
|
||||
entityCount++;
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
tileAltar.sacrificialDaggerCall(this.amount, true);
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 2;
|
||||
}
|
||||
}
|
1069
BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java
Normal file
1069
BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue