Finished TileEntities
This commit is contained in:
parent
cfed9f5ab3
commit
b2f7ec6030
36 changed files with 183 additions and 233 deletions
|
@ -1,14 +1,12 @@
|
|||
package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellTable;
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
@ -24,13 +22,6 @@ public class BlankSpell extends EnergyItems
|
|||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankSpell");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
|
@ -65,13 +56,13 @@ public class BlankSpell extends EnergyItems
|
|||
if (world != null)
|
||||
{
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
TileEntity tileEntity = world.getTileEntity(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord"));
|
||||
TileEntity tileEntity = world.getTileEntity(new BlockPos(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord")));
|
||||
|
||||
if (tileEntity instanceof TEHomHeart)
|
||||
if (tileEntity instanceof TESpellTable)
|
||||
{
|
||||
TEHomHeart homHeart = (TEHomHeart) tileEntity;
|
||||
TESpellTable homHeart = (TESpellTable) tileEntity;
|
||||
|
||||
if (homHeart.canCastSpell(par1ItemStack, par2World, par3EntityPlayer))
|
||||
if (homHeart.canCastSpell())
|
||||
{
|
||||
if(EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, homHeart.getCostForSpell()))
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EnergyItems extends Item implements IBindable
|
||||
|
@ -47,7 +48,7 @@ public class EnergyItems extends Item implements IBindable
|
|||
float f3 = f * f * 0.6F - 0.7F;
|
||||
for (int l = 0; l < 8; ++l)
|
||||
{
|
||||
world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < damage; i++)
|
||||
|
@ -115,6 +116,7 @@ public class EnergyItems extends Item implements IBindable
|
|||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
|
@ -173,6 +175,7 @@ public class EnergyItems extends Item implements IBindable
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean syphonAndDamageWhileInContainer(ItemStack ist, EntityPlayer player, int damageToBeDone)
|
||||
{
|
||||
if (!syphonWhileInContainer(ist, damageToBeDone))
|
||||
|
@ -222,35 +225,6 @@ public class EnergyItems extends Item implements IBindable
|
|||
return item.getTagCompound().getString("ownerName");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void drainPlayerNetwork(EntityPlayer player, int damageToBeDone)
|
||||
{
|
||||
String ownerName = SpellHelper.getUsername(player);
|
||||
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
if (data.currentEssence >= damageToBeDone)
|
||||
{
|
||||
data.currentEssence -= damageToBeDone;
|
||||
data.markDirty();
|
||||
} else
|
||||
{
|
||||
hurtPlayer(player, damageToBeDone);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int getCurrentEssence(String ownerName)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue