Skip to content

Commit

Permalink
Remove unused fletchling materials, and add a durability modifier to …
Browse files Browse the repository at this point in the history
…it. Basically the fletchling plays a huge role in your max-ammo now.
  • Loading branch information
bonii-xx committed Oct 19, 2014
1 parent e7454a5 commit 1194d60
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/library/TConstructRegistry.java
Expand Up @@ -464,9 +464,9 @@ public static void addBowstringMaterial (int materialID, int value, ItemStack in
customMaterials.add(mat);
}

public static void addFletchingMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance, float mass, float durabilityModifier, int color)
public static void addFletchingMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance, float durabilityModifier, int color)
{
FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, mass, durabilityModifier, color);
FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, durabilityModifier, color);
customMaterials.add(mat);
}

Expand Down
15 changes: 6 additions & 9 deletions src/main/java/tconstruct/library/tools/FletchingMaterial.java
Expand Up @@ -6,36 +6,33 @@ public class FletchingMaterial extends CustomMaterial
{
public final float accuracy;
public final float breakChance;
public final float mass;
public final float durabilityModifier;

public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance, float mass, float durabilityModifier, int color)
public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance, float duribalityModifier, int color)
{
super(materialID, value, input, craftingItem, color);
this.accuracy = accuracy;
this.breakChance = breakChance;
this.mass = mass;
this.durabilityModifier = durabilityModifier;
this.durabilityModifier = duribalityModifier;
}

@Deprecated
public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance, float mass)
{
this(materialID, value, input, craftingItem, accuracy, breakChance, mass, 1f, 0xffffffff);
this(materialID, value, input, craftingItem, accuracy, 0.01f, 1f, 0xffffffff);
}

public FletchingMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass, float durabilityModifier, int color)
public FletchingMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float duribalityModifier, int color)
{
super(materialID, value, oredict, craftingItem, color);
this.accuracy = accuracy;
this.breakChance = breakChance;
this.mass = mass;
this.durabilityModifier = durabilityModifier;
this.durabilityModifier = duribalityModifier;
}

@Deprecated
public FletchingMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass)
{
this(materialID, value, oredict, craftingItem, accuracy, breakChance, mass, 1f, 0xffffffff);
this(materialID, value, oredict, craftingItem, accuracy, 0.01f, 1f, 0xffffffff);
}
}
Expand Up @@ -6,9 +6,9 @@

public class FletchlingLeafMaterial extends FletchingMaterial
{
public FletchlingLeafMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass)
public FletchlingLeafMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float durabilityModifier)
{
super(materialID, value, oredict, craftingItem, accuracy, breakChance, mass, 1.6f, 0x5ece46);
super(materialID, value, oredict, craftingItem, accuracy, breakChance, durabilityModifier, 0x5ece46);
}

@Override
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/tconstruct/weaponry/TinkerWeaponry.java
Expand Up @@ -261,20 +261,20 @@ private void registerMaterials()
TConstructRegistry.addArrowMaterial(MaterialID.PigIron, 3.6F, 0.5F); //Pigiron

// Arrow Shaft Materials: Material ID, crafting item, durability-medifier, mass, fragility
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(0, Items.stick, 1.0f, 1.0f, 0.15f, 0x866526)); // wood: reference material, 10% break chance
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(1, Items.bone, 0.95f, 1.2f, 0.05f, 0xede6bf)); // bone: heavier, but durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(2, Items.reeds, 1.5f, 0.8f, 0.66f, 0xc7ff87)); // reed: light, but less durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(0, Items.stick, 1.0f, 1.0f, 0.15f, 0x866526)); // wood: reference material, 10% break chance
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(1, Items.bone, 0.95f, 1.4f, 0.02f, 0xede6bf)); // bone: heavier, but durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(2, Items.reeds, 1.5f, 0.5f, 0.66f, 0xc7ff87)); // reed: light, but less durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(3, Items.blaze_rod, 1.2f, 0.9f, 0.08f, 0xfff32d)); // blaze: tad lighter, tad more durable, fieryyyy
// also add the tool rod variants, same stats
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(0, TinkerTools.toolRod, MaterialID.Wood, 1.0f, 1.0f, 0.15f, 0x866526)); // wood: reference material, 10% break chance
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(1, TinkerTools.toolRod, MaterialID.Bone, 0.95f, 1.2f, 0.01f, 0xede6bf)); // bone: heavier, but durable

