Skip to content

Commit

Permalink
Fix Projectile Weapons and arrows/bolts building creative items with …
Browse files Browse the repository at this point in the history
…materials that have no bow/arrow material stats
  • Loading branch information
bonii-xx committed Oct 30, 2014
1 parent 3f74dd7 commit eb1a670
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java
@@ -1,6 +1,7 @@
package tconstruct.library.weaponry;

import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.BowMaterial;
import tconstruct.library.tools.BowstringMaterial;
import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.weaponry.entity.ArrowEntity;
Expand Down Expand Up @@ -136,6 +137,10 @@ public void playFiringSound(World world, EntityPlayer player, ItemStack weapon,
@Override
public void buildTool (int id, String name, List list)
{
// does the material have a bow material?
if(TConstructRegistry.getBowMaterial(id) == null)
return;

// all creative bows use regular bowstring
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // regular bowstring
ItemStack accessoryStack = getPartAmount() > 2 ? new ItemStack(getAccessoryItem(), 1, id) : null;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/tconstruct/weaponry/ammo/ArrowAmmo.java
Expand Up @@ -2,6 +2,7 @@

import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.ArrowMaterial;
import tconstruct.library.tools.CustomMaterial;
import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.FletchlingLeafMaterial;
Expand Down Expand Up @@ -97,6 +98,9 @@ public String[] getTraits ()
@Override
public void buildTool (int id, String name, List list)
{
if(TConstructRegistry.getArrowMaterial(id) == null)
return;

ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/tconstruct/weaponry/ammo/BoltAmmo.java
Expand Up @@ -82,6 +82,9 @@ public String[] getTraits ()
@Override
public void buildTool (int id, String name, List list)
{
if(TConstructRegistry.getArrowMaterial(id) == null)
return;

// dual material head: we use wooden shafts
ItemStack headStack = DualMaterialToolPart.createDualMaterial(getHeadItem(), 0, id); // wooden shaft, material head
ItemStack handleStack = new ItemStack(getAccessoryItem(), 1, 0); // feather Fletchling
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/weaponry/weapons/Crossbow.java
@@ -1,5 +1,6 @@
package tconstruct.weaponry.weapons;

import tconstruct.library.TConstructRegistry;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.weaponry.entity.BoltEntity;
Expand Down Expand Up @@ -415,6 +416,10 @@ public String[] getTraits() {
@Override
public void buildTool (int id, String name, List list)
{
// does the material have a bow material?
if(TConstructRegistry.getBowMaterial(id) == null)
return;

// all creative bows use regular bowstring
ItemStack headStack = new ItemStack(getHeadItem(), 1, id);
ItemStack handleStack = new ItemStack(getHandleItem(), 1, id);
Expand Down

0 comments on commit eb1a670

Please sign in to comment.