mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -2,6 +2,7 @@ package tconstruct.modifiers.accessory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package tconstruct.modifiers.accessory;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.modifiers.tools.ItemModTypeFilter;
|
||||
|
||||
public class GloveSpeed extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max = 100;
|
||||
|
||||
@@ -24,8 +27,9 @@ public class GloveSpeed extends ItemModTypeFilter {
|
||||
if (!Arrays.asList(((AccessoryCore) input.getItem()).getTraits()).contains("glove")) return false;
|
||||
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max; // This line fails?
|
||||
if (!tags.hasKey(key)) return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max; // This
|
||||
// line
|
||||
// fails?
|
||||
|
||||
int[] keyPair = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(modifiers) <= keyPair[1]) return true;
|
||||
@@ -61,7 +65,7 @@ public class GloveSpeed extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", mods);
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(input, tooltipName, modName);
|
||||
keyPair = new int[] {increase, max, tooltipIndex};
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.armor.*;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class AModBoolean extends ArmorMod {
|
||||
|
||||
String color;
|
||||
String tooltipName;
|
||||
|
||||
@@ -24,8 +27,8 @@ public class AModBoolean extends ArmorMod {
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (!armorTypes.contains(item.armorPart)) return false;
|
||||
NBTTagCompound tags = getModifierTag(armor);
|
||||
return tags.getInteger("Modifiers") > 0
|
||||
&& !tags.getBoolean(key); // Will fail if the modifier is false or the tag doesn't exist
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); // Will fail if the modifier is false or the
|
||||
// tag doesn't exist
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,41 +1,31 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.armor.*;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class AModInteger extends ArmorMod {
|
||||
|
||||
String color;
|
||||
String tooltipName;
|
||||
int initialIncrease;
|
||||
int secondaryIncrease;
|
||||
|
||||
public AModInteger(
|
||||
int effect,
|
||||
String dataKey,
|
||||
EnumSet<ArmorPart> armorTypes,
|
||||
ItemStack[] items,
|
||||
int increase,
|
||||
String c,
|
||||
String tip) {
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase,
|
||||
String c, String tip) {
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
initialIncrease = secondaryIncrease = increase;
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
public AModInteger(
|
||||
int effect,
|
||||
String dataKey,
|
||||
EnumSet<ArmorPart> armorTypes,
|
||||
ItemStack[] items,
|
||||
int increase1,
|
||||
int increase2,
|
||||
String c,
|
||||
String tip) {
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase1,
|
||||
int increase2, String c, String tip) {
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
initialIncrease = increase1;
|
||||
secondaryIncrease = increase2;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.*;
|
||||
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
public class AModLeadBoots extends AModBoolean {
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
public class AModThaumicVision extends ArmorMod {
|
||||
|
||||
private final AModBoolean thaumicSensesMod;
|
||||
private final AModBoolean thaumicVisionMod;
|
||||
|
||||
private final Item thaumometer;
|
||||
|
||||
public AModThaumicVision(ItemStack thaumometer) {
|
||||
super(-1, "", EnumSet.of(ArmorPart.Head), new ItemStack[] {thaumometer});
|
||||
super(-1, "", EnumSet.of(ArmorPart.Head), new ItemStack[] { thaumometer });
|
||||
// super(effect, "Thaumic Vision", EnumSet.of(ArmorPart.Head), new ItemStack[]{},
|
||||
// EnumChatFormatting.DARK_PURPLE.toString(), "Thaumic Vision");
|
||||
|
||||
@@ -83,18 +86,15 @@ public class AModThaumicVision extends ArmorMod {
|
||||
// fix the effect display
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
int i = 1;
|
||||
for (; i <= 6; i++)
|
||||
if (tags.getInteger("Effect" + i) == -1) {
|
||||
tags.setInteger("Effect" + i, effect);
|
||||
break;
|
||||
}
|
||||
for (; i <= 6; i++) if (tags.getInteger("Effect" + i) == -1) {
|
||||
tags.setInteger("Effect" + i, effect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasThaumicSenses(ItemStack stack) {
|
||||
return stack != null
|
||||
&& stack.hasTagCompound()
|
||||
&& stack.getTagCompound()
|
||||
.getCompoundTag(TinkerArmor.travelGoggles.getBaseTagName())
|
||||
return stack != null && stack.hasTagCompound()
|
||||
&& stack.getTagCompound().getCompoundTag(TinkerArmor.travelGoggles.getBaseTagName())
|
||||
.getBoolean(thaumicSensesMod.key);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,17 +5,19 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.armor.*;
|
||||
import tconstruct.library.modifier.*;
|
||||
|
||||
public class ActiveTinkerArmor extends ActiveArmorMod {
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack, ArmorCore armor, ArmorPart type) {
|
||||
if (!itemStack.hasTagCompound()) return;
|
||||
NBTTagCompound tag =
|
||||
itemStack.getTagCompound().getCompoundTag(((IModifyable) itemStack.getItem()).getBaseTagName());
|
||||
NBTTagCompound tag = itemStack.getTagCompound()
|
||||
.getCompoundTag(((IModifyable) itemStack.getItem()).getBaseTagName());
|
||||
if (tag == null) return;
|
||||
if (tag.hasKey("Moss")) {
|
||||
int chance = tag.getInteger("Moss");
|
||||
@@ -36,20 +38,21 @@ public class ActiveTinkerArmor extends ActiveArmorMod {
|
||||
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++)
|
||||
{
|
||||
EntityItem entity = (EntityItem) list.get(k);
|
||||
entity.onCollideWithPlayer(player);
|
||||
}*/
|
||||
/*
|
||||
* 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++) {
|
||||
* EntityItem entity = (EntityItem) list.get(k); entity.onCollideWithPlayer(player); }
|
||||
*/
|
||||
}
|
||||
if (type == ArmorPart.Chest) {
|
||||
if (player.isSneaking() && tag.getBoolean("Stealth"))
|
||||
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 2, 0, true));
|
||||
|
||||
/*int sprintboost = tag.getInteger("Sprint Assist");
|
||||
if (player.isSprinting() && sprintboost > 0)
|
||||
player.moveEntityWithHeading(-player.moveStrafing * 0.1f * sprintboost, player.moveForward * 0.2F * sprintboost); //Max of 0-1*/
|
||||
/*
|
||||
* int sprintboost = tag.getInteger("Sprint Assist"); if (player.isSprinting() && sprintboost > 0)
|
||||
* player.moveEntityWithHeading(-player.moveStrafing * 0.1f * sprintboost, player.moveForward * 0.2F *
|
||||
* sprintboost); //Max of 0-1
|
||||
*/
|
||||
}
|
||||
if (type == ArmorPart.Feet) {
|
||||
if (player.isInWater()) {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.armor.*;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
public class TravelModDoubleJump extends ArmorMod {
|
||||
|
||||
String color = "\u00a77";
|
||||
String tooltipName = "Double-Jump";
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package tconstruct.modifiers.armor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public abstract class ItemModTypeFilter extends ItemModifier {
|
||||
|
||||
public final List<Integer> increase;
|
||||
|
||||
public ItemModTypeFilter(int effect, String dataKey, ItemStack[] items, int[] values) {
|
||||
@@ -16,11 +19,11 @@ public abstract class ItemModTypeFilter extends ItemModifier {
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks to see if the inputs match the stored items
|
||||
* Note: Filters types, doesn't care about amount
|
||||
/**
|
||||
* Checks to see if the inputs match the stored items Note: Filters types, doesn't care about amount
|
||||
*
|
||||
* @param input The ItemStacks to compare against
|
||||
* @param tool Item to modify, used for restrictions
|
||||
* @param tool Item to modify, used for restrictions
|
||||
* @return Whether the recipe matches the input
|
||||
*/
|
||||
@Override
|
||||
@@ -64,15 +67,15 @@ public abstract class ItemModTypeFilter extends ItemModifier {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/** Adds a new itemstack to the list for increases
|
||||
/**
|
||||
* Adds a new itemstack to the list for increases
|
||||
*
|
||||
* @param stack ItemStack to compare against
|
||||
* @param stack ItemStack to compare against
|
||||
* @param amount Amount to increase
|
||||
*/
|
||||
public void addStackToMatchList(ItemStack stack, int amount) {
|
||||
if (stack == null)
|
||||
throw new NullPointerException(
|
||||
"ItemStack added to " + this.getClass().getSimpleName() + " cannot be null.");
|
||||
if (stack == null) throw new NullPointerException(
|
||||
"ItemStack added to " + this.getClass().getSimpleName() + " cannot be null.");
|
||||
stacks.add(stack);
|
||||
increase.add(amount);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
@@ -13,6 +15,7 @@ import tconstruct.library.weaponry.IAmmo;
|
||||
import tconstruct.weaponry.weapons.Shuriken;
|
||||
|
||||
public class ModAmmoRestock extends ItemModifier {
|
||||
|
||||
public ModAmmoRestock() {
|
||||
super(new ItemStack[0], 0, "");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ModAntiSpider extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max = 4;
|
||||
String guiType;
|
||||
@@ -54,7 +55,7 @@ public class ModAntiSpider extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a72" + guiType + " (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] {increase, max, tooltipIndex};
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModAttack extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max;
|
||||
int threshold;
|
||||
@@ -37,8 +40,8 @@ public class ModAttack extends ItemModTypeFilter {
|
||||
}
|
||||
|
||||
// gloves
|
||||
public ModAttack(
|
||||
String type, int effect, ItemStack[] items, int[] value, int max, int threshold, String modifierType) {
|
||||
public ModAttack(String type, int effect, ItemStack[] items, int[] value, int max, int threshold,
|
||||
String modifierType) {
|
||||
super(effect, "ModAttack", items, value);
|
||||
tooltipName = "\u00a7fKnuckles";
|
||||
guiType = type;
|
||||
@@ -112,7 +115,7 @@ public class ModAttack extends ItemModTypeFilter {
|
||||
int increase = matchingAmount(input);
|
||||
String modName = "\u00a7f" + guiType + " (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] {increase, max, tooltipIndex};
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
int attack = tags.getInteger("Attack");
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ModAutoSmelt extends ModBoolean {
|
||||
protected boolean canModify(ItemStack tool, ItemStack[] input) {
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Silk Touch")) return false;
|
||||
return tags.getInteger("Modifiers") > 0
|
||||
&& !tags.getBoolean(key); // Will fail if the modifier is false or the tag doesn't exist
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); // Will fail if the modifier is false or the
|
||||
// tag doesn't exist
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModBlaze extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max;
|
||||
|
||||
@@ -58,7 +61,7 @@ public class ModBlaze extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a76Blaze (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] {increase, max, tooltipIndex};
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class ModBoolean extends ItemModifier {
|
||||
|
||||
String color;
|
||||
String tooltipName;
|
||||
|
||||
@@ -19,8 +21,8 @@ public class ModBoolean extends ItemModifier {
|
||||
@Override
|
||||
protected boolean canModify(ItemStack tool, ItemStack[] input) {
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
return tags.getInteger("Modifiers") > 0
|
||||
&& !tags.getBoolean(key); // Will fail if the modifier is false or the tag doesn't exist
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); // Will fail if the modifier is false or the
|
||||
// tag doesn't exist
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.enchantment.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.*;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModButtertouch extends ModBoolean {
|
||||
@@ -57,7 +59,7 @@ public class ModButtertouch extends ModBoolean {
|
||||
}
|
||||
|
||||
public void addEnchantment(ItemStack tool, Enchantment enchant, int level) // TODO: Move this to ItemModifier
|
||||
{
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
Map<Integer, Integer> enchantMap = EnchantmentHelper.getEnchantments(tool);
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = enchantMap.entrySet().iterator();
|
||||
|
||||
@@ -2,10 +2,12 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModCreativeToolModifier extends ItemModifier {
|
||||
|
||||
public ModCreativeToolModifier(ItemStack[] items) {
|
||||
super(items, 0, "");
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class ModDurability extends ItemModifier {
|
||||
|
||||
String tooltipName;
|
||||
String color;
|
||||
int durability;
|
||||
|
||||
@@ -2,9 +2,11 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.*;
|
||||
|
||||
public class ModExtraModifier extends ItemModifier {
|
||||
|
||||
public ModExtraModifier(ItemStack[] items, String dataKey) {
|
||||
super(items, 0, dataKey);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
/* TE3 support */
|
||||
|
||||
public class ModFlux extends ModBoolean {
|
||||
|
||||
public ArrayList<ItemStack> batteries = new ArrayList<>();
|
||||
public int modifiersRequired = 1; // LALALALA totally not hidden IguanaTweaks Support LALALALA
|
||||
|
||||
@@ -28,17 +31,16 @@ public class ModFlux extends ModBoolean {
|
||||
|
||||
ItemStack foundBattery = null;
|
||||
// try to find the battery in the input
|
||||
for (ItemStack stack : input)
|
||||
for (ItemStack battery : batteries) {
|
||||
if (stack == null) continue;
|
||||
if (stack.getItem() != battery.getItem()) continue;
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem)) continue;
|
||||
// we don't allow multiple batteries to be added
|
||||
if (foundBattery != null) return false;
|
||||
for (ItemStack stack : input) for (ItemStack battery : batteries) {
|
||||
if (stack == null) continue;
|
||||
if (stack.getItem() != battery.getItem()) continue;
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem)) continue;
|
||||
// we don't allow multiple batteries to be added
|
||||
if (foundBattery != null) return false;
|
||||
|
||||
// battery found, gogogo
|
||||
foundBattery = stack;
|
||||
}
|
||||
// battery found, gogogo
|
||||
foundBattery = stack;
|
||||
}
|
||||
|
||||
// no battery present
|
||||
if (foundBattery == null) return false;
|
||||
@@ -46,10 +48,11 @@ public class ModFlux extends ModBoolean {
|
||||
int maxEnergy = ((IEnergyContainerItem) foundBattery.getItem()).getMaxEnergyStored(foundBattery);
|
||||
|
||||
// battery too big for our tool?
|
||||
if (PHConstruct.balancedFluxModifier
|
||||
&& tags.getInteger("TotalDurability")
|
||||
< maxEnergy / 1000) // durability needs to be at least 1/1000th of the charge
|
||||
return false;
|
||||
if (PHConstruct.balancedFluxModifier && tags.getInteger("TotalDurability") < maxEnergy / 1000) // durability
|
||||
// needs to be at
|
||||
// least 1/1000th
|
||||
// of the charge
|
||||
return false;
|
||||
|
||||
// check if we already have a flux modifier
|
||||
if (tags.getBoolean(key)) {
|
||||
@@ -83,15 +86,14 @@ public class ModFlux extends ModBoolean {
|
||||
|
||||
// find the battery in the input
|
||||
ItemStack inputBattery = null;
|
||||
for (ItemStack stack : input)
|
||||
for (ItemStack battery : batteries) {
|
||||
if (stack == null) continue;
|
||||
if (stack.getItem() != battery.getItem()) continue;
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem)) continue;
|
||||
for (ItemStack stack : input) for (ItemStack battery : batteries) {
|
||||
if (stack == null) continue;
|
||||
if (stack.getItem() != battery.getItem()) continue;
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem)) continue;
|
||||
|
||||
// we're guaranteed to only find one battery because more are prevented above
|
||||
inputBattery = stack;
|
||||
}
|
||||
// we're guaranteed to only find one battery because more are prevented above
|
||||
inputBattery = stack;
|
||||
}
|
||||
|
||||
// get the energy interface
|
||||
IEnergyContainerItem energyContainer = (IEnergyContainerItem) inputBattery.getItem();
|
||||
|
||||
@@ -2,11 +2,13 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class ModInteger extends ItemModifier {
|
||||
|
||||
String color;
|
||||
String tooltipName;
|
||||
int initialIncrease;
|
||||
@@ -19,8 +21,8 @@ public class ModInteger extends ItemModifier {
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
public ModInteger(
|
||||
ItemStack[] items, int effect, String dataKey, int increase1, int increase2, String c, String tip) {
|
||||
public ModInteger(ItemStack[] items, int effect, String dataKey, int increase1, int increase2, String c,
|
||||
String tip) {
|
||||
super(items, effect, dataKey);
|
||||
initialIncrease = increase1;
|
||||
secondaryIncrease = increase2;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.enchantment.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.*;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModLapis extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max = 450;
|
||||
|
||||
@@ -43,7 +46,7 @@ public class ModLapis extends ItemModTypeFilter {
|
||||
|
||||
String modName = "\u00a79Lapis (0/450)";
|
||||
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
|
||||
int[] keyPair = new int[] {0, tooltipIndex};
|
||||
int[] keyPair = new int[] { 0, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModPiston extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max = 10;
|
||||
|
||||
@@ -57,7 +60,7 @@ public class ModPiston extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a74Knockback (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] {increase, max, tooltipIndex};
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ package tconstruct.modifiers.tools;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class ModPotion extends ItemModifier {
|
||||
|
||||
public ModPotion(ItemStack[] items, int effect, String dataKey) {
|
||||
super(new ItemStack[] {new ItemStack(Items.potionitem, 1, Short.MAX_VALUE)}, 0, "");
|
||||
super(new ItemStack[] { new ItemStack(Items.potionitem, 1, Short.MAX_VALUE) }, 0, "");
|
||||
}
|
||||
|
||||
protected boolean canModify(ItemStack tool, ItemStack[] input) {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModRedstone extends ItemModTypeFilter {
|
||||
|
||||
public String tooltipName;
|
||||
public int max = 50;
|
||||
|
||||
@@ -63,7 +66,7 @@ public class ModRedstone extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
keyPair = new int[] {increase, max, tooltipIndex};
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
current = keyPair[0];
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
@@ -80,7 +83,7 @@ public class ModRedstone extends ItemModTypeFilter {
|
||||
miningSpeed += (increase * boost);
|
||||
tags.setInteger("MiningSpeed", miningSpeed);
|
||||
|
||||
String[] type = {"MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra"};
|
||||
String[] type = { "MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra" };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (tags.hasKey(type[i])) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.*;
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ModSmite extends ItemModTypeFilter {
|
||||
|
||||
String tooltipName;
|
||||
int max = 36;
|
||||
String tagName;
|
||||
@@ -54,7 +55,7 @@ public class ModSmite extends ItemModTypeFilter {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a7e" + tagName + " (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] {increase, max, tooltipIndex};
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
@@ -2,11 +2,14 @@ package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModWindup extends ModRedstone {
|
||||
|
||||
public ModWindup(int effect, ItemStack[] items, int[] values) {
|
||||
super(effect, items, values);
|
||||
}
|
||||
@@ -52,7 +55,7 @@ public class ModWindup extends ModRedstone {
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
keyPair = new int[] {increase, max, tooltipIndex};
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
current = keyPair[0];
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user