Added ender arrow

This commit is contained in:
brandon3055 committed 2014-08-15 12:04:08 +10:00
1 parent 00a57c960c
commit 641c23e80d
29 files changed
+934 -190

No files matched your search

@@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -29,6 +30,11 @@ public class PlacedItem extends BlockDE {
ModBlocks.register(this);
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("glass");
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
switch (world.getBlockMetadata(x, y, z)){
@@ -86,7 +92,7 @@ public class PlacedItem extends BlockDE {
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta){
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TilePlacedItem && ((TilePlacedItem)te).getStack() != null) {
TilePlacedItem tile = (TilePlacedItem) te;
@@ -129,6 +135,23 @@ public class PlacedItem extends BlockDE {
return true;
}
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
if (player.isSneaking()){
TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null;
if (tile == null) {
world.setBlockToAir(x, y, z);
}
tile.rotation += 25;
}else {
TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null;
if (tile == null) {
world.setBlockToAir(x, y, z);
}
tile.rotation -= 25;
}
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
@@ -148,4 +171,6 @@ public class PlacedItem extends BlockDE {
}
return null;
}
}
@@ -88,7 +88,7 @@ public class CraftingHandler {
public static void registerShapelessRecipes()
{
//CraftingManager.getInstance().addShapelessRecipe(new ItemStack(ModItems.tcSword), ModItems.tcSwordBlade, Items.stick);
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(ModItems.enderArrow), Items.arrow, Items.ender_pearl);
}
}
@@ -11,6 +11,9 @@ import com.brandon3055.draconicevolution.common.core.handler.MinecraftForgeEvent
import com.brandon3055.draconicevolution.common.core.network.*;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.EntityDraconicArrow;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
@@ -103,8 +106,9 @@ public class CommonProxy {
}
public void registerEntitys() {
//int cyan = (0 << 16) + (255 << 8) + 255;
//EntityRegistry.registerGlobalEntityID(EntityCustomDragon.class, References.RESOURCESPREFIX + "EnderDragon", EntityRegistry.findGlobalUniqueEntityId(), cyan, 0);
EntityRegistry.registerModEntity(EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 500, 3, true);
EntityRegistry.registerModEntity(EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityEnderArrow.class, "Ender Arrow", 2, DraconicEvolution.instance, 32, 5, true);
}
}
@@ -1,14 +1,13 @@
package com.brandon3055.draconicevolution.common.entity;
import java.util.List;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -17,16 +16,12 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityDraconicArrow extends EntityArrow implements IProjectile {
import java.util.List;
public class EntityDraconicArrow extends EntityArrow {
private int field_145791_d = -1;
private int field_145792_e = -1;
private int field_145789_f = -1;
@@ -40,17 +35,31 @@ public class EntityDraconicArrow extends EntityArrow implements IProjectile {
private int knockbackStrength;
public boolean ignorSpeed = false;
public boolean explosive = false;
private World world;
public EntityDraconicArrow(ItemStack stack, World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
public EntityDraconicArrow(World p_i1753_1_)
{
super(p_i1753_1_);
}
public EntityDraconicArrow(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
{
super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_);
}
public EntityDraconicArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
{
super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_);
}
public EntityDraconicArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
super(par1World, par2EntityLivingBase, par3);
}
/*public EntityDraconicArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
super(par1World);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = par2EntityLivingBase;
world = par1World;
//if (par2EntityLivingBase instanceof EntityPlayer) {
// if (!(EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0))
// this.canBePickedUp = 2;
//}
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch);
@@ -64,7 +73,7 @@ public class EntityDraconicArrow extends EntityArrow implements IProjectile {
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
}
*/
@Override
protected void entityInit()
{
@@ -137,7 +146,7 @@ public class EntityDraconicArrow extends EntityArrow implements IProjectile {
if (block.getMaterial() != Material.air) {
if (explosive) {
world.createExplosion(this.shootingEntity, this.field_145791_d, this.field_145792_e, this.field_145789_f, 4, ConfigHandler.bowBlockDamage);
worldObj.createExplosion(this.shootingEntity, this.field_145791_d, this.field_145792_e, this.field_145789_f, 4, ConfigHandler.bowBlockDamage);
this.setDead();
}
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
@@ -227,7 +236,7 @@ public class EntityDraconicArrow extends EntityArrow implements IProjectile {
if (explosive) {
//world.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 6, false);
//movingobjectposition.entityHit.hurtResistantTime = 0;
world.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 4, ConfigHandler.bowBlockDamage);
worldObj.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 4, ConfigHandler.bowBlockDamage);
this.setDead();
}
int k;
@@ -0,0 +1,433 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import java.util.List;
public class EntityEnderArrow extends EntityDraconicArrow {
private int field_145791_d = -1;
private int field_145792_e = -1;
private int field_145789_f = -1;
private Block field_145790_g;
private int inData;
private boolean inGround;
private int ticksInGround;
private int ticksInAir;
private double damage = 2.0D;
/** The amount of knockback an arrow applies when it hits a mob. */
private int knockbackStrength;
public boolean ignorSpeed = false;
public boolean explosive = false;
public EntityEnderArrow(World p_i1753_1_)
{
super(p_i1753_1_);
}
public EntityEnderArrow(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
{
super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_);
}
public EntityEnderArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
{
super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_);
}
public EntityEnderArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
super(par1World, par2EntityLivingBase, par3);
}
@Override
protected void entityInit()
{
super.entityInit();
//this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
@Override
public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8)
{
float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
par1 /= f2;
par3 /= f2;
par5 /= f2;
par1 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8;
par3 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8;
par5 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8;
par1 *= par7;
par3 *= par7;
par5 *= par7;
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f3) * 180.0D / Math.PI);
this.ticksInGround = 0;
}
@Override
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
{
this.setPosition(par1, par3, par5);
this.setRotation(par7, par8);
}
@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double par1, double par3, double par5)
{
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.ticksInGround = 0;
}
}
@SuppressWarnings("rawtypes")
@Override
public void onUpdate()
{
this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
super.onEntityUpdate();
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI);
}
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (block.getMaterial() != Material.air) {
onImpact(null);
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
this.inGround = true;
}
}
if (this.arrowShake > 0) {
--this.arrowShake;
}
if (this.inGround) {
this.setDead();
} else {
++this.ticksInAir;
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
for (i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
if (movingobjectposition1 != null) {
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
movingobjectposition = null;
}
}
float f2;
float f4;
if (movingobjectposition != null) {
if (movingobjectposition.entityHit != null) {
onImpact(movingobjectposition.entityHit);
int k;
if (!ignorSpeed) {
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
k = MathHelper.ceiling_double_int(f2 * this.damage);
if (this.getIsCritical()) {
k += this.rand.nextInt(k / 2 + 2);
}
} else {
k = (int) this.damage;
if (this.getIsCritical()) {
k += this.rand.nextInt(k / 2 + 2);
}
}
DamageSource damagesource = null;
if (this.shootingEntity == null) {
damagesource = DamageSource.causeArrowDamage(this, this);
} else {
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
}
if (movingobjectposition.entityHit instanceof EntityEnderman)
damagesource = DamageSource.magic;
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) {
movingobjectposition.entityHit.setFire(5);
}
movingobjectposition.entityHit.hurtResistantTime = 0;
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) {
if (movingobjectposition.entityHit instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit;
if (!this.worldObj.isRemote) {
entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
}
if (this.knockbackStrength > 0) {
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f4 > 0.0F) {
movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
}
}
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) {
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase);
}
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) {
((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
}
}
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
// if (!(movingobjectposition.entityHit instanceof EntityEnderman))
//{
this.setDead();
//}
} else {
this.motionX *= -0.10000000149011612D;
this.motionY *= -0.10000000149011612D;
this.motionZ *= -0.10000000149011612D;
this.rotationYaw += 180.0F;
this.prevRotationYaw += 180.0F;
this.ticksInAir = 0;
}
} else {
this.field_145791_d = movingobjectposition.blockX;
this.field_145792_e = movingobjectposition.blockY;
this.field_145789_f = movingobjectposition.blockZ;
this.field_145790_g = block;
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX));
this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY));
this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ));
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.posX -= this.motionX / f2 * 0.05000000074505806D;
this.posY -= this.motionY / f2 * 0.05000000074505806D;
this.posZ -= this.motionZ / f2 * 0.05000000074505806D;
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.arrowShake = 7;
this.setIsCritical(false);
if (this.field_145790_g.getMaterial() != Material.air) {
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
}
}
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
;
}
while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
this.prevRotationPitch += 360.0F;
}
while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
this.prevRotationYaw -= 360.0F;
}
while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
this.prevRotationYaw += 360.0F;
}
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
float f3 = 0.99F;
f1 = 0.05F;
if (this.isInWater()) {
for (int l = 0; l < 4; ++l) {
f4 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ);
}
f3 = 0.8F;
}
if (this.isWet()) {
this.extinguish();
}
this.motionX *= f3;
this.motionY *= f3;
this.motionZ *= f3;
this.motionY -= f1;
this.setPosition(this.posX, this.posY, this.posZ);
this.func_145775_I();
}
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short) this.field_145791_d);
par1NBTTagCompound.setShort("yTile", (short) this.field_145792_e);
par1NBTTagCompound.setShort("zTile", (short) this.field_145789_f);
par1NBTTagCompound.setShort("life", (short) this.ticksInGround);
par1NBTTagCompound.setByte("inTile", (byte) Block.getIdFromBlock(this.field_145790_g));
par1NBTTagCompound.setByte("inData", (byte) this.inData);
par1NBTTagCompound.setByte("shake", (byte) this.arrowShake);
par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp);
par1NBTTagCompound.setDouble("damage", this.damage);
//par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) getShooter()).getCommandSenderName() : "");
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
this.field_145791_d = par1NBTTagCompound.getShort("xTile");
this.field_145792_e = par1NBTTagCompound.getShort("yTile");
this.field_145789_f = par1NBTTagCompound.getShort("zTile");
this.ticksInGround = par1NBTTagCompound.getShort("life");
this.field_145790_g = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255);
this.inData = par1NBTTagCompound.getByte("inData") & 255;
this.arrowShake = par1NBTTagCompound.getByte("shake") & 255;
this.inGround = par1NBTTagCompound.getByte("inGround") == 1;
//dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? par1NBTTagCompound.getString("shooter") : "");
if (par1NBTTagCompound.hasKey("damage", 99)) {
this.damage = par1NBTTagCompound.getDouble("damage");
}
if (par1NBTTagCompound.hasKey("pickup", 99)) {
this.canBePickedUp = par1NBTTagCompound.getByte("pickup");
} else if (par1NBTTagCompound.hasKey("player", 99)) {
this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0;
}
}
@Override
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
{}
protected void onImpact(Entity entityHit)
{
if (!(shootingEntity instanceof EntityPlayer) || shootingEntity.isDead) return;
if (entityHit != null)
{
entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), 0.0F);
}
for (int i = 0; i < 32; ++i)
{
this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
}
if (!this.worldObj.isRemote)
{
if (this.shootingEntity != null && this.shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.shootingEntity;
if (entityplayermp.playerNetServerHandler.func_147362_b().isChannelOpen() && entityplayermp.worldObj == this.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event))
{ // Don't indent to lower patch size
if (this.shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity)null);
}
((EntityPlayer)shootingEntity).setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
shootingEntity.fallDistance = 0.0F;
if (((EntityPlayer) shootingEntity).getHealth() < 18) {
((EntityPlayer) shootingEntity).setHealth(0.5F);
shootingEntity.attackEntityFrom(DamageSource.fall, Float.MAX_VALUE);
LogHelper.info("Kill");
}else {
((EntityPlayer) shootingEntity).setHealth(((EntityPlayer) shootingEntity).getHealth() - 18);
shootingEntity.attackEntityFrom(DamageSource.fall, 0.5F);
}
}
}
}
}
this.setDead();
}
}
@@ -0,0 +1,58 @@
package com.brandon3055.draconicevolution.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
/**
* Created by Brandon on 15/08/2014.
*/
public class EntityPersistentItem extends EntityItem {
public EntityPersistentItem(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
this.isImmuneToFire = true;
this.lifespan = 72000;
}
public EntityPersistentItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack)
{
this(par1World, par2, par4, par6);
this.setEntityItemStack(par8ItemStack);
this.lifespan = 72000;
}
public EntityPersistentItem(World par1World)
{
super(par1World);
this.isImmuneToFire = true;
this.lifespan = 72000;
}
public EntityPersistentItem(World world, Entity original, ItemStack stack)
{
this(world, original.posX, original.posY, original.posZ);
this.delayBeforeCanPickup = 20;
this.motionX = original.motionX;
this.motionY = original.motionY;
this.motionZ = original.motionZ;
this.setEntityItemStack(stack);
this.lifespan = 72000;
}
@Override
public boolean attackEntityFrom (DamageSource par1DamageSource, float par2)
{
if (par1DamageSource.getDamageType().equals("outOfWorld"))
return true;
return false;
}
@Override
public void onUpdate() {
if (age+10 >= lifespan) age = 0;
super.onUpdate();
}
}
@@ -1,16 +1,17 @@
package com.brandon3055.draconicevolution.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemDE extends Item {
public String getUnwrappedUnlocalizedName(final String unlocalizedName)
{
public String getUnwrappedUnlocalizedName(final String unlocalizedName){
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
@@ -28,8 +29,17 @@ public class ItemDE extends Item {
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister iconRegister)
{
public void registerIcons(final IIconRegister iconRegister){
this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return false;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return null;//new EntityPersistentItem(world, location, itemstack);
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
import com.brandon3055.draconicevolution.common.items.tools.*;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.item.Item;
@@ -9,15 +10,6 @@ import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
import cpw.mods.fml.common.registry.GameRegistry;
import com.brandon3055.draconicevolution.common.items.tools.DraconicAxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicDistructionStaff;
import com.brandon3055.draconicevolution.common.items.tools.DraconicHoe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicShovel;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
import com.brandon3055.draconicevolution.common.items.tools.WyvernPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.WyvernShovel;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicSword;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
@@ -62,6 +54,7 @@ public class ModItems {
public static ItemDE draconicCore;
public static ItemDE sunFocus;
public static ItemDE mobSoul;
public static ItemDE enderArrow;
public static ItemDE teleporterMKI;
public static ItemDE teleporterMKII;
@@ -102,6 +95,7 @@ public class ModItems {
draconicCore = new DraconicCore();
sunFocus = new SunFocus();
mobSoul = new MobSoul();
enderArrow = new EnderArrow();
}
@@ -2,9 +2,9 @@ package com.brandon3055.draconicevolution.common.items.armor;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -12,8 +12,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -25,7 +23,6 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import org.lwjgl.input.Keyboard;
import sun.net.www.content.text.plain;
import java.util.List;
@@ -208,4 +205,14 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
"CIC",
'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernBoots);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.armor;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -17,14 +18,12 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import org.lwjgl.input.Keyboard;
import java.util.List;
@@ -180,4 +179,14 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor{
"PCP",
'I', ModItems.infusedCompound, 'D', Items.diamond_boots, 'C', ModItems.draconicCore, 'P', Blocks.piston);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,12 +1,19 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
@@ -17,15 +24,10 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import org.lwjgl.input.Keyboard;
import java.util.List;
public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
protected int capacity = References.DRACONICCAPACITY;
@@ -245,4 +247,14 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,10 +1,18 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import java.util.Set;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -23,20 +31,10 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
import java.util.Set;
public class DraconicDistructionStaff extends ItemTool implements IEnergyContainerItem {
public IIcon itemIcon0;
@@ -248,4 +246,14 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,12 +1,20 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -21,14 +29,8 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
@@ -214,4 +216,14 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack));
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,13 +1,21 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemPickaxe;
@@ -18,17 +26,9 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem{
public IIcon itemIcon0;
@@ -209,4 +209,14 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,13 +1,21 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemSpade;
@@ -18,17 +26,9 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
public IIcon itemIcon0;
@@ -209,4 +209,14 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -0,0 +1,38 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import java.util.List;
/**
* Created by Brandon on 15/08/2014.
*/
public class EnderArrow extends ItemDE {
public EnderArrow(){
this.setUnlocalizedName(Strings.enderArrowName);
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
ModItems.register(this);
}
@Override
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "ender_arrow");
}
@Override
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.arrowInfo.txt"));
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.arrowInfo0.txt"));
}
}
@@ -1,15 +1,22 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.Teleporter.Teleporter;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.ChatComponentText;
@@ -18,15 +25,8 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.Teleporter.Teleporter;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class TeleporterMKI extends ItemDE
{
@@ -184,4 +184,13 @@ public class TeleporterMKI extends ItemDE
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.teleporterMKI), "BDB", "DED", "BDB", 'D', ModItems.draconiumDust, 'E', Items.ender_eye, 'B', Items.blaze_powder);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,14 +1,23 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.common.core.Teleporter.Teleporter;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.ChatComponentText;
@@ -16,17 +25,8 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.Teleporter.Teleporter;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class TeleporterMKII extends ItemDE
{
@@ -187,4 +187,13 @@ public class TeleporterMKII extends ItemDE
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.teleporterMKII), "BIB", "DED", "BIB", 'D', ModItems.draconicCore, 'E', ModItems.teleporterMKI, 'B', ModItems.draconiumIngot, 'I', ModItems.infusedCompound);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,13 +1,21 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
@@ -18,17 +26,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
public IIcon itemIcon0;
@@ -201,6 +201,16 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,13 +1,21 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
@@ -18,17 +26,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
public IIcon itemIcon0;
@@ -200,5 +200,15 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
else
return 1F;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,8 +1,8 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import java.util.Random;
import com.brandon3055.draconicevolution.common.entity.EntityDraconicArrow;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
@@ -13,6 +13,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import java.util.Random;
public class BowHandler {
public static void standerdShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, float pullSpeedModifier, float speedModifier, boolean ignorSpeedWhenCalculatingDamage, double ignorSpeedCompensation, float soundPitchModifier, boolean isExplosive, int minRelease)
{
@@ -26,7 +28,7 @@ public class BowHandler {
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if (flag || player.inventory.hasItem(Items.arrow)) {
if (flag || player.inventory.hasItem(Items.arrow) || player.inventory.hasItem(ModItems.enderArrow)) {
float f = j / pullSpeedModifier;
f = (f * f + f * 2.0F) / 3.0F;
@@ -38,7 +40,13 @@ public class BowHandler {
f *= speedModifier;
EntityDraconicArrow entityArrow = new EntityDraconicArrow(stack, world, player, f * 2.0F);//.setShooter(player);
EntityDraconicArrow entityArrow;
if (player.inventory.hasItem(ModItems.enderArrow))
/*EntityEnderArrow*/ entityArrow = new EntityEnderArrow(world, player, f * 2.0F);
else
/*EntityDraconicArrow*/ entityArrow = new EntityDraconicArrow(world, player, f * 2.0F);
if (f >= 1.0F)
entityArrow.setIsCritical(true);
@@ -78,7 +86,10 @@ public class BowHandler {
entityArrow.canBePickedUp = 2;
else {
entityArrow.canBePickedUp = 1;
player.inventory.consumeInventoryItem(Items.arrow);
if (player.inventory.hasItem(ModItems.enderArrow))
player.inventory.consumeInventoryItem(ModItems.enderArrow);
else
player.inventory.consumeInventoryItem(Items.arrow);
}
if (!world.isRemote)
@@ -1,8 +1,16 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import java.util.List;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBow;
@@ -17,14 +25,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class DraconicBow extends ItemBow
{
@@ -64,7 +65,7 @@ public class DraconicBow extends ItemBow
return event.result;
}
if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow))
if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow) || player.inventory.hasItem(ModItems.enderArrow))
{
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
}
@@ -77,6 +78,7 @@ public class DraconicBow extends ItemBow
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender";
if (currentMode.equals("rapidfire"))
BowHandler.rapidFire(player, count, 4);
else if (currentMode.equals("sharpshooter"))
@@ -90,6 +92,7 @@ public class DraconicBow extends ItemBow
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (currentMode.equals("rapidfire"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 5F, 1.5F, true, 9D, 1F, false, 0);
else if (currentMode.equals("sharpshooter"))
@@ -138,6 +141,7 @@ public class DraconicBow extends ItemBow
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
int j = stack.getMaxItemUseDuration() - useRemaining;
if (usingItem == null)
return this.itemIcon;
@@ -203,4 +207,14 @@ public class DraconicBow extends ItemBow
{
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicBow), "ISI", "DBD", "ICI", 'B', ModItems.wyvernBow, 'D', ModItems.draconicCompound, 'S', ModItems.sunFocus, 'C', ModItems.draconicCore, 'I', ModItems.draconiumIngot);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,9 +1,16 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -13,14 +20,9 @@ import net.minecraft.item.ItemSword;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.world.World;
import java.util.List;
public class DraconicSword extends ItemSword implements IEnergyContainerItem{
protected int capacity = References.DRACONICCAPACITY;
@@ -135,4 +137,14 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack));
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.weapons;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
@@ -9,6 +10,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBow;
@@ -60,7 +62,7 @@ public class WyvernBow extends ItemBow {
return event.result;
}
if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow)) {
if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow) || player.inventory.hasItem(ModItems.enderArrow)) {
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
}
} else
@@ -72,6 +74,7 @@ public class WyvernBow extends ItemBow {
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender";
if (currentMode.equals("rapidfire"))
BowHandler.rapidFire(player, count, 18);
else if (currentMode.equals("sharpshooter"))
@@ -82,6 +85,7 @@ public class WyvernBow extends ItemBow {
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (currentMode.equals("rapidfire"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 19F, 1F, false, 0D, 1F, false, 0);
else if (currentMode.equals("sharpshooter"))
@@ -122,6 +126,7 @@ public class WyvernBow extends ItemBow {
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
int j = stack.getMaxItemUseDuration() - useRemaining;
if (usingItem == null) {
return this.itemIcon;
@@ -169,5 +174,15 @@ public class WyvernBow extends ItemBow {
{
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.wyvernBow), " I ", "CBC", " I ", 'C', ModItems.infusedCompound, 'B', Items.bow, 'I', ModItems.draconiumIngot);
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -1,9 +1,15 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import java.util.List;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -15,14 +21,9 @@ import net.minecraft.item.ItemSword;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.world.World;
import java.util.List;
public class WyvernSword extends ItemSword implements IEnergyContainerItem{
@@ -147,5 +148,15 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack));
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -52,4 +52,5 @@ public class Strings {// public sta
public static final String invisibleMultiblockName = "invisibleMultiblock";
public static final String energyPylonName = "energyPylon";
public static final String placedItemName = "placedItem";
public static final String enderArrowName = "enderArrow";
}