mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
Move the drawspeed calculation to the tool building, so the saved values are the actual values instead of calculating them every time
This commit is contained in:
1 parent
db7e4196db
commit
ff7c6c17fc
5 files changed
+15
-21
No files matched your search
@@ -4,9 +4,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import tconstruct.weaponry.client.CrosshairType;
|
||||
import tconstruct.util.Reference;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -91,11 +89,9 @@ public abstract class ProjectileWeapon extends ToolCore implements IAccuracy, IW
|
||||
/* Windup */
|
||||
public int getWindupTime(ItemStack itemStack) {
|
||||
NBTTagCompound toolTag = itemStack.getTagCompound().getCompoundTag("InfiTool");
|
||||
return (int)((float)toolTag.getInteger("DrawSpeed")*windupModifier(itemStack));
|
||||
return toolTag.getInteger("DrawSpeed");
|
||||
}
|
||||
|
||||
protected float windupModifier(ItemStack itemStack) { return 1.0f; }
|
||||
|
||||
public float getWindupProgress(ItemStack itemStack, EntityPlayer player)
|
||||
{
|
||||
// what are you doing!
|
||||
|
||||
@@ -17,6 +17,8 @@ import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.event.ToolBuildEvent;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.weaponry.weapons.LongBow;
|
||||
import tconstruct.weaponry.weapons.ShortBow;
|
||||
|
||||
public class WeaponryHandler {
|
||||
// Provides ammo-items with the necessary NBT
|
||||
@@ -97,6 +99,7 @@ public class WeaponryHandler {
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = event.toolTag.getCompoundTag("InfiTool");
|
||||
ProjectileWeapon weapon = (ProjectileWeapon)event.tool;
|
||||
|
||||
int drawSpeed = 0;
|
||||
float flightSpeed = 0;
|
||||
@@ -112,6 +115,13 @@ public class WeaponryHandler {
|
||||
|
||||
drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2f * string.drawspeedModifier);
|
||||
flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax)/2 * string.flightSpeedModifier;
|
||||
|
||||
// SHORT bows have a SHORTER windup because they're SHORT. hahahaha.... get it?
|
||||
if(event.tool instanceof ShortBow)
|
||||
drawSpeed *= 0.9;
|
||||
// longbows have LONGER drawspeed. LOGIC!
|
||||
if(event.tool instanceof LongBow)
|
||||
drawSpeed *= 1.5f;
|
||||
}
|
||||
else if(event.tool instanceof Crossbow)
|
||||
{
|
||||
@@ -120,6 +130,10 @@ public class WeaponryHandler {
|
||||
|
||||
drawSpeed = (int) ((float)top.drawspeed * string.drawspeedModifier);
|
||||
flightSpeed = (top.flightSpeedMax * string.flightSpeedModifier);
|
||||
|
||||
// crossbows are more efficient the higher the base drawspeed is. So the higher the drawspeed, the more bonus you get
|
||||
drawSpeed *= 2.5f;
|
||||
drawSpeed -= drawSpeed*0.25f;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
@@ -49,12 +49,6 @@ public class Crossbow extends ProjectileWeapon {
|
||||
return ItemStack.loadItemStackFromNBT(tags.getCompoundTag("LoadedItem"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWindupTime(ItemStack itemStack) {
|
||||
NBTTagCompound toolTag = itemStack.getTagCompound().getCompoundTag("InfiTool");
|
||||
return (int)((float)toolTag.getInteger("DrawSpeed") * 2.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinWindupProgress(ItemStack itemStack) {
|
||||
return 1.0f;
|
||||
|
||||
@@ -31,11 +31,6 @@ public class LongBow extends BowBaseAmmo {
|
||||
return 1.7f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float windupModifier(ItemStack itemStack) {
|
||||
return 1.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float projectileSpeedModifier(ItemStack itemStack) {
|
||||
return 1.5f;
|
||||
|
||||
@@ -15,11 +15,6 @@ public class ShortBow extends BowBaseAmmo {
|
||||
super(0, "Shortbow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float windupModifier(ItemStack itemStack) {
|
||||
return 0.9f; // SHORT bows have a SHORTER windup because they're SHORT. hahahaha.... get it?
|
||||
}
|
||||
|
||||
@Override
|
||||
public float minAccuracy(ItemStack itemStack) {
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user