Change quartz to be less effective on projectiles

This commit is contained in:
Bernhard Bonigl committed 2014-11-18 19:40:23 +01:00
1 parent 5d0a151947
commit 7372d0af89
2 files changed
+31

No files matched your search

@@ -3,6 +3,9 @@ package tconstruct.modifiers.tools;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.ToolCore;
import java.util.Arrays;
public class ModAttack extends ItemModTypeFilter
{
@@ -11,7 +14,9 @@ public class ModAttack extends ItemModTypeFilter
int threshold;
String guiType;
String modifierType;
boolean ammoOnly;
// Regular weapons
public ModAttack(String type, int effect, ItemStack[] items, int[] value)
{
super(effect, "ModAttack", items, value);
@@ -20,8 +25,22 @@ public class ModAttack extends ItemModTypeFilter
max = 72;
threshold = 24;
modifierType = "Tool";
ammoOnly = false;
}
// projectiles
public ModAttack(String type, int effect, ItemStack[] items, int[] value, boolean ammoOnly)
{
super(effect, "ModAttack", items, value);
tooltipName = "\u00a7fSharpness";
guiType = type;
max = 48;
threshold = 24;
modifierType = "Tool";
this.ammoOnly = ammoOnly;
}
// gloves
public ModAttack(String type, int effect, ItemStack[] items, int[] value, int max, int threshold, String modifierType)
{
super(effect, "ModAttack", items, value);
@@ -30,11 +49,18 @@ public class ModAttack extends ItemModTypeFilter
this.max = max;
this.threshold = threshold;
this.modifierType = modifierType;
ammoOnly = false;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
if(tool.getItem() instanceof ToolCore)
{
if(Arrays.asList(((ToolCore) tool.getItem()).getTraits()).contains("ammo") != ammoOnly)
return false;
}
if (tool.getItem() instanceof IModifyable)
{
IModifyable toolItem = (IModifyable) tool.getItem();
@@ -24,6 +24,7 @@ import tconstruct.library.tools.DynamicToolPart;
import tconstruct.library.tools.FletchlingLeafMaterial;
import tconstruct.library.util.IPattern;
import tconstruct.library.util.IToolPart;
import tconstruct.modifiers.tools.ModAttack;
import tconstruct.modifiers.tools.ModWindup;
import tconstruct.modifiers.tools.ModAmmoRestock;
import tconstruct.smeltery.TinkerSmeltery;
@@ -102,11 +103,15 @@ public class TinkerWeaponry {
registerBoltCasting();
setupCreativeTab();
// Modifiers
ItemStack redstoneItem = new ItemStack(Items.redstone);
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
ModifyBuilder.registerModifier(new ModWindup(2, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
ModifyBuilder.registerModifier(new ModAmmoRestock());
TinkerTools.modAttack = new ModAttack("Quartz", 11, new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1, 4 }, true);
ModifyBuilder.registerModifier(TinkerTools.modAttack);
TConstructRegistry.registerActiveToolMod(new WeaponryActiveToolMod());
}