Skip to content

Commit

Permalink
Add bow and arrow stats to NEI for toolmaterials
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Nov 16, 2014
1 parent 08bdb07 commit 811ad87
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions resources/assets/tinker/lang/en_US.lang
Expand Up @@ -724,6 +724,7 @@ tconstruct.waila.subtanks=Subtanks:
tconstruct.waila.invalidstructure=Invalid structure

tconstruct.nei.toolmaterials=Tool Materials
tconstruct.nei.projectilematerials=Bow & Arrow
tconstruct.nei.alloying=Smeltery Alloying
tconstruct.nei.castingbasin=Casting Basin
tconstruct.nei.castingtable=Casting Table
Expand Down
Expand Up @@ -15,6 +15,8 @@
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.crafting.PatternBuilder.ItemKey;
import tconstruct.library.crafting.PatternBuilder.MaterialSet;
import tconstruct.library.tools.ArrowMaterial;
import tconstruct.library.tools.BowMaterial;
import tconstruct.library.tools.DynamicToolPart;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.HarvestLevels;
Expand All @@ -32,6 +34,8 @@ public class CachedToolMaterialsRecipe extends CachedBaseRecipe

public List<PositionedStack> toolParts;
public ToolMaterial material;
public BowMaterial bowMaterial;
public ArrowMaterial arrowMaterial;

public CachedToolMaterialsRecipe(List<ItemStack> toolParts, int materialID)
{
Expand All @@ -43,6 +47,17 @@ public CachedToolMaterialsRecipe(List<ItemStack> toolParts, int materialID)
this.material = TConstructRegistry.getMaterial(materialID);
}

public CachedToolMaterialsRecipe(List<ItemStack> toolParts, int materialID, boolean arrowBow)
{
this.toolParts = new ArrayList<PositionedStack>();
for (ItemStack stack : toolParts)
{
this.toolParts.add(new PositionedStack(stack, 10, 10));
}
this.arrowMaterial = TConstructRegistry.getArrowMaterial(materialID);
this.bowMaterial = TConstructRegistry.getBowMaterial(materialID);
}

@Override
public PositionedStack getIngredient ()
{
Expand Down Expand Up @@ -135,6 +150,23 @@ public void drawExtras (int recipe)
}
}
}
if (crecipe.bowMaterial != null)
{
int y = 20;
int x = 35;
GuiDraw.drawString(EnumChatFormatting.BOLD + StatCollector.translateToLocal("tconstruct.nei.projectilematerials"), 35, 10, 0x404040, false);
GuiDraw.drawString(StatCollector.translateToLocal("gui.toolstation6") + crecipe.bowMaterial.drawspeed, x, y, 0x404040, false);
y += 10;
GuiDraw.drawString(StatCollector.translateToLocal("gui.toolstation7") + crecipe.bowMaterial.flightSpeedMax, x, y, 0x404040, false);
}
if (crecipe.arrowMaterial != null)
{
int y = 50;
int x = 35;
GuiDraw.drawString(StatCollector.translateToLocal("gui.toolstation8") + crecipe.arrowMaterial.mass, x, y, 0x404040, false);
y += 10;
GuiDraw.drawString(StatCollector.translateToLocal("gui.toolstation22") + crecipe.arrowMaterial.breakChance, x, y, 0x404040, false);
}
}

@Override
Expand All @@ -146,6 +178,7 @@ public void loadCraftingRecipes (String outputId, Object... results)
for (int matID : TConstructRegistry.toolMaterials.keySet())
{
List<ItemStack> toolParts = new ArrayList<ItemStack>();

mat = TConstructRegistry.toolMaterials.get(matID);
for (ItemKey key : PatternBuilder.instance.materials)
{
Expand Down Expand Up @@ -178,8 +211,10 @@ public void loadCraftingRecipes (String outputId, Object... results)
}
}

if(toolParts.size() > 0)
if(toolParts.size() > 0) {
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, matID));
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, matID, true));
}
}
}
else
Expand All @@ -197,16 +232,20 @@ public void loadUsageRecipes (ItemStack ingred)
if (materialID >= 0)
{
List toolParts = getSingleList(ingred);
if(toolParts.size() > 0)
if(toolParts.size() > 0) {
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, materialID));
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, materialID, true));
}
}
}
else if (PatternBuilder.instance.getPartID(ingred) < Short.MAX_VALUE)
{
int materialID = PatternBuilder.instance.getPartID(ingred);
List toolParts = getSingleList(ingred);
if(toolParts.size() > 0)
if(toolParts.size() > 0) {
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, materialID));
this.arecipes.add(new CachedToolMaterialsRecipe(toolParts, materialID, true));
}
}
else
{
Expand Down

0 comments on commit 811ad87

Please sign in to comment.