Skip to content

Commit

Permalink
Change quartz to be less effective on projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Nov 18, 2014
1 parent 5d0a151 commit 7372d0a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/main/java/tconstruct/modifiers/tools/ModAttack.java
Expand Up @@ -3,6 +3,9 @@
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
{
Expand All @@ -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);
Expand All @@ -20,8 +25,22 @@ public ModAttack(String type, int effect, ItemStack[] items, int[] value)
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);
Expand All @@ -30,11 +49,18 @@ public ModAttack(String type, int effect, ItemStack[] items, int[] value, int ma
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();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/tconstruct/weaponry/TinkerWeaponry.java
Expand Up @@ -24,6 +24,7 @@
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;
Expand Down Expand Up @@ -102,11 +103,15 @@ public void init(FMLInitializationEvent event)
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());
}

Expand Down

0 comments on commit 7372d0a

Please sign in to comment.