mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 21:20:06 +00:00
Throwing knives now crit when they're aimed long enough
This commit is contained in:
1 parent
d57f8b64a8
commit
40a2e91943
4 files changed
+12
-6
No files matched your search
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user