diff --git a/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java b/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java index 026749be..fac9cc28 100644 --- a/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java +++ b/src/main/java/tconstruct/library/weaponry/AmmoWeapon.java @@ -106,7 +106,7 @@ public abstract class AmmoWeapon extends AmmoItem implements IAccuracy, IWindup ItemStack reference = stack.copy(); reference.stackSize = 1; reference.getTagCompound().getCompoundTag("InfiTool").setInteger("Ammo", 1); - Entity projectile = createProjectile(reference, world, player, getAccuracy(stack, time)); + Entity projectile = createProjectile(reference, world, player, getAccuracy(stack, time), time); world.spawnEntityInWorld(projectile); } @@ -115,7 +115,7 @@ public abstract class AmmoWeapon extends AmmoItem implements IAccuracy, IWindup this.consumeAmmo(1, stack); } - protected abstract Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy); + protected abstract Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy, int time); /** used for displaying the damage, return the value used for pseed in createProjectile/ProjectileBase constructor */ diff --git a/src/main/java/tconstruct/weaponry/weapons/Javelin.java b/src/main/java/tconstruct/weaponry/weapons/Javelin.java index 936c8b44..3510e921 100644 --- a/src/main/java/tconstruct/weaponry/weapons/Javelin.java +++ b/src/main/java/tconstruct/weaponry/weapons/Javelin.java @@ -174,7 +174,7 @@ public class Javelin extends AmmoWeapon { } @Override - protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy) { + protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy, int time) { reference.getTagCompound().getCompoundTag("InfiTool").removeTag("Throwing"); // needed so the NBTs are equal JavelinEntity entity = new JavelinEntity(world, player, getProjectileSpeed(), accuracy, reference); diff --git a/src/main/java/tconstruct/weaponry/weapons/Shuriken.java b/src/main/java/tconstruct/weaponry/weapons/Shuriken.java index d0bf8328..b8912f78 100644 --- a/src/main/java/tconstruct/weaponry/weapons/Shuriken.java +++ b/src/main/java/tconstruct/weaponry/weapons/Shuriken.java @@ -128,7 +128,7 @@ public class Shuriken extends AmmoWeapon { } @Override - protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy) { + protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy, int time) { return new ShurikenEntity(world, player, getProjectileSpeed(), 0f, reference); } diff --git a/src/main/java/tconstruct/weaponry/weapons/ThrowingKnife.java b/src/main/java/tconstruct/weaponry/weapons/ThrowingKnife.java index f1d0205c..862939e1 100644 --- a/src/main/java/tconstruct/weaponry/weapons/ThrowingKnife.java +++ b/src/main/java/tconstruct/weaponry/weapons/ThrowingKnife.java @@ -1,6 +1,7 @@ package tconstruct.weaponry.weapons; import net.minecraft.client.entity.EntityPlayerSP; +import tconstruct.library.entity.ProjectileBase; import tconstruct.weaponry.client.CrosshairType; import tconstruct.weaponry.entity.ThrowingKnifeEntity; import tconstruct.library.weaponry.AmmoWeapon; @@ -77,8 +78,13 @@ public class ThrowingKnife extends AmmoWeapon { } @Override - protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy) { - return new ThrowingKnifeEntity(world, player, getProjectileSpeed(), accuracy, reference); + protected Entity createProjectile(ItemStack reference, World world, EntityPlayer player, float accuracy, int time) { + ProjectileBase knife = new ThrowingKnifeEntity(world, player, getProjectileSpeed(), accuracy, reference); + // if you aim long enough, it's a crit! + if(time >= this.getWindupTime(reference)*1.5f) + knife.setIsCritical(true); + + return knife; } @Override