Big commitment~
This commit is contained in:
parent
a92efa364d
commit
4f9fad22c5
24 changed files with 1122 additions and 182 deletions
|
@ -0,0 +1,182 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
|
||||
public class RitualEffectEllipsoid extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
|
||||
|
||||
if(((IInventory) tile).getSizeInventory() < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!(tile instanceof IInventory) || ((IInventory)tile).getSizeInventory() < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item1 = ((IInventory) tile).getStackInSlot(0);
|
||||
ItemStack item2 = ((IInventory) tile).getStackInSlot(1);
|
||||
ItemStack item3 = ((IInventory) tile).getStackInSlot(2);
|
||||
|
||||
int xSize = item1 == null ? 0 : item1.stackSize;
|
||||
int ySize = item2 == null ? 0 : item2.stackSize;
|
||||
int zSize = item3 == null ? 0 : item3.stackSize;
|
||||
|
||||
int cost = (int)Math.pow((xSize+1)*(ySize+1)*(zSize+1),0.333);
|
||||
|
||||
if (currentEssence < cost)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
//if(tile instanceof IInventory)
|
||||
{
|
||||
int refresh = 1000;
|
||||
|
||||
int j = (int)(world.getWorldTime()%(ySize*2+1)) - ySize;
|
||||
|
||||
for (int i = -xSize; i <= xSize; i++)
|
||||
{
|
||||
// for (int j = -ySize; j <= ySize; j++)
|
||||
{
|
||||
for(int k = -zSize; k <= zSize; k++)
|
||||
{
|
||||
if (Math.pow(i*(ySize - 0.50f)*(zSize - 0.50f),2) + Math.pow(j*(xSize - 0.50f)*(zSize - 0.50f),2) + Math.pow(k*(xSize - 0.50f)*(ySize - 0.50f),2) <= Math.pow((xSize - 1 + 0.50f)*(ySize - 1 + 0.50f)*(zSize - 1 + 0.50f), 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Math.pow(i*(ySize + 0.50f)*(zSize + 0.50f),2) + Math.pow(j*(xSize + 0.50f)*(zSize + 0.50f),2) + Math.pow(k*(xSize + 0.50f)*(ySize + 0.50f),2) >= Math.pow((xSize + 0.50f)*(ySize + 0.50f)*(zSize + 0.50f), 2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x+i, y+j, z+k);
|
||||
|
||||
if(block.isAir(world, x+i, y+j, z+k))
|
||||
{
|
||||
//world.setBlock(x+i, y+j, z+k, Blocks.stone);
|
||||
TESpectralBlock.createSpectralBlockAtLocation(world, x+i, y+j, z+k, refresh);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity tile1 = world.getTileEntity(x+i, y+j, z+k);
|
||||
if(tile instanceof TESpectralBlock)
|
||||
{
|
||||
((TESpectralBlock) tile1).resetDuration(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - cost;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.FIRE));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.FIRE));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.AIR));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.AIR));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.EARTH));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.EARTH));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.WATER));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.WATER));
|
||||
|
||||
return ellipsoidRitual;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MaterialLiquid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
|
||||
public class RitualEffectEvaporation extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (currentEssence < 0)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
Block block1 = world.getBlock(x, y-1, z);
|
||||
int range = this.getRadiusForModifierBlock(block1);
|
||||
|
||||
boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k = 0; k < 2 * range + 1; k++)
|
||||
{
|
||||
boolList[i][j][k] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolList[range][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++)
|
||||
{
|
||||
for(int k=0; k<2*range+1;k++)
|
||||
{
|
||||
if (boolList[i][j][k])
|
||||
{
|
||||
if (i - 1 >= 0 && !boolList[i - 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
|
||||
if(world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i - 1][j][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j - 1 >= 0 && !boolList[i][j - 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k);
|
||||
if(world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j - 1][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k - 1 >=0 && !boolList[i][j][k - 1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
|
||||
if(world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j][k - 1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i + 1 <= 2 * range && !boolList[i + 1][j][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
|
||||
if(world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i + 1][j][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (j + 1 <= 2 * range && !boolList[i][j + 1][k])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
|
||||
if(world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j + 1][k] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(k + 1 <= 2*range && !boolList[i][j][k+1])
|
||||
{
|
||||
Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
|
||||
if(world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
boolList[i][j][k+1] = true;
|
||||
isReady = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2 * range + 1; i++)
|
||||
{
|
||||
for (int j = 0; j < 2 * range + 1; j++)
|
||||
{
|
||||
for(int k=0; k<2*range+1;k++)
|
||||
{
|
||||
if(!boolList[i][j][k])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x+i-range, y+j-range, z+k-range);
|
||||
|
||||
if(block == ModBlocks.blockSpectralContainer)
|
||||
{
|
||||
world.setBlockToAir(x+i-range, y+j-range, z+k-range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
|
||||
ritualStone.setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> ellipsoidRitual = new ArrayList();
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(4,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(5,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-4,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,0,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-5,0,2,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,4,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-4,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(0,0,-5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,-5,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-5,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-1,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,-3,RitualComponent.DUSK));
|
||||
|
||||
ellipsoidRitual.add(new RitualComponent(1,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(2,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(3,0,-2,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-1,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-2,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,3,RitualComponent.DUSK));
|
||||
ellipsoidRitual.add(new RitualComponent(-3,0,2,RitualComponent.DUSK));
|
||||
|
||||
return ellipsoidRitual;
|
||||
}
|
||||
|
||||
public int getRadiusForModifierBlock(Block block)
|
||||
{
|
||||
if(block == null)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
if(block == Blocks.diamond_block)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
if(block == Blocks.gold_block)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
if(block == Blocks.iron_block)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
return 10;
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
if (currentEssence < this.getCostPerRefresh()*9)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
int flag = 0;
|
||||
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
|
@ -67,15 +67,15 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z);
|
||||
block.updateTick(world, x + i, y + 2, z + j, world.rand);
|
||||
flag = true;
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
if (flag > 0)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 100;
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
@ -37,7 +38,7 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
int maxCount = 9;
|
||||
int maxCount = 100;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * maxCount)
|
||||
{
|
||||
|
@ -51,21 +52,23 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
} else
|
||||
{
|
||||
if (world.getWorldTime() % 20 != 0)
|
||||
if (world.getWorldTime() % 5 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Block block = world.getBlock(x, y-1, z);
|
||||
int flag = 0;
|
||||
int range = 4;
|
||||
int range = this.getRadiusForModifierBlock(block);
|
||||
int vertRange = 4;
|
||||
|
||||
for (int i = -range; i <= range; i++)
|
||||
{
|
||||
for (int j = -range; j <= range; j++)
|
||||
for (int j = -vertRange; j <= vertRange; j++)
|
||||
{
|
||||
for(int k = -range; k<=range; k++)
|
||||
{
|
||||
if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k))
|
||||
if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount)
|
||||
{
|
||||
flag++;
|
||||
}
|
||||
|
@ -87,6 +90,31 @@ public class RitualEffectHarvest extends RitualEffect
|
|||
return 20;
|
||||
}
|
||||
|
||||
public int getRadiusForModifierBlock(Block block)
|
||||
{
|
||||
if(block == null)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if(block == Blocks.diamond_block)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
if(block == Blocks.gold_block)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
if(block == Blocks.iron_block)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectSummonPlayer extends RitualEffect //Summons a player via the bound item
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.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 && entityItem.getEntityItem().getItem() instanceof IBindable)
|
||||
{
|
||||
String str = EnergyItems.getOwnerName(entityItem.getEntityItem());
|
||||
|
||||
EntityPlayer entityPlayer = SpellHelper.getPlayerForUsername(str);
|
||||
if(entityPlayer!=null)
|
||||
{
|
||||
entityPlayer.posX = x;
|
||||
entityPlayer.posY = y+1;
|
||||
entityPlayer.posZ = z;
|
||||
|
||||
if(entityPlayer instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)entityPlayer).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP)entityPlayer), 0);
|
||||
}
|
||||
|
||||
entityItem.setDead();
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -77,7 +77,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect
|
|||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 5;
|
||||
int vertRange = 10;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue