This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
forked from iguanaman/IguanaTweaksTConstruct
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a small chance to obtain stonebound on tools or jagged on weapons…
…. :3
- Loading branch information
Showing
2 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/iguanaman/iguanatweakstconstruct/leveling/modifiers/ModShoddy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package iguanaman.iguanatweakstconstruct.leveling.modifiers; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraft.util.StatCollector; | ||
import tconstruct.modifiers.tools.ModBoolean; | ||
|
||
// Shoddy handles Stonebound and Jagged. Jagged simply is negative Stonebound. | ||
public class ModShoddy extends ModBoolean { | ||
public static ModShoddy ModJagged = new ModShoddy("BonusJagged", EnumChatFormatting.RED.toString(), StatCollector.translateToLocal("materialtraits.jagged"), -0.5f); | ||
public static ModShoddy ModStonebound = new ModShoddy("BonusStonebound", EnumChatFormatting.AQUA.toString(), StatCollector.translateToLocal("materialtraits.stonebound"), 0.5f); | ||
|
||
protected float change; | ||
|
||
public ModShoddy(String tag, String c, String tip, float change) { | ||
super(new ItemStack[0], 0, tag, c, tip); | ||
|
||
this.change = change; | ||
} | ||
|
||
@Override | ||
protected boolean canModify(ItemStack tool, ItemStack[] input) { | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
|
||
// cannot apply jagged if we have stonebound | ||
if(tags.getFloat("Shoddy") > 0.0f && this.key.equals(ModJagged.key)) | ||
return false; | ||
|
||
// cannot apply stonebound if jagged | ||
if(tags.getFloat("Shoddy") < 0.0f && this.key.equals(ModStonebound.key)) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
|
||
@Override | ||
public void modify(ItemStack[] input, ItemStack tool) { | ||
super.modify(input, tool); | ||
|
||
// go make stonebound/jagged...y | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
tags.setFloat("Shoddy", tags.getFloat("Shoddy") + change); | ||
} | ||
|
||
// no visual effect :( | ||
@Override | ||
public void addMatchingEffect(ItemStack input) { | ||
} | ||
} |