summaryrefslogtreecommitdiff
path: root/src/main/java/gmail/Lance5057/modifiers
diff options
context:
space:
mode:
authorLance5057 <Lance5057@gmail.com>2015-10-05 00:02:32 -0500
committerLance5057 <Lance5057@gmail.com>2015-10-15 04:54:18 -0500
commitd67ec64707414df6f78f45ec1710b4ec3fc1ef66 (patch)
tree6a926cb12990aa88cb62e8ec099045f5b54fd8b1 /src/main/java/gmail/Lance5057/modifiers
parentadefc630eb6876c19660c4f51876cc9bf00d78f0 (diff)
Refactor and Compartmentalize all the codes!
Diffstat (limited to 'src/main/java/gmail/Lance5057/modifiers')
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java86
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/modifierDaze.java97
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofBlades.java92
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java119
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java60
-rw-r--r--src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofMirrors.java64
6 files changed, 0 insertions, 518 deletions
diff --git a/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java b/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java
deleted file mode 100644
index fa47e3e..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package gmail.Lance5057.modifiers;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import mods.battlegear2.api.core.IBattlePlayer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.projectile.EntityFireball;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.potion.PotionEffect;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.Vec3;
-import net.minecraft.world.World;
-import tconstruct.library.ActiveToolMod;
-import tconstruct.library.tools.ToolCore;
-
-public class TDefenseActiveToolMod extends ActiveToolMod {
- @Override
- public void updateTool(ToolCore tool, ItemStack stack, World world, Entity entity)
- {
- NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
-
- if (!tags.getBoolean("Broken"))
- {
- //stack.getTagCompound().getCompoundTag("InfiTool").setInteger("RenderHead", 100);
- if(((IBattlePlayer)entity).isBlockingWithShield())
- {
- if(tags.hasKey("Crest of Mirrors"))
- {
- AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(((EntityLivingBase)entity).posX - 3, ((EntityLivingBase)entity).posY - 3, ((EntityLivingBase)entity).posZ - 3, ((EntityLivingBase)entity).posX + 3, ((EntityLivingBase)entity).posY + 3, ((EntityLivingBase)entity).posZ + 3);
-
- ArrayList<EntityFireball> fireballs = (ArrayList<EntityFireball>) world.getEntitiesWithinAABB(EntityFireball.class, boundingBox);
- for (EntityFireball fireball : fireballs)
- {
- if (fireball.getDistanceSqToEntity(((EntityLivingBase)entity)) <= 25)
- {
- Vec3 playerlook = ((EntityLivingBase)entity).getLookVec();
-
- fireball.motionX = playerlook.xCoord;
- fireball.motionY = playerlook.yCoord;
- fireball.motionZ = playerlook.zCoord;
- fireball.accelerationX = fireball.motionX * 0.1D;
- fireball.accelerationY = fireball.motionY * 0.1D;
- fireball.accelerationZ = fireball.motionZ * 0.1D;
-
- fireball.shootingEntity = ((EntityLivingBase)entity);
-
- ((EntityLivingBase)entity).worldObj.playSoundAtEntity(((EntityLivingBase)entity), "battlegear2:shield", 1, 1);
- }
- }
- }
- }
- }
- }
-
- @Override
-
- public int baseAttackDamage(int earlyModDamage, int damage, ToolCore tool,
- NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack,
- EntityLivingBase player, Entity entity) {
- if (!toolTags.hasKey("Broken")) {
- if (toolTags.hasKey("Daze")) {
- int[] array = toolTags.getIntArray("Daze");
- int chance = array[0] * 5;
-
- Random roll = new Random();
- int num = roll.nextInt(100) + 1;
-
- if (num <= chance) {
- ((EntityLivingBase) entity)
- .addPotionEffect(new PotionEffect(2, 3 * 20, 100));
- ((EntityLivingBase) entity)
- .addPotionEffect(new PotionEffect(9, 3 * 20, 100));
- ((EntityLivingBase) entity)
- .addPotionEffect(new PotionEffect(15, 3 * 20, 100));
- ((EntityLivingBase) entity)
- .addPotionEffect(new PotionEffect(18, 3 * 20, 100));
- }
- }
- }
-
- return 0;
- }
-}
diff --git a/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java b/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java
deleted file mode 100644
index cf30e66..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/modifierDaze.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package gmail.Lance5057.modifiers;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import tconstruct.library.tools.ToolCore;
-import tconstruct.modifiers.tools.ItemModTypeFilter;
-
-public class modifierDaze extends ItemModTypeFilter
-{
- String tooltipName;
- int max = 5;
- String guiType;
-
- public modifierDaze(String type, int effect, ItemStack[] items, int[] values)
- {
- super(effect, "Daze", items, values);
- tooltipName = "\u00A76Daze";
- guiType = type;
- }
-
- @Override
- protected boolean canModify (ItemStack tool, ItemStack[] input)
- {
- if (tool.getItem() instanceof ToolCore)
- {
- List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits());
- if (list.contains("weapon"))
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- if (!tags.hasKey(key))
- return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
-
- if (matchingAmount(input) > max)
- return false;
-
- int keyPair[] = tags.getIntArray(key);
- if (keyPair[0] + matchingAmount(input) <= keyPair[1])
- return true;
-
- else if (keyPair[0] == keyPair[1])
- return tags.getInteger("Modifiers") > 0;
- }
- }
-
- return false;
- }
-
- @Override
- public void modify (ItemStack[] input, ItemStack tool)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- int increase = matchingAmount(input);
- if (tags.hasKey(key))
- {
- int[] keyPair = tags.getIntArray(key);
-
- if (keyPair[0] % max == 0)
- {
- keyPair[0] += increase;
- keyPair[1] += max;
- tags.setIntArray(key, keyPair);
-
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- }
- else
- {
- keyPair[0] += increase;
- tags.setIntArray(key, keyPair);
- }
- updateModTag(tool, keyPair);
-
- }
- else
- {
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")";
- int tooltipIndex = addToolTip(tool, tooltipName, modName);
- int[] keyPair = new int[] { increase, max, tooltipIndex };
- tags.setIntArray(key, keyPair);
- }
- }
-
- void updateModTag (ItemStack tool, int[] keys)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- String tip = "ModifierTip" + keys[2];
- String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")";
- tags.setString(tip, modName);
- }
-} \ No newline at end of file
diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofBlades.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofBlades.java
deleted file mode 100644
index 455a21f..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofBlades.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package gmail.Lance5057.modifiers.shields;
-
-import tconstruct.library.tools.ToolCore;
-import tconstruct.modifiers.tools.ItemModTypeFilter;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-public class modifierCrestofBlades extends ItemModTypeFilter
-{
- String tooltipName;
- int max = 5;
- String guiType;
-
- public modifierCrestofBlades(String type, int effect, ItemStack[] items, int[] values)
- {
- super(effect, "Blades", items, values);
- tooltipName = "\u00A7fBlades";
- guiType = type;
- }
-
- @Override
- protected boolean canModify (ItemStack tool, ItemStack[] input)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- if (!tags.hasKey(key))
- return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
-
- if (matchingAmount(input) > max)
- return false;
-
- int keyPair[] = tags.getIntArray(key);
- if (keyPair[0] + matchingAmount(input) <= keyPair[1])
- return true;
-
-// else if (keyPair[0] == keyPair[1])
-// return tags.getInteger("Modifiers") > 0;
-
- else
- return false;
- }
-
- @Override
- public void modify (ItemStack[] input, ItemStack tool)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- int increase = matchingAmount(input);
- int[] keyPair;
- int current = 0;
- if (tags.hasKey(key))
- {
- keyPair = tags.getIntArray(key);
-
- if (keyPair[0] % max == 0)
- {
- keyPair[0] += increase;
- keyPair[1] += max;
- tags.setIntArray(key, keyPair);
-
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- }
- else
- {
- keyPair[0] += increase;
- tags.setIntArray(key, keyPair);
- }
- updateModTag(tool, keyPair);
-
- }
- else
- {
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")";
- int tooltipIndex = addToolTip(tool, tooltipName, modName);
- keyPair = new int[] { increase, max, tooltipIndex };
- tags.setIntArray(key, keyPair);
- }
-
- }
-
- void updateModTag (ItemStack tool, int[] keys)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- String tip = "ModifierTip" + keys[2];
- String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")";
- tags.setString(tip, modName);
- }
-}
diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java
deleted file mode 100644
index 0bdcb85..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package gmail.Lance5057.modifiers.shields;
-
-import tconstruct.library.tools.ToolCore;
-import tconstruct.modifiers.tools.ItemModTypeFilter;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-public class modifierCrestofFeathers extends ItemModTypeFilter
-{
- String tooltipName;
- int max = 10;
- String guiType;
-
- public modifierCrestofFeathers(String type, int effect, ItemStack[] items, int[] values)
- {
- super(effect, "Feathers", items, values);
- tooltipName = "\u00A7fCrest of Feathers";
- guiType = type;
- }
-
- @Override
- protected boolean canModify (ItemStack tool, ItemStack[] input)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- if (!tags.hasKey(key))
- return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
-
- if (matchingAmount(input) > max)
- return false;
-
- int keyPair[] = tags.getIntArray(key);
- if (keyPair[0] + matchingAmount(input) <= keyPair[1])
- return true;
-
- else if (keyPair[0] == keyPair[1])
- return tags.getInteger("Modifiers") > 0;
-
- else
- return false;
- }
-
- @Override
- public void modify (ItemStack[] input, ItemStack tool)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- int increase = matchingAmount(input);
- int[] keyPair;
- int current = 0;
- if (tags.hasKey(key))
- {
- keyPair = tags.getIntArray(key);
-
- if (keyPair[0] % max == 0)
- {
- keyPair[0] += increase;
- keyPair[1] += max;
- tags.setIntArray(key, keyPair);
-
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- }
- else
- {
- keyPair[0] += increase;
- tags.setIntArray(key, keyPair);
- }
- updateModTag(tool, keyPair);
-
- }
- else
- {
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")";
- int tooltipIndex = addToolTip(tool, tooltipName, modName);
- keyPair = new int[] { increase, max, tooltipIndex };
- tags.setIntArray(key, keyPair);
- }
-
- int miningSpeed = tags.getInteger("MiningSpeed");
- int boost = 8 + ((current - 1) / 50 * 2);
- Item temp = tool.getItem();
- if (temp instanceof ToolCore)
- {
- ToolCore toolcore = (ToolCore) temp;
- if (toolcore.durabilityTypeHandle() == 2)
- boost += 2;
- if (toolcore.durabilityTypeAccessory() == 2)
- boost += 2;
- if (toolcore.durabilityTypeExtra() == 2)
- boost += 2;
- }
- miningSpeed += (increase * boost);
- tags.setInteger("MiningSpeed", miningSpeed);
-
- String[] type = { "MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra" };
-
- for (int i = 0; i < 3; i++)
- {
- if (tags.hasKey(type[i]))
- {
- int speed = tags.getInteger(type[i]);
- speed += (increase * boost);
- tags.setInteger(type[i], speed);
- }
- }
- }
-
- void updateModTag (ItemStack tool, int[] keys)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- String tip = "ModifierTip" + keys[2];
- String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")";
- tags.setString(tip, modName);
- }
-}
diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java
deleted file mode 100644
index 1589b36..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package gmail.Lance5057.modifiers.shields;
-
-import gmail.Lance5057.items.tools.Shield;
-import tconstruct.modifiers.tools.ItemModTypeFilter;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-public class modifierCrestofLegends extends ItemModTypeFilter
-{
- String tooltipName;
- String guiType;
-
- public modifierCrestofLegends(String type, int effect, ItemStack[] items, int[] values)
- {
- super(effect, "Legends", items, values);
- tooltipName = "\u00A7fCrest of Legends";
- guiType = type;
- }
-
- @Override
- protected boolean canModify (ItemStack tool, ItemStack[] input)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
-
- if(tool.getItem() instanceof Shield)
- return tags.getInteger("Modifiers") > 0;
-
- return false;
- }
-
- @Override
- public void modify (ItemStack[] input, ItemStack tool)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- int increase = matchingAmount(input);
- if (tags.hasKey(key))
- {
- int[] keyPair = tags.getIntArray(key);
-
- updateModTag(tool, keyPair);
-
- }
- else
- {
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
- String modName = "\u00A76" + guiType;
- int tooltipIndex = addToolTip(tool, tooltipName, modName);
- }
- }
-
- void updateModTag (ItemStack tool, int[] keys)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- String tip = "ModifierTip" + keys[2];
- String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")";
- tags.setString(tip, modName);
- }
-}
diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofMirrors.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofMirrors.java
deleted file mode 100644
index 35cf9a9..0000000
--- a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofMirrors.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package gmail.Lance5057.modifiers.shields;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import tconstruct.library.tools.ToolCore;
-import tconstruct.modifiers.tools.ModBoolean;
-
-public class modifierCrestofMirrors extends ModBoolean
-{
- String tooltipName;
- String guiType;
-
- public modifierCrestofMirrors(String type, int effect, ItemStack[] items, int[] values)
- {
- super(items, effect, "Mirrors", "\u00A7", "");
- tooltipName = "\u00A7bCrest of Mirrors";
- guiType = type;
- }
-
- @Override
- protected boolean canModify (ItemStack tool, ItemStack[] input)
- {
- if (tool.getItem() instanceof ToolCore)
- {
- List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits());
- if (list.contains("shield"))
- {
-
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
-
- if (tags.hasKey(key))
- return false;
-
- return true;
- }
- }
- return false;
-
- }
-
- @Override
- public void modify (ItemStack[] input, ItemStack tool)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- tags.setBoolean(key, true);
-
- int modifiers = tags.getInteger("Modifiers");
- modifiers -= 1;
- tags.setInteger("Modifiers", modifiers);
-
- addToolTip(tool, "\u00A7b" + tooltipName, "\u00A7b" + key);
- }
-
- void updateModTag (ItemStack tool, int[] keys)
- {
- NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
- String tip = "ModifierTip" + keys[2];
- String modName = "\u00A7b" + guiType;
- tags.setString(tip, modName);
- }
-}