Updating 1.7.2 repo
This commit is contained in:
parent
c9a38c4c10
commit
9dc8a57a2d
76 changed files with 1789 additions and 184 deletions
|
@ -64,7 +64,7 @@ public class BlockBloodLightSource extends Block
|
|||
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
|
||||
this.setBlockBounds(0.4f,0.4f,0.4f,0.6f,0.6f,0.6f);
|
||||
//super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
|
@ -72,4 +72,10 @@ public class BlockBloodLightSource extends Block
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAirBlock(World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSpectralContainer extends BlockContainer
|
||||
{
|
||||
public BlockSpectralContainer(int par1)
|
||||
{
|
||||
super(par1, Material.cloth);
|
||||
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setUnlocalizedName("blockSpectralContainer");
|
||||
this.setBlockBounds(0,0,0,0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -64,41 +64,15 @@ public class SpectralBlock extends Block
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
//TEAltar tileEntity = (TEAltar)world.getBlockTileEntity(x, y, z);
|
||||
if (player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof ItemBlock)
|
||||
{
|
||||
world.setBlock(x, y, z, playerItem.itemID, playerItem.getItemDamage(), 3);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.stackSize--;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,7 +706,7 @@ public class EntityElemental extends EntityDemon
|
|||
{
|
||||
EntityLivingBase entityLiving1 = entities.get(i);
|
||||
|
||||
if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer) entityLiving1).capabilities.disableDamage) && entityLiving1.isEntityAlive())
|
||||
if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer) entityLiving1).capabilities.disableDamage) && entityLiving1.isEntityAlive() && !(entityLiving1 instanceof EntityElemental))
|
||||
{
|
||||
double d5 = entityLiving1.getDistanceSq(par1, par3, par5);
|
||||
double d6 = par2;
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.sigil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSigilOfSupression extends EnergyItems implements ArmourUpgrade
|
||||
{
|
||||
private static Icon activeIcon;
|
||||
private static Icon passiveIcon;
|
||||
private int tickDelay = 200;
|
||||
private int radius = 5;
|
||||
private int refresh = 100;
|
||||
|
||||
public ItemSigilOfSupression(int id)
|
||||
{
|
||||
super(id);
|
||||
this.maxStackSize = 1;
|
||||
setEnergyUsed(200);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("I have a very magnetic personality!");
|
||||
|
||||
if (!(par1ItemStack.stackTagCompound == null))
|
||||
{
|
||||
if (par1ItemStack.stackTagCompound.getBoolean("isActive"))
|
||||
{
|
||||
par3List.add("Activated");
|
||||
} else
|
||||
{
|
||||
par3List.add("Deactivated");
|
||||
}
|
||||
|
||||
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated");
|
||||
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_activated");
|
||||
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.stackTagCompound;
|
||||
|
||||
if (tag.getBoolean("isActive"))
|
||||
{
|
||||
return this.activeIcon;
|
||||
} else
|
||||
{
|
||||
return this.passiveIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1)
|
||||
{
|
||||
if (par1 == 1)
|
||||
{
|
||||
return this.activeIcon;
|
||||
} else
|
||||
{
|
||||
return this.passiveIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
|
||||
|
||||
if(SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isSneaking())
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
if (par1ItemStack.stackTagCompound == null)
|
||||
{
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = par1ItemStack.stackTagCompound;
|
||||
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
|
||||
|
||||
if (tag.getBoolean("isActive"))
|
||||
{
|
||||
par1ItemStack.setItemDamage(1);
|
||||
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed());
|
||||
}
|
||||
} else
|
||||
{
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
|
||||
{
|
||||
if (!(par3Entity instanceof EntityPlayer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(SpellHelper.isFakePlayer(par2World, (EntityPlayer)par3Entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
|
||||
|
||||
if (par1ItemStack.stackTagCompound == null)
|
||||
{
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (par1ItemStack.stackTagCompound.getBoolean("isActive")&&(!par2World.isRemote))
|
||||
{
|
||||
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
|
||||
int x = (int)blockVec.xCoord;
|
||||
int y = (int)blockVec.yCoord;
|
||||
int z = (int)blockVec.zCoord;
|
||||
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for(int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[par2World.getBlockId(x+i, y+j, z+k)];
|
||||
|
||||
|
||||
if(SpellHelper.isBlockFluid(block))
|
||||
{
|
||||
TESpectralContainer.createSpectralBlockAtLocation(par2World, x+i, y+j, z+k, refresh);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity tile = par2World.getBlockTileEntity(x+i, y+j, z+k);
|
||||
if(tile instanceof TESpectralContainer)
|
||||
{
|
||||
((TESpectralContainer) tile).resetDuration(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
|
||||
{
|
||||
Vec3 blockVec = SpellHelper.getEntityBlockVector(player);
|
||||
int x = (int)blockVec.xCoord;
|
||||
int y = (int)blockVec.yCoord;
|
||||
int z = (int)blockVec.zCoord;
|
||||
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for(int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[world.getBlockId(x+i, y+j, z+k)];
|
||||
|
||||
|
||||
if(SpellHelper.isBlockFluid(block))
|
||||
{
|
||||
TESpectralContainer.createSpectralBlockAtLocation(world, x+i, y+j, z+k, refresh);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x+i, y+j, z+k);
|
||||
if(tile instanceof TESpectralContainer)
|
||||
{
|
||||
((TESpectralContainer) tile).resetDuration(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgrade()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyForTenSeconds()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
|
||||
|
||||
public class RitualEffectExpulsion 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.getWorldObj();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
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 = 25;
|
||||
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(EntityPlayer.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityPlayer entityplayer;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
if (!(entityplayer.getEntityName().equals(owner)))
|
||||
{
|
||||
if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
teleportRandomly(entityplayer,100);
|
||||
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
|
||||
{
|
||||
double x = entityLiving.posX;
|
||||
double y = entityLiving.posY;
|
||||
double z = entityLiving.posZ;
|
||||
Random rand = new Random();
|
||||
double d0 = x + (rand.nextDouble() - 0.5D) * distance;
|
||||
double d1 = y + (double) (rand.nextInt((int) distance) - (distance) / 2);
|
||||
double d2 = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
int i = 0;
|
||||
|
||||
while (!teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100)
|
||||
{
|
||||
d0 = x + (rand.nextDouble() - 0.5D) * distance;
|
||||
d1 = y + (double) (rand.nextInt((int) distance) - (distance) / 2);
|
||||
d2 = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i >= 100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
//return SpellTeleport.teleportTo(entityLiving, d0, d1, d2,x,y,z);
|
||||
}
|
||||
|
||||
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
|
||||
{
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double d3 = lastX;
|
||||
double d4 = lastY;
|
||||
double d5 = lastZ;
|
||||
SpellTeleport.moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ);
|
||||
boolean flag = false;
|
||||
int i = MathHelper.floor_double(entityLiving.posX);
|
||||
int j = MathHelper.floor_double(entityLiving.posY);
|
||||
int k = MathHelper.floor_double(entityLiving.posZ);
|
||||
int l;
|
||||
|
||||
if (entityLiving.worldObj.blockExists(i, j, k))
|
||||
{
|
||||
boolean flag1 = false;
|
||||
|
||||
while (!flag1 && j > 0)
|
||||
{
|
||||
l = entityLiving.worldObj.getBlockId(i, j - 1, k);
|
||||
|
||||
if (l != 0 && Block.blocksList[l].blockMaterial.blocksMovement())
|
||||
{
|
||||
flag1 = true;
|
||||
} else
|
||||
{
|
||||
--entityLiving.posY;
|
||||
--j;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
|
||||
|
||||
if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
SpellTeleport.moveEntityViaTeleport(entityLiving, d3, d4, d5);
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
short short1 = 128;
|
||||
|
||||
for (l = 0; l < short1; ++l)
|
||||
{
|
||||
double d6 = (double) l / ((double) short1 - 1.0D);
|
||||
float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
|
||||
float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
|
||||
float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
|
||||
double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
|
||||
double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height;
|
||||
double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
|
||||
entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
|
||||
}
|
||||
|
||||
// this.worldObj.playSoundEffect(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
// this.playSound("mob.endermen.portal", 1.0F, 1.0F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
if (entityLiving != null && entityLiving instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
|
||||
|
||||
if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == entityLiving.worldObj)
|
||||
{
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (entityLiving.isRiding())
|
||||
{
|
||||
entityLiving.mountEntity((Entity) null);
|
||||
}
|
||||
|
||||
entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
|
||||
// this.getThrower().fallDistance = 0.0F;
|
||||
// this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (entityLiving != null)
|
||||
{
|
||||
entityLiving.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
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.TESpectralContainer;
|
||||
|
||||
public class RitualEffectSupression 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.getWorldObj();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
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 radius = 10;
|
||||
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for(int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[world.getBlockId(x+i, y+j, z+k)];
|
||||
|
||||
|
||||
if(SpellHelper.isBlockFluid(block))
|
||||
{
|
||||
TESpectralContainer.createSpectralBlockAtLocation(world, x+i, y+j, z+k, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x+i, y+j, z+k);
|
||||
if(tile instanceof TESpectralContainer)
|
||||
{
|
||||
((TESpectralContainer) tile).resetDuration(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TESpectralContainer extends TileEntity
|
||||
{
|
||||
private ItemStack[] inv;
|
||||
|
||||
private int ticksRemaining;
|
||||
|
||||
public TESpectralContainer()
|
||||
{
|
||||
this.inv = new ItemStack[1];
|
||||
|
||||
ticksRemaining = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory");
|
||||
|
||||
for (int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
|
||||
int slot = tag.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot < inv.length)
|
||||
{
|
||||
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
|
||||
}
|
||||
}
|
||||
|
||||
ticksRemaining = par1NBTTagCompound.getInteger("ticksRemaining");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
|
||||
if (inv[i] != null)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setByte("Slot", (byte) i);
|
||||
inv[i].writeToNBT(tag);
|
||||
itemList.appendTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Inventory", itemList);
|
||||
par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
this.ticksRemaining--;
|
||||
|
||||
if(this.ticksRemaining<=0)
|
||||
{
|
||||
this.returnContainedBlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration)
|
||||
{
|
||||
if(world.getBlockTileEntity(x, y, z)==null)
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
|
||||
if(block==null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
ItemStack item = new ItemStack(block, 1, meta);
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.blockSpectralContainer.blockID);
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
if(tile instanceof TESpectralContainer)
|
||||
{
|
||||
((TESpectralContainer) tile).setContainedItem(item);
|
||||
((TESpectralContainer) tile).setDuration(duration);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setDuration(int dur)
|
||||
{
|
||||
this.ticksRemaining = dur;
|
||||
}
|
||||
|
||||
public void resetDuration(int dur)
|
||||
{
|
||||
if(this.ticksRemaining<dur)
|
||||
{
|
||||
this.ticksRemaining = dur;
|
||||
}
|
||||
}
|
||||
|
||||
public void setContainedItem(ItemStack item)
|
||||
{
|
||||
this.inv[0] = item;
|
||||
}
|
||||
|
||||
public void returnContainedBlock()
|
||||
{
|
||||
ItemStack item = this.inv[0];
|
||||
if(item!=null)
|
||||
{
|
||||
Block block = Block.blocksList[item.itemID];
|
||||
int meta = item.getItemDamage();
|
||||
|
||||
if(block != null)
|
||||
{
|
||||
this.worldObj.setBlock(xCoord, yCoord, zCoord, item.itemID, meta, 6);
|
||||
}
|
||||
}else
|
||||
{
|
||||
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue