Fix Projectile Weapons and arrows/bolts building creative items with materials that have no bow/arrow material stats

This commit is contained in:
Bernhard Bonigl committed 2014-10-30 22:34:56 +01:00
1 parent 3f74dd7535
commit eb1a6701de
4 files changed
+17

No files matched your search

@@ -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;
@@ -136,6 +137,10 @@ public abstract class BowBaseAmmo extends ProjectileWeapon {
@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;
@@ -2,6 +2,7 @@ package tconstruct.weaponry.ammo;
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;
@@ -97,6 +98,9 @@ public class ArrowAmmo extends AmmoItem {
@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
@@ -82,6 +82,9 @@ public class BoltAmmo extends AmmoItem {
@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
@@ -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;
@@ -415,6 +416,10 @@ public class Crossbow extends ProjectileWeapon {
@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);