From 641c23e80d94fe5a30b31d24c7c4d21fc4d122f8 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Fri, 15 Aug 2014 12:04:08 +1000 Subject: [PATCH] Added ender arrow --- build.gradle | 2 +- .../common/blocks/PlacedItem.java | 27 +- .../common/core/handler/CraftingHandler.java | 2 +- .../common/core/proxy/CommonProxy.java | 8 +- .../common/entity/EntityDraconicArrow.java | 49 +- .../common/entity/EntityEnderArrow.java | 433 ++++++++++++++++++ .../common/entity/EntityPersistentItem.java | 58 +++ .../common/items/ItemDE.java | 26 +- .../common/items/ModItems.java | 12 +- .../common/items/armor/DraconicArmor.java | 15 +- .../common/items/armor/WyvernArmor.java | 13 +- .../common/items/tools/DraconicAxe.java | 30 +- .../items/tools/DraconicDistructionStaff.java | 38 +- .../common/items/tools/DraconicHoe.java | 32 +- .../common/items/tools/DraconicPickaxe.java | 32 +- .../common/items/tools/DraconicShovel.java | 32 +- .../common/items/tools/EnderArrow.java | 38 ++ .../common/items/tools/TeleporterMKI.java | 33 +- .../common/items/tools/TeleporterMKII.java | 37 +- .../common/items/tools/WyvernPickaxe.java | 32 +- .../common/items/tools/WyvernShovel.java | 32 +- .../common/items/weapons/BowHandler.java | 21 +- .../common/items/weapons/DraconicBow.java | 36 +- .../common/items/weapons/DraconicSword.java | 32 +- .../common/items/weapons/WyvernBow.java | 17 +- .../common/items/weapons/WyvernSword.java | 33 +- .../draconicevolution/common/lib/Strings.java | 1 + .../assets/draconicevolution/lang/en_US.lang | 3 + .../textures/items/ender_arrow.png | Bin 0 -> 3798 bytes 29 files changed, 934 insertions(+), 190 deletions(-) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java create mode 100644 src/main/resources/assets/draconicevolution/textures/items/ender_arrow.png diff --git a/build.gradle b/build.gradle index fdee2dda..0734da89 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-v0.9.4-Beta-pre1" +version = "1.7.10-v0.9.4-Beta-pre2" group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java index e76a7b6f..e0952e4c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java @@ -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; } + + } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/core/handler/CraftingHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/core/handler/CraftingHandler.java index 0df2af09..dd838b85 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/core/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/core/handler/CraftingHandler.java @@ -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); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/core/proxy/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/core/proxy/CommonProxy.java index 42e92d95..199ef4dc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/core/proxy/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/core/proxy/CommonProxy.java @@ -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); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java index 012b7183..180249f1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java @@ -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; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java new file mode 100644 index 00000000..e6fdca68 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java @@ -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(); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java new file mode 100644 index 00000000..d961f5f8 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java @@ -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(); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java index 04f34250..5fc82194 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ModItems.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ModItems.java index d12025bf..a13e9f0c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ModItems.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ModItems.java @@ -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(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java index a586e4d7..2c44f6ec 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java index e9d2d567..96f6f198 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java index e058fbe8..4b4abb2c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java index d812969b..e8bced0c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java index 5d99da7b..37d0acc9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java index 19e929ec..4cf108ed 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java index e75a78ff..37468ec6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java new file mode 100644 index 00000000..82512123 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java @@ -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")); + } +} + + diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java index b3086db0..3f228fc5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java index 56050ba5..375a1425 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java index 497b5b98..1cf5027a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java index fc094a67..2908301a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java index e6d31085..3bff85e6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java @@ -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) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java index 244c321f..c775d86e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java index d634b753..de78e479 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java index 4c3d29da..16005b4b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java index a27b69cf..5ca85ed7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java @@ -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); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java index 1509f778..4ce6ce6f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java @@ -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"; } diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index b5dbc506..2bceb3d8 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -54,6 +54,7 @@ item.draconicevolution:draconicLeggs.name=Draconic Leggings item.draconicevolution:draconicBoots.name=Draconic Boots item.draconicevolution:draconicDistructionStaff.name=Draconic Staff of Power item.draconicevolution:mobSoul.name=Mob Soul +item.draconicevolution:enderArrow.name=Ender Arrow //###################################Item Groups###################################// itemGroup.toolsAndWeapons=Draconic Evolution Tools & Weapons @@ -135,6 +136,8 @@ info.wyvernArmor.txt=Having enjoyed the protection of diamond for so long info.wyvernArmor1.txt=you realize that you can infuse it with the power of the Draconic info.draconicArmor.txt=Further Draconic research info.draconicArmor1.txt=has shown you ways to even greater protection +info.arrowInfo.txt=A Painful Ride +info.arrowInfo0.txt=Too heavy for a regular bow entity.DraconicEvolution.EnderDragon.name=Ender Dragon diff --git a/src/main/resources/assets/draconicevolution/textures/items/ender_arrow.png b/src/main/resources/assets/draconicevolution/textures/items/ender_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..a8dd891a10cda2663d9b955b29b4fd17c31de184 GIT binary patch literal 3798 zcmV;{4k_`8P)|D^_ww@lRz|vCuzLs)$;-`! zo*{AqUjza0dRV*yaMRE;fKCVhpQKsoe1Yhg01=zBIT!& zC1$=TK@rP|Ibo3vKKm@PqnO#LJhq6%Ij6Hz*<$V$@wQAMN5qJ)hzm2hoGcOF60t^# zFqJFfH{#e-4l@G)6iI9sa9D{VHW4w29}?su;^hF~NC{tY+*d5%WDCTXa!E_i;d2ub z1#}&jF5T4HnnCyEWTkKf0>c0%E1Ah>(_PY1)0w;+02c53Su*0<(nUqKG_|(0G&D0Z z{i;y^b@OjZ+}lNZ8Th$p5Uu}MTtq^NHl z*T1?CO*}7&0ztZsv2j*bmJyf3G7=Z`5B*PvzoDiKdLpOAxi2$L0#SX*@cY_n(^h55xYX z#km%V()bZjV~l{*bt*u9?FT3d5g^g~#a;iSZ@&02Abxq_DwB(I|L-^bXThc7C4-yr zInE_0gw7K3GZ**7&k~>k0Z0NWkO#^@9q0fwx1%qjZ=)yBuQ3=5 z4Wo^*!gyjLF-e%Um=erBOdIALW)L%unZshS@>qSW9o8Sq#0s#5*edK%>{;v(b^`kb zN5rY%%y90wC>#%$kE_5P!JWYk;U;klcqzOl-UjcFXXA75rT9jCH~u<)0>40zCTJ7v z2qAyk54cquI@7b&LHdZ`+zlTss6bJ7%PQ)z$cROu4wBhpu-r)01)S~6}jY?%U? zgEALn#wiFzo#H}aQ8rT=DHkadR18&{>P1bW7E`~Y4p3)hWn`DhhRJ5j*2tcg9i<^O zEt(fCg;q*CP8+7ZTcWhYX$fb^_9d-LhL+6BEtPYWVlfK zTBusSTASKKb%HuWJzl+By+?gkLq)?+BTu761jmyXF)a;mc z^>(B7bo*HQ1NNg1st!zt28YLv>W*y3CdWx9U8f|cqfXDAO`Q48?auQqHZJR2&bcD4 z9Ip>EY~kKEPV6Wm+eXFV)D)_R=tM0@&p?(!V*Qu1PXHG9o^TY0bZ?)4%0 z1p8F`JoeS|<@=<@RE7GY07EYX@lwd>4oW|Yi!o+Su@M`;WuSK8LKk71XR(_ zRKHM1xJ5XYX`fk>`6eqY>qNG6HZQwBM=xi4&Sb88?zd}EYguc1@>KIS<&CX#T35dw zS|7K*XM_5Nf(;WJJvJWRMA($P>8E^?{IdL4o5MGE7bq2MEEwP7v8AO@qL5!WvekBL z-8R%V?zVyL=G&{be=K4bT`e{#t|)$A!YaA?jp;X)-+bB;zhj`(vULAW%ue3U;av{9 z4wp%n<(7@__S@Z2PA@Mif3+uO&y|X06?J#o zSi8M;ejj_^(0<4Lt#wLu#dYrva1Y$6_o(k^&}yhSh&h;f@JVA>W8b%oZ=0JGnu?n~ z9O4}sJsfnnx7n(>`H13?(iXTy*fM=I`sj`CT)*pTHEgYKqqP+u1IL8No_-(u{qS+0 z<2@%BCt82d{Gqm;(q7a7b>wu+b|!X?c13m#p7cK1({0<`{-e>4hfb-UsyQuty7Ua; zOu?B?XLHZaol8GAb3Wnxcu!2v{R_`T4=x`(GvqLI{-*2AOSimkUAw*F_TX^n z@STz9kDQ$NC=!KfXWC z8h`dn#xL(D3Z9UkR7|Q&Hcy#Notk!^zVUSB(}`#4&lYA1f0h2V_PNgUAAWQEt$#LR zcH#y9#i!p(Udq2b^lI6wp1FXzN3T;~FU%Lck$-deE#qz9yYP3D3t8{6?<+s(e(3(_ z^YOu_)K8!O1p}D#{JO;G(*OVf24YJ`L;(K){{a7>y{D4^000SaNLh0L01sgR01sgS zs6VG^00007bV*G`2i^z|0UHP^+@<#b00bUML_t(|+U=S#OdD4i$A8ZOCw9Q@g`-v= zY0ZMEKmpQ$!7xOEg(xDGY85pSg${`-RkDgmq_!DY+N!Fh1}S3bQua<6(upl$V4^`p z6^Is`)Rrt<9G7rbFz`BrJGmA?2~hj)e1GX=pLFl;eLw%d?|r^IaOB95BS(%LIdbI4 zQ6);e>400Kqf!WgO9;M;#e~%XRK4kdzY+=ljK|s8+2PBZH|2Id&kuL*h>CH*$k33S zo1e$$^Rc~F$$DFEO(b&A%O79K4uAf=?g1!9Ym*z|qQUg-ru%jE#1*+Cq7VuO*0{C#PO586)> zTil}M(?I~1XJ(CKPM>c8AUi!{S_rN~4|KV3yWK|c%QLeKUi+AH(P8qLEcr~9&8JB= zpC+jaHBr;mA#DXf2*G>J&Bp%i$qA+w=U5q^AfL{>-1b1&t_bR?>FSVYuk^CE^atmn z!$$Bse`f$VQKwL?Dgaa~ezq4^OqU9-<2q4s@P%sVx@cMl92vk~wLeh)devUbV9`1+ z{k>tHWwM6dbycehP2*9PC#Fnk|6@&oYQ=8^t#3`^QHDdE_AP>i#jq;W1VBEMrJ?I0 z{(9Bu3APtk7z??1w@zi`$6tl*0O$|^bP#&r0AnFH4*IOq2w1g8-%i4*h~=0M&2wC%9?*>fKc`-Ty6-aSc}UE!89FN zxgeOTFE0lK)BQayH3U=MsVyZ0)84Ny6$Dd1xhVw%(?7cUzahBH4&bMIk3=&2g6`IO z9zI^<$@)4!f6*_cl%gU46hi1}3-Dke#gp}QrbaLCN-5n(1!1X2+1Cf!W#d~O9xSBj zX$$bqnKN99P98WW7z_&A0FY9O8&^Aaiy^!}^bH%DMy=P&hNhuu8Ua-`zW4R@30nZz zgK+xB)sE-KI=!zGEctHF>guZe zCzIjs_%KIxf@J|D5(yd`8`;kZ=P!@)c3mB*bee#w{>Kr;PO!8Ce2PLcnPlqw&kpSb z%R4{^v7Zx~Km6MG)eCEazDiu^>=ad4RGOv%kV>cVDGHI#WBhV=%xIQ++F&Fc7E(%a zK?rH-PH;a3)R*rZc)ea@|Er06B%b9A2ms=M;Nghx2b5DAnubqNsNDmgJK>XClZ3^=Yz+V~ma+l|^y*Hi2mrbh^ni5bb_7=#VH`A zJRzm@>ut2{0KBRu7@eLFJ3@%;t5yVC04Q{VRs^8pG(R^darFB77s>!PhyQ!E%K!iX M07*qoM6N<$g2wYIT>t<8 literal 0 HcmV?d00001