Reorganize folders for modules

This commit is contained in:
mDiyo committed 2014-06-04 21:44:48 -08:00
1 parent 2c14f315de
commit e2f0558b6f
370 files changed
+4274 -4788

No files matched your search

@@ -1,99 +0,0 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorModTypeFilter;
import tconstruct.library.armor.EnumArmorPart;
//TODO: Condense attribute modifiers into one class
public class AModDamageBoost extends ArmorModTypeFilter
{
final boolean modifierType;
final int modifyAmount;
final double scaleAmount;
public AModDamageBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type, int modifiers, double scale)
{
super(effect, "ExoAttack" + (type ? "Percent" : "Flat"), armorTypes, items, values);
this.modifierType = type;
this.modifyAmount = modifiers;
this.scaleAmount = scale;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int amount = matchingAmount(input) * modifyAmount;
return tags.getInteger("Modifiers") >= amount;
}
@Override
public void modify (ItemStack[] input, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= matchingAmount(input) * modifyAmount;
armorTag.setInteger("Modifiers", modifiers);
int amount = matchingAmount(input);
if (armorTag.hasKey(key))
{
amount += armorTag.getInteger(key);
}
armorTag.setInteger(key, amount);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
attributes = baseTag.getTagList("AttributeModifiers", 10);
for (int iter = 0; iter < attributes.tagCount(); iter++)
{
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
if (tag.getString("AttributeName").equals("generic.attackDamage"))
{
attributes.removeTag(iter);
}
}
}
else
{
attributes = new NBTTagList();
baseTag.setTag("AttributeModifiers", attributes);
}
attributes.appendTag(getAttributeTag("generic.attackDamage", key, amount * scaleAmount, modifierType, getUUIDFromItem(armor)));
}
private static final UUID headScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c10");
private static final UUID chestScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c11");
private static final UUID pantsScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c12");
private static final UUID shoesScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c13");
private static final UUID headFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c14");
private static final UUID chestFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c15");
private static final UUID pantsFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c16");
private static final UUID shoesFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c17");
UUID getUUIDFromItem (ItemStack stack)
{
ArmorCore item = (ArmorCore) stack.getItem();
switch (item.armorPart)
{
case HELMET:
return modifierType ? headScale : headFlat;
case CHEST:
return modifierType ? chestScale : chestFlat;
case PANTS:
return modifierType ? pantsScale : pantsFlat;
case SHOES:
return modifierType ? shoesScale : pantsFlat;
}
return null;
}
}
@@ -1,73 +0,0 @@
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;
import net.minecraft.util.StatCollector;
public class AModDoubleJump extends AModInteger
{
public AModDoubleJump(ItemStack[] items)
{
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", StatCollector.translateToLocal("modifier.armour.jump.double"));
}
@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 + StatCollector.translateToLocal("modifier.armour.jump.triple");
if (tag.contains("Triple-Jump"))
return color + StatCollector.translateToLocal("modifier.armour.jump.quad");
return color + StatCollector.translateToLocal("modifier.armour.jump.double");
}
}
@@ -1,90 +0,0 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorModTypeFilter;
import tconstruct.library.armor.EnumArmorPart;
//TODO: Condense attribute modifiers into one class
public class AModHealthBoost extends ArmorModTypeFilter
{
final boolean modifierType;
final int modifyAmount = 3;
public AModHealthBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
{
super(effect, "ExoHealth" + (type ? "Percent" : "Flat"), armorTypes, items, values);
this.modifierType = type;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int amount = matchingItems(input) * modifyAmount;
return tags.getInteger("Modifiers") >= amount;
}
@Override
public void modify (ItemStack[] input, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= matchingAmount(input) * modifyAmount;
armorTag.setInteger("Modifiers", modifiers);
int amount = matchingAmount(input);
if (armorTag.hasKey(key))
{
amount += armorTag.getInteger(key);
}
armorTag.setInteger(key, amount);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
attributes = baseTag.getTagList("AttributeModifiers", 10);
for (int iter = 0; iter < attributes.tagCount(); iter++)
{
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
if (tag.getString("AttributeName").equals("generic.maxHealth"))
attributes.removeTag(iter);
}
}
else
{
attributes = new NBTTagList();
baseTag.setTag("AttributeModifiers", attributes);
}
attributes.appendTag(getAttributeTag("generic.maxHealth", key, amount, modifierType, getUUIDFromItem(armor)));
}
private static final UUID head = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab8");
private static final UUID chest = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab9");
private static final UUID pants = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6daba");
private static final UUID shoes = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dabb");
UUID getUUIDFromItem (ItemStack stack)
{
ArmorCore item = (ArmorCore) stack.getItem();
switch (item.armorPart)
{
case HELMET:
return head;
case CHEST:
return chest;
case PANTS:
return pants;
case SHOES:
return shoes;
}
return null;
}
}
@@ -1,6 +0,0 @@
package tconstruct.modifiers.armor;
public class AModJumpBoost
{
}
@@ -1,90 +0,0 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorModTypeFilter;
import tconstruct.library.armor.EnumArmorPart;
//TODO: Condense attribute modifiers into one class
public class AModKnockbackResistance extends ArmorModTypeFilter
{
final boolean modifierType;
final int modifyAmount = 2;
public AModKnockbackResistance(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
{
super(effect, "ExoKnockback" + (type ? "Percent" : "Flat"), armorTypes, items, values);
this.modifierType = type;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int amount = matchingItems(input) * modifyAmount;
return tags.getInteger("Modifiers") >= amount;
}
@Override
public void modify (ItemStack[] input, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= matchingAmount(input) * modifyAmount;
armorTag.setInteger("Modifiers", modifiers);
int amount = matchingAmount(input);
if (armorTag.hasKey(key))
{
amount += armorTag.getInteger(key);
}
armorTag.setInteger(key, amount);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
attributes = baseTag.getTagList("AttributeModifiers", 10);
for (int iter = 0; iter < attributes.tagCount(); iter++)
{
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
if (tag.getString("AttributeName").equals("generic.knockbackResistance"))
attributes.removeTag(iter);
}
}
else
{
attributes = new NBTTagList();
baseTag.setTag("AttributeModifiers", attributes);
}
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, amount * 0.01, modifierType, getUUIDFromItem(armor)));
}
private static final UUID head = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c44");
private static final UUID chest = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c45");
private static final UUID pants = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c46");
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
UUID getUUIDFromItem (ItemStack stack)
{
ArmorCore item = (ArmorCore) stack.getItem();
switch (item.armorPart)
{
case HELMET:
return head;
case CHEST:
return chest;
case PANTS:
return pants;
case SHOES:
return shoes;
}
return null;
}
}
@@ -1,88 +0,0 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorModTypeFilter;
import tconstruct.library.armor.EnumArmorPart;
public class AModMoveSpeed extends ArmorModTypeFilter
{
final boolean modifierType;
public AModMoveSpeed(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
{
super(effect, "ExoSpeed" + (type ? "Percent" : "Flat"), armorTypes, items, values);
this.modifierType = type;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int amount = matchingAmount(input);
return tags.getInteger("Modifiers") >= amount;
}
@Override
public void modify (ItemStack[] input, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
int amount = matchingAmount(input);
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= amount;
armorTag.setInteger("Modifiers", modifiers);
if (armorTag.hasKey(key))
{
amount += armorTag.getInteger(key);
}
armorTag.setInteger(key, amount);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
attributes = baseTag.getTagList("AttributeModifiers", 10);
for (int iter = 0; iter < attributes.tagCount(); iter++)
{
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
if (tag.getString("AttributeName").equals(key))
attributes.removeTag(iter);
}
}
else
{
attributes = new NBTTagList();
baseTag.setTag("AttributeModifiers", attributes);
}
attributes.appendTag(getAttributeTag("generic.movementSpeed", key, amount / 100d, modifierType, getUUIDFromItem(armor)));
}
private static final UUID head = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c730");
private static final UUID chest = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c731");
private static final UUID pants = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c732");
private static final UUID shoes = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c733");
UUID getUUIDFromItem (ItemStack stack)
{
ArmorCore item = (ArmorCore) stack.getItem();
switch (item.armorPart)
{
case HELMET:
return head;
case CHEST:
return chest;
case PANTS:
return pants;
case SHOES:
return shoes;
}
return null;
}
}
@@ -1,42 +0,0 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.ArmorModTypeFilter;
import tconstruct.library.armor.EnumArmorPart;
public class AModProtection extends ArmorModTypeFilter
{
int modifyAmount = 3;
public AModProtection(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values)
{
super(effect, "ExoProtection", armorTypes, items, values);
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
int amount = matchingItems(input) * modifyAmount;
return tags.getInteger("Modifiers") >= amount;
}
@Override
public void modify (ItemStack[] input, ItemStack armor)
{
NBTTagCompound baseTag = armor.getTagCompound();
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
int modifiers = armorTag.getInteger("Modifiers");
modifiers -= matchingItems(input) * modifyAmount;
armorTag.setInteger("Modifiers", modifiers);
int amount = matchingAmount(input);
double absorb = armorTag.getDouble("protection");
absorb += amount;
armorTag.setDouble("protection", absorb);
}
}