Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added missing tuyere recipe (closes #473). Made smithing not apply sk…
…ill to general type recipes.
  • Loading branch information
alcatrazEscapee committed Oct 5, 2019
1 parent 6394517 commit 403513f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/dries007/tfc/types/DefaultRecipes.java
Expand Up @@ -286,8 +286,9 @@ public static void onRegisterAnvilRecipeEvent(RegistryEvent.Register<AnvilRecipe
{
IForgeRegistry<AnvilRecipe> r = event.getRegistry();

// Basic Components
// Misc
addAnvil(r, DOUBLE_INGOT, SHEET, false, GENERAL, HIT_LAST, HIT_SECOND_LAST, HIT_THIRD_LAST);
addAnvil(r, TUYERE, DOUBLE_SHEET, true, GENERAL, BEND_LAST, BEND_SECOND_LAST);

// Tools
addAnvil(r, INGOT, PICK_HEAD, true, TOOLS, PUNCH_LAST, BEND_NOT_LAST, DRAW_NOT_LAST);
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/net/dries007/tfc/util/skills/SmithingSkill.java
Expand Up @@ -20,15 +20,19 @@ public class SmithingSkill extends Skill

public static void applySkillBonus(SmithingSkill skill, ItemStack stack, Type bonusType)
{
if (!stack.hasTagCompound())
// General types don't receive skill bonuses
if (bonusType != Type.GENERAL)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound nbt = stack.getTagCompound();
if (nbt != null)
{
nbt.setFloat(SKILL_VALUE, skill.getSkillSum() / 160f);
nbt.setInteger(SKILL_TYPE, bonusType.ordinal());
if (!stack.hasTagCompound())
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound nbt = stack.getTagCompound();
if (nbt != null)
{
nbt.setFloat(SKILL_VALUE, skill.getSkillSum() / 160f);
nbt.setInteger(SKILL_TYPE, bonusType.ordinal());
}
}
}

Expand Down Expand Up @@ -67,7 +71,7 @@ public static float getSkillBonus(ItemStack stack, @Nullable Type type)
return 0;
}

private int[] skillLevels = new int[4];
private final int[] skillLevels = new int[4];

public SmithingSkill(IPlayerData rootSkills)
{
Expand Down Expand Up @@ -100,7 +104,7 @@ public void setTotalLevel(double value)
{
value = 1;
}
//Evenly distribute value accordingly
// Evenly distribute value accordingly
for (Type smithType : Type.values())
{
skillLevels[smithType.ordinal()] = (int) (value * smithType.getMax());
Expand Down

0 comments on commit 403513f

Please sign in to comment.