// Arrow Fletching Materials
TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Items.feather), new ItemStack(TinkerWeaponry.fletching, 1, 0), 95F, 0F, 0.05F, 1f, 0xffffff); // Feather
TConstructRegistry.addCustomMaterial(new FletchlingLeafMaterial(1, 2, "treeLeaves", new ItemStack(TinkerWeaponry.fletching, 1, 1), 75F, 0F, 0.2F)); // all vanilla and oredicted leaves. and all leaves in general.
TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(TinkerTools.materials, 1, 1), new ItemStack(TinkerWeaponry.fletching, 1, 2), 100F, 0F, 0.12F, 0.95f, 0x82c873); // Slime
TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(TinkerTools.materials, 1, 17), new ItemStack(TinkerWeaponry.fletching, 1, 3), 100F, 0F, 0.12F, 0.95f, 0x74c8c7); // BlueSlime
TConstructRegistry.addFletchingMaterial(4, 2, new ItemStack(TinkerWorld.slimeLeaves, 1, 0), new ItemStack(TinkerWeaponry.fletching, 1, 4), 98F, 0.03F, 0.08F, 1.2f, 0x74e8c7); // Slime leaves
TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Items.feather), new ItemStack(TinkerWeaponry.fletching, 1, 0), 95F, 0.05F, 1.0f, 0xffffff); // Feather
TConstructRegistry.addCustomMaterial(new FletchlingLeafMaterial(1, 2, "treeLeaves", new ItemStack(TinkerWeaponry.fletching, 1, 1), 75F, 0F, 2.5f)); // all vanilla and oredicted leaves. and all leaves in general.
TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(TinkerTools.materials, 1, 1), new ItemStack(TinkerWeaponry.fletching, 1, 2), 100F, 0.005F, 0.8f, 0x82c873); // Slime
TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(TinkerTools.materials, 1, 17), new ItemStack(TinkerWeaponry.fletching, 1, 3), 100F, 0.005F, 0.8f, 0x74c8c7); // BlueSlime
TConstructRegistry.addFletchingMaterial(4, 2, new ItemStack(TinkerWorld.slimeLeaves, 1, 0), new ItemStack(TinkerWeaponry.fletching, 1, 4), 98F, 0.02F, 1.4F, 0x74e8c7); // Slime leaves

// Bowstring Materials
TConstructRegistry.addBowstringMaterial(0, 2, new ItemStack(Items.string), new ItemStack(TinkerWeaponry.bowstring, 1, 0), 1F, 1F, 1f, 0xeeeeee); // String
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/tconstruct/weaponry/WeaponryHandler.java
Expand Up @@ -33,8 +33,8 @@ public void onAmmoCrafted(ToolCraftEvent.NormalTool event)
{
// arrows work like this:
// the head is responsible for the damage, but also adds weight
// the shaft defines how fragile the arrow is, and also adds to the weight a bit. But mostly it functions at the durability modifier
// the fletching defines the accuracy of the bow, adds a bit of durability and also breakchance
// the shaft defines how fragile the arrow is, and also adds to the weight a bit. But mostly the fragility.
// the fletching defines the accuracy of the arrow and adds a bit breakchance. Mostly there for the durability modifier because availability

// Shortbows work better with lighter arrows
// while Longbows require a bit heavier arrows, the lighter the arrow the more impact the accuracy has otherwise
Expand All @@ -51,7 +51,7 @@ public void onAmmoCrafted(ToolCraftEvent.NormalTool event)
if(fletching == null)
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);

int durability = (int)((float)head.durability() * shaft.durabilityModifier); // todo: fletching durability
int durability = (int)((float)head.durability() * shaft.durabilityModifier * fletching.durabilityModifier);
float weight = arrow.mass + shaft.weight/2f;
float accuracy = fletching.accuracy;
float breakChance = shaft.fragility + fletching.breakChance;
Expand All @@ -77,10 +77,10 @@ else if(event.tool instanceof BoltAmmo)
if(fletching == null)
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);

int durability = (int)((float)headMat.durability() * coreMat.handleDurability()); // todo: fletching durability
int durability = (int)((float)headMat.durability() * coreMat.handleDurability() * fletching.durabilityModifier);
float weight = head.mass + core.mass;
float accuracy = fletching.accuracy;
float breakChance = fletching.breakChance;
float breakChance = fletching.breakChance*3;

tags.setInteger("TotalDurability", durability);
tags.setFloat("Mass", weight);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/weaponry/entity/ArrowEntity.java
Expand Up @@ -32,7 +32,7 @@ protected double getStuckDepth() {

@Override
protected double getSlowdown() {
// todo: fletchling material of arrows impact
// we could use the fletchling material for the slowdown, hm
// note: not done because fletchlings also balance amount you get now. Rather use slowdown for different projectile types
return super.getSlowdown();
}
Expand Down

0 comments on commit 1194d60

Please sign in to comment.