87 lines
3 KiB
Java
87 lines
3 KiB
Java
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.potion.Potion;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.server.MinecraftServer;
|
|
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.block.BlockSpectralContainer;
|
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
|
|
|
public class RitualEffectLava 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();
|
|
|
|
Block block = world.getBlock(x, y + 1, z);
|
|
|
|
if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer))
|
|
{
|
|
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++)
|
|
{
|
|
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z);
|
|
}
|
|
|
|
world.setBlock(x, y + 1, z, Blocks.lava, 0, 3);
|
|
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
|
data.markDirty();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public int getCostPerRefresh()
|
|
{
|
|
// TODO Auto-generated method stub
|
|
return 500;
|
|
}
|
|
|
|
@Override
|
|
public List<RitualComponent> getRitualComponentList()
|
|
{
|
|
ArrayList<RitualComponent> lavaRitual = new ArrayList();
|
|
lavaRitual.add(new RitualComponent(1, 0, 0, 2));
|
|
lavaRitual.add(new RitualComponent(-1, 0, 0, 2));
|
|
lavaRitual.add(new RitualComponent(0, 0, 1, 2));
|
|
lavaRitual.add(new RitualComponent(0, 0, -1, 2));
|
|
return lavaRitual;
|
|
}
|
|
}
|