Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Add missing tags for new weapons when replacing parts
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Dec 22, 2014
1 parent 3cab31e commit 1780b0a
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@
import tconstruct.library.modifier.ItemModifier;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.weaponry.IAmmo;
import tconstruct.modifiers.tools.ModAttack;
import tconstruct.modifiers.tools.ModRedstone;
import tconstruct.tools.logic.ToolStationLogic;
Expand Down Expand Up @@ -113,13 +114,25 @@ public static void exchangeToolPart(ToolCore tool, NBTTagCompound tags, PartType
updateTag(newTags, tags, "HarvestLevelHandle");
updateTag(newTags, tags, "HarvestLevelExtra");

// bows have additional tags to consider
// ranged weapons have have additional tags to consider
updateTag(newTags, tags, "DrawSpeed");
updateTag(newTags, tags, "BaseDrawSpeed");
updateTag(newTags, tags, "FlightSpeed");
updateTag(newTags, tags, "Mass");
updateTag(newTags, tags, "BreakChance");
updateTag(newTags, tags, "Accuracy");

// stonebound. Shoddy is always present and never changed, we can simply update it.
updateTag(newTags, tags, "Shoddy");

// update ammo
if(tool instanceof IAmmo)
{
IAmmo ammo = (IAmmo)tool;
if(ammo.getAmmoCount(toolStack) > ammo.getMaxAmmo(toolStack))
ammo.setAmmo(ammo.getMaxAmmo(toolStack), toolStack);
}

// reinforced is kinda complicated, since the actual level you get out of the materials is complicated
// simply calculate difference between current and newly built tool to know how much has been added afterwards
int currentReinforced = tags.getInteger("Unbreaking");
Expand Down

0 comments on commit 1780b0a

Please sign in to comment.