Add a creative bolt that's used for shooting crossbows without ammo in creative, just like the vanilla arrows for the bows #1233

This commit is contained in:
Bernhard Bonigl committed 2015-02-22 17:50:59 +01:00
1 parent e972ee1ef0
commit 67c05a962b
2 files changed
+22

No files matched your search

@@ -77,6 +77,7 @@ public class TinkerWeaponry {
// Ammo
public static AmmoItem arrowAmmo;
public static AmmoItem boltAmmo;
public static ItemStack creativeBolt;
// Tool Parts
public static Item bowstring;
@@ -142,6 +143,21 @@ public class TinkerWeaponry {
MinecraftForge.EVENT_BUS.register(weaponryHandler);
FMLCommonHandler.instance().bus().register(weaponryHandler);
// "vanilla" bolt:
// iron-tipped wood-shaft with feather fletching
ItemStack headStack = DualMaterialToolPart.createDualMaterial(boltAmmo.getHeadItem(), TinkerTools.MaterialID.Wood, TinkerTools.MaterialID.Iron);
ItemStack handleStack = new ItemStack(boltAmmo.getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(headStack, handleStack, null, null, "");
if (tool != null)
{
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
creativeBolt = tool;
}
else
TConstruct.logger.error("Couldn't build basic Tinker Bolt for creative crossbow shootnig");
proxy.init();
}
@@ -1,5 +1,8 @@
package tconstruct.weaponry.weapons;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Items;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.weaponry.TinkerWeaponry;
@@ -261,6 +264,9 @@ public class Crossbow extends ProjectileWeapon {
return stack;
}
if(player.capabilities.isCreativeMode && TinkerWeaponry.creativeBolt != null)
return TinkerWeaponry.creativeBolt.copy();
return null;
}