mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
Add vanilla critical behaviour to the tinker bows (critical if fully drawn)
This commit is contained in:
1 parent
c42f99cba7
commit
f3f31bc045
5 files changed
+12
-9
No files matched your search
@@ -110,7 +110,7 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy) {
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy, float windup) {
|
||||
EntityArrow arrow;
|
||||
|
||||
if(arrows.getItem() == Items.arrow) {
|
||||
@@ -126,6 +126,9 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
|
||||
if(player.capabilities.isCreativeMode)
|
||||
arrow.canBePickedUp = 2;
|
||||
|
||||
if(windup >= 1f)
|
||||
arrow.setIsCritical(true);
|
||||
|
||||
return arrow;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class ProjectileWeapon extends ToolCore implements IAccuracy, IW
|
||||
* @param accuracy the accuracy calculated for the projectile
|
||||
* @return A banana.
|
||||
*/
|
||||
protected abstract Entity createProjectile(ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy);
|
||||
protected abstract Entity createProjectile(ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy, float windup);
|
||||
|
||||
|
||||
/* Accuracy */
|
||||
@@ -177,7 +177,7 @@ public abstract class ProjectileWeapon extends ToolCore implements IAccuracy, IW
|
||||
// take windup time into account
|
||||
projectileSpeed *= windup;
|
||||
|
||||
Entity projectile = createProjectile(ammo, world, player, projectileSpeed, accuracy);
|
||||
Entity projectile = createProjectile(ammo, world, player, projectileSpeed, accuracy, windup);
|
||||
|
||||
|
||||
int reinforced = 0;
|
||||
|
||||
@@ -216,7 +216,7 @@ public class Crossbow extends ProjectileWeapon {
|
||||
float windup = getWindupTime(weapon); // max windup time
|
||||
float accuracy = getAccuracy(weapon, (int)windup);
|
||||
|
||||
Entity projectile = createProjectile(ammo, world, player, projectileSpeed, accuracy);
|
||||
Entity projectile = createProjectile(ammo, world, player, projectileSpeed, accuracy, 1.0f);
|
||||
|
||||
int reinforced = 0;
|
||||
|
||||
@@ -256,7 +256,7 @@ public class Crossbow extends ProjectileWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity createProjectile(ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy) {
|
||||
protected Entity createProjectile(ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy, float windup) {
|
||||
EntityArrow arrow;
|
||||
|
||||
ItemStack reference = ammo.copy();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LongBow extends BowBaseAmmo {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy) {
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy, float windup) {
|
||||
if(arrows.getItem() instanceof ArrowAmmo)
|
||||
{
|
||||
// modify accuraccy of the arrow depending on its accuraccy and weight
|
||||
@@ -46,7 +46,7 @@ public class LongBow extends BowBaseAmmo {
|
||||
accuracy = 0;
|
||||
}
|
||||
|
||||
return super.createProjectile(arrows, world, player, speed, accuracy);
|
||||
return super.createProjectile(arrows, world, player, speed, accuracy, windup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ShortBow extends BowBaseAmmo {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy) {
|
||||
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy, float windup) {
|
||||
if(arrows.getItem() instanceof ArrowAmmo)
|
||||
{
|
||||
// modify accuraccy of the arrow depending on its accuraccy and weight
|
||||
@@ -40,7 +40,7 @@ public class ShortBow extends BowBaseAmmo {
|
||||
accuracy = 0;
|
||||
}
|
||||
|
||||
return super.createProjectile(arrows, world, player, speed, accuracy);
|
||||
return super.createProjectile(arrows, world, player, speed, accuracy, windup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user