mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
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:
1 parent
ae2d8d6e4d
commit
80efde613a
419 files changed
+2406
-4144
No files matched your search
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user