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
15 changed files
with
198 additions
and
20 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
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
72 changes: 72 additions & 0 deletions
72
src/main/java/tconstruct/modifiers/armor/AModDoubleJump.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,72 @@ | ||
package tconstruct.modifiers.armor; | ||
|
||
import java.util.EnumSet; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import tconstruct.library.armor.AModInteger; | ||
import tconstruct.library.armor.ArmorCore; | ||
import tconstruct.library.armor.EnumArmorPart; | ||
|
||
public class AModDoubleJump extends AModInteger | ||
{ | ||
public AModDoubleJump(ItemStack[] items) | ||
{ | ||
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", "Double-Jump"); | ||
} | ||
|
||
@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 && tags.getInteger("Double-Jump") < 3; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip) | ||
{ | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName()); | ||
int tipNum = 0; | ||
while (true) | ||
{ | ||
tipNum++; | ||
String tip = "Tooltip" + tipNum; | ||
if (!tags.hasKey(tip)) | ||
{ | ||
tags.setString(tip, tooltip); | ||
String modTip = "ModifierTip" + tipNum; | ||
tags.setString(modTip, modifierTip); | ||
return tipNum; | ||
} | ||
else | ||
{ | ||
String tag = tags.getString(tip); | ||
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump")) | ||
{ | ||
tags.setString(tip, getProperName(tooltip, tag)); | ||
String modTip = "ModifierTip" + tipNum; | ||
tag = tags.getString(modTip); | ||
tags.setString(modTip, getProperName(modifierTip, tag)); | ||
return tipNum; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected String getProperName (String tooltip, String tag) | ||
{ | ||
if (tag.contains("Double-Jump")) | ||
return color+"Triple-Jump"; | ||
|
||
if (tag.contains("Triple-Jump")) | ||
return color+"Quadruple-Jump"; | ||
|
||
return color+"Double-Jump"; | ||
} | ||
} |
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,6 @@ | ||
package tconstruct.modifiers.armor; | ||
|
||
public class AModJumpBoost | ||
{ | ||
|
||
} |
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