The return of achievements

- Re-added achievements
- Organised all imports (seemed all over the place)
- Formatted all code (seemed very combined, used the TinkerStyle)
This commit is contained in:
Arthur Uzulin committed 2014-09-09 18:30:15 +10:00
1 parent ae2d8d6e4d
commit 80efde613a
419 files changed
+2406 -4144

No files matched your search

@@ -1,8 +1,8 @@
package tconstruct.modifiers.accessory;
import tconstruct.library.modifier.ItemModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.ItemModifier;
/* Adds a boolean NBTTag */
@@ -18,7 +18,7 @@ public class GloveClimb extends ItemModifier
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("TinkerAccessory");
return tags.getInteger("Modifiers") >= 3 && !tags.getBoolean(key);
return tags.getInteger("Modifiers") >= 3 && !tags.getBoolean(key);
}
@Override
@@ -1,13 +1,9 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorMod;
import tconstruct.library.armor.ArmorPart;
import tconstruct.library.armor.*;
/* Adds a boolean NBTTag */
@@ -39,7 +35,7 @@ public class AModBoolean extends ArmorMod
@Override
public void modify (ItemStack[] recipe, ItemStack input)
{
NBTTagCompound tags =getModifierTag(input);
NBTTagCompound tags = getModifierTag(input);
tags.setBoolean(key, true);
@@ -1,11 +1,9 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.ArmorMod;
import tconstruct.library.armor.ArmorPart;
import tconstruct.library.armor.*;
/* Adds an integer NBTTag */
@@ -1,11 +1,8 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import java.util.UUID;
import java.util.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.*;
import tconstruct.library.armor.ArmorPart;
public class AModLeadBoots extends AModBoolean
@@ -29,7 +26,7 @@ public class AModLeadBoots extends AModBoolean
armorTag.setInteger("Modifiers", modifiers);
addToolTip(armor, color + tooltipName, color + key);
NBTTagList attributes;
if (baseTag.hasKey("AttributeModifiers"))
{
@@ -48,5 +45,6 @@ public class AModLeadBoots extends AModBoolean
}
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, 0.4, true, shoes));
}
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
}
@@ -3,15 +3,12 @@ package tconstruct.modifiers.armor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.*;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.armor.ArmorPart;
import tconstruct.library.modifier.ActiveArmorMod;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.armor.*;
import tconstruct.library.modifier.*;
public class ActiveTinkerArmor extends ActiveArmorMod
{
@@ -27,7 +24,7 @@ public class ActiveTinkerArmor extends ActiveArmorMod
{
int current = tag.getInteger("Damage");
if (current > 0)
tag.setInteger("Damage", current-1);
tag.setInteger("Damage", current - 1);
}
}
if (type == ArmorPart.Head)
@@ -38,7 +35,7 @@ public class ActiveTinkerArmor extends ActiveArmorMod
if (tag.getBoolean("Night Vision"))
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0, true));
}
/*List list = world.getEntitiesWithinAABB(EntityItem.class, player.boundingBox.addCoord(0.0D, 0.0D, 0.0D).expand(5.0D, 5.0D, 5.0D)); //TODO: Add modifier code
for (int k = 0; k < list.size(); k++)
{
@@ -1,17 +1,16 @@
package tconstruct.modifiers.armor;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.armor.ArmorMod;
import tconstruct.library.armor.ArmorPart;
import tconstruct.library.armor.*;
import tconstruct.library.modifier.IModifyable;
public class TravelModDoubleJump extends ArmorMod
{
String color = "\u00a77";
String tooltipName = "Double-Jump";
public TravelModDoubleJump(EnumSet<ArmorPart> armorTypes, ItemStack[] items)
{
super(0, "Double-Jump", armorTypes, items);
@@ -45,7 +44,7 @@ public class TravelModDoubleJump extends ArmorMod
addToolTip(input, color + tooltipName, color + key);
}
@Override
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
{
@@ -88,10 +87,10 @@ public class TravelModDoubleJump extends ArmorMod
if (tag.contains("Quadruple-Jump"))
return color + "Quintuple-Jump";
if (tag.contains("Quintuple-Jump"))
return color + "Sextuple-Jump";
if (tag.contains("Sextuple-Jump"))
return color + "Septuple-Jump";
@@ -46,8 +46,6 @@ public class TravelModRepair extends ItemModifier
}
return false;
}
private int calculateIncrease (ItemStack tool, NBTTagCompound tags, int materialValue, int itemsUsed)
{
@@ -1,8 +1,6 @@
package tconstruct.modifiers.tools;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import net.minecraft.item.ItemStack;
import tconstruct.library.modifier.ItemModifier;
@@ -23,7 +23,7 @@ public class ModAntiSpider extends ItemModTypeFilter
if (!tags.hasKey(key))
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
int keyPair[] = tags.getIntArray(key);
@@ -21,7 +21,7 @@ public class ModAttack extends ItemModTypeFilter
threshold = 24;
modifierType = "Tool";
}
public ModAttack(String type, int effect, ItemStack[] items, int[] value, int max, int threshold, String modifierType)
{
super(effect, "ModAttack", items, value);
@@ -41,7 +41,7 @@ public class ModAttack extends ItemModTypeFilter
if (!validType(toolItem))
return false;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(toolItem.getBaseTagName());
@@ -57,7 +57,7 @@ public class ModAttack extends ItemModTypeFilter
}
return false;
}
@Override
public boolean validType (IModifyable input)
{
@@ -1,8 +1,6 @@
package tconstruct.modifiers.tools;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
@@ -28,7 +26,7 @@ public class ModBlaze extends ItemModTypeFilter
if (!validType(toolItem))
return false;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
@@ -1,17 +1,10 @@
package tconstruct.modifiers.tools;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import tconstruct.library.tools.ToolCore;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import java.util.*;
import net.minecraft.enchantment.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.*;
import tconstruct.library.tools.ToolCore;
public class ModButtertouch extends ModBoolean
{
@@ -2,8 +2,7 @@ package tconstruct.modifiers.tools;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.modifier.ItemModifier;
import tconstruct.library.modifier.*;
public class ModExtraModifier extends ItemModifier
{
@@ -1,13 +1,10 @@
package tconstruct.modifiers.tools;
import cofh.api.energy.IEnergyContainerItem;
import java.util.ArrayList;
import tconstruct.library.tools.ToolCore;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
/* TE3 support */
@@ -28,17 +25,17 @@ public class ModFlux extends ModBoolean
ItemStack foundBattery = null;
// try to find the battery in the input
for(ItemStack stack : input)
for(ItemStack battery : batteries)
for (ItemStack stack : input)
for (ItemStack battery : batteries)
{
if(stack == null)
if (stack == null)
continue;
if(stack.getItem() != battery.getItem())
if (stack.getItem() != battery.getItem())
continue;
if(!(stack.getItem() instanceof IEnergyContainerItem))
if (!(stack.getItem() instanceof IEnergyContainerItem))
continue;
// we don't allow multiple batteries to be added
if(foundBattery != null)
if (foundBattery != null)
return false;
// battery found, gogogo
@@ -46,20 +43,20 @@ public class ModFlux extends ModBoolean
}
// no battery present
if(foundBattery == null)
if (foundBattery == null)
return false;
// check if we already have a flux modifier
if(tags.getBoolean(key))
if (tags.getBoolean(key))
{
// only allow if it's an upgrade
// remark: we use the ToolCores function here instead of accessing the tag directly, to achieve backwards compatibility with tools without tags.
int a = ((IEnergyContainerItem)foundBattery.getItem()).getMaxEnergyStored(foundBattery);
int b = ((ToolCore)tool.getItem()).getMaxEnergyStored(tool);
return ((IEnergyContainerItem)foundBattery.getItem()).getMaxEnergyStored(foundBattery) > ((ToolCore)tool.getItem()).getMaxEnergyStored(tool);
int a = ((IEnergyContainerItem) foundBattery.getItem()).getMaxEnergyStored(foundBattery);
int b = ((ToolCore) tool.getItem()).getMaxEnergyStored(tool);
return ((IEnergyContainerItem) foundBattery.getItem()).getMaxEnergyStored(foundBattery) > ((ToolCore) tool.getItem()).getMaxEnergyStored(tool);
}
// otherwise check if we have enough modfiers
else if(tags.getInteger("Modifiers") < modifiersRequired)
else if (tags.getInteger("Modifiers") < modifiersRequired)
return false;
// all requirements satisfied!
@@ -72,7 +69,8 @@ public class ModFlux extends ModBoolean
NBTTagCompound tags = tool.getTagCompound();
// update modifiers (only applies if it's not an upgrade)
if(!tags.hasKey(key)) {
if (!tags.hasKey(key))
{
int modifiers = tags.getCompoundTag("InfiTool").getInteger("Modifiers");
modifiers -= modifiersRequired;
tags.getCompoundTag("InfiTool").setInteger("Modifiers", modifiers);
@@ -81,17 +79,16 @@ public class ModFlux extends ModBoolean
tags.getCompoundTag("InfiTool").setBoolean(key, true);
// find the battery in the input
ItemStack inputBattery = null;
for(ItemStack stack : input)
for(ItemStack battery : batteries)
for (ItemStack stack : input)
for (ItemStack battery : batteries)
{
if(stack == null)
if (stack == null)
continue;
if(stack.getItem() != battery.getItem())
if (stack.getItem() != battery.getItem())
continue;
if(!(stack.getItem() instanceof IEnergyContainerItem))
if (!(stack.getItem() instanceof IEnergyContainerItem))
continue;
// we're guaranteed to only find one battery because more are prevented above
@@ -99,13 +96,13 @@ public class ModFlux extends ModBoolean
}
// get the energy interface
IEnergyContainerItem energyContainer = (IEnergyContainerItem)inputBattery.getItem();
IEnergyContainerItem energyContainer = (IEnergyContainerItem) inputBattery.getItem();
// set the charge values
int charge = energyContainer.getEnergyStored(inputBattery);
// add already present charge in the tool
if(tags.hasKey("Energy"))
if (tags.hasKey("Energy"))
charge += tags.getInteger("Energy");
int maxCharge = energyContainer.getMaxEnergyStored(inputBattery);
@@ -113,7 +110,8 @@ public class ModFlux extends ModBoolean
int progress = 0, change = 1; // prevent endless loops with creative battery, blah
// fill the battery full
while(progress < maxCharge && change > 0) {
while (progress < maxCharge && change > 0)
{
change = energyContainer.receiveEnergy(subject42, 100000, false);
progress += change;
}
@@ -123,8 +121,10 @@ public class ModFlux extends ModBoolean
subject42 = inputBattery.copy();
// completely empty the battery
progress = 0; change = 1;
while(progress < maxCharge && change > 0) {
progress = 0;
change = 1;
while (progress < maxCharge && change > 0)
{
change = energyContainer.extractEnergy(subject42, 100000, false);
progress += change;
}
@@ -1,15 +1,9 @@
package tconstruct.modifiers.tools;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import java.util.*;
import net.minecraft.enchantment.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.*;
import tconstruct.library.tools.ToolCore;
public class ModLapis extends ItemModTypeFilter
@@ -32,7 +26,7 @@ public class ModLapis extends ItemModTypeFilter
if (!validType(toolItem))
return false;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
@@ -1,8 +1,6 @@
package tconstruct.modifiers.tools;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
@@ -27,7 +25,7 @@ public class ModPiston extends ItemModTypeFilter
if (!validType(toolItem))
return false;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
@@ -1,10 +1,7 @@
package tconstruct.modifiers.tools;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.*;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
@@ -28,7 +25,7 @@ public class ModRedstone extends ItemModTypeFilter
if (!validType(toolItem))
return false;
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
@@ -4,8 +4,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.modifier.ItemModifier;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.tools.*;
/* Little mod for actually adding the lapis modifier */
@@ -19,7 +19,7 @@ public class ModSmite extends ItemModTypeFilter
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
if(matchingAmount(input) > max)
if (matchingAmount(input) > max)
return false;
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");