Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
227 additions
and
53 deletions.
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
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
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
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
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
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
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
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,60 @@ | ||
package tconstruct.library.armor; | ||
|
||
import java.util.EnumSet; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
/* Adds an integer NBTTag */ | ||
|
||
public class AModInteger extends ArmorMod | ||
{ | ||
public final int modifyCount; | ||
public final int amount; | ||
public final String color; | ||
public final String tooltipName; | ||
|
||
public AModInteger(int effect, String dataKey, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int count, int increase, String c, String tip) | ||
{ | ||
super(effect, dataKey, armorTypes, items); | ||
this.modifyCount = count; | ||
this.amount = increase; | ||
color = c; | ||
tooltipName = tip; | ||
} | ||
|
||
@Override | ||
protected boolean canModify (ItemStack armor, ItemStack[] input) | ||
{ | ||
ArmorCore item = (ArmorCore) armor.getItem(); | ||
if (armorTypes.contains(item.armorPart)) | ||
{ | ||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName()); | ||
return tags.getInteger("Modifiers") >= modifyCount; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public void modify (ItemStack[] input, ItemStack tool) | ||
{ | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName()); | ||
if (tags.hasKey(key)) | ||
{ | ||
int increase = tags.getInteger(key); | ||
increase += this.amount; | ||
tags.setInteger(key, increase); | ||
} | ||
else | ||
{ | ||
tags.setInteger(key, amount); | ||
} | ||
|
||
int modifiers = tags.getInteger("Modifiers"); | ||
modifiers -= modifyCount; | ||
tags.setInteger("Modifiers", modifiers); | ||
|
||
addToolTip(tool, color + tooltipName, color + key); | ||
} | ||
|
||
} |
4 changes: 1 addition & 3 deletions
4
...t/modifiers/armor/ArmorModTypeFilter.java → ...uct/library/armor/ArmorModTypeFilter.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
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
Oops, something went wrong.