Merge branch 'master' of ssh://data.tilera.xyz:2222/Anvilcraft/Dartcraft

This commit is contained in:
LordMZTE 2021-04-16 22:41:24 +02:00
commit c1fdb96a7c
14 changed files with 882 additions and 9 deletions

View file

@ -0,0 +1,18 @@
package ley.modding.dartcraft;
public class Config {
public static boolean hardHeat;
public static boolean hardSturdy;
public static boolean easyWing;
public static boolean timeUpgradeRod;
public static boolean timeUpgradeSword;
public static boolean timeUpgradeTorch;
public static boolean insaneImpervious;
public static int speedLevel;
public static int damageLevel;
public static int sturdyLevel;
public static float gemValue;
}

View file

@ -0,0 +1,382 @@
package ley.modding.dartcraft.api.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class ItemInventory implements IInventory
{
public ItemStack origin;
protected ItemStack[] contents;
private Container handler;
private String contentName;
public ItemInventory(int size)
{
this.contents = new ItemStack[size];
this.contentName = "contents";
}
public ItemInventory(int size, ItemStack stack)
{
this(size);
this.origin = stack;
readFromNBT(stack.getTagCompound());
}
public ItemInventory(int size, ItemStack stack, String name)
{
this(size);
this.origin = stack;
this.contentName = name;
if (this.contentName == null) {
this.contentName = "contents";
}
readFromNBT(stack.getTagCompound());
}
public void onGuiSaved(EntityPlayer player)
{
this.origin = findOrigin(player);
if (this.origin != null) {
save();
}
}
public ItemStack findOrigin(EntityPlayer player)
{
if (this.origin == null) {
return null;
}
NBTTagCompound comp = this.origin.getTagCompound();
if (comp == null) {
return null;
}
int id = comp.getInteger("ID");
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
{
if (player.inventory.getStackInSlot(i) != null)
{
NBTTagCompound playerComp = player.inventory.getStackInSlot(i).getTagCompound();
if (playerComp != null)
{
if (id == playerComp.getInteger("ID")) {
return player.inventory.getStackInSlot(i);
}
}
}
}
if (player.inventory.getItemStack() != null)
{
NBTTagCompound playerComp = player.inventory.getItemStack().getTagCompound();
if ((playerComp != null) && (id == playerComp.getInteger("ID"))) {
return player.inventory.getItemStack();
}
}
return null;
}
public boolean matchesID(int secondID)
{
if (this.origin == null) {
return false;
}
NBTTagCompound comp = this.origin.getTagCompound();
if (comp == null) {
return false;
}
int id = comp.getInteger("ID");
return id == secondID;
}
public void save()
{
if (this.origin == null) {
return;
}
NBTTagCompound comp = this.origin.getTagCompound();
if (comp == null)
comp = new NBTTagCompound();
writeToNBT(comp);
this.origin.setTagCompound(comp);
}
public void readFromNBT(NBTTagCompound comp)
{
if ((comp == null) || (this.contentName == null))
return;
if (comp.hasKey(this.contentName))
{
NBTTagList contentList = comp.getTagList(this.contentName, 10);
this.contents = new ItemStack[getSizeInventory()];
for (int i = 0; i < contentList.tagCount(); i++)
{
NBTTagCompound tempComp = contentList.getCompoundTagAt(i);
byte slotByte = tempComp.getByte("Slot");
if ((slotByte >= 0) && (slotByte < this.contents.length))
{
this.contents[slotByte] = ItemStack.loadItemStackFromNBT(tempComp);
}
}
}
}
public void writeToNBT(NBTTagCompound comp)
{
if (this.contentName == null) {
this.contentName = "contents";
}
NBTTagList contentList = new NBTTagList();
for (int i = 0; i < this.contents.length; i++)
{
if (this.contents[i] != null)
{
NBTTagCompound tempComp = new NBTTagCompound();
tempComp.setByte("Slot", (byte)i);
this.contents[i].writeToNBT(tempComp);
contentList.appendTag(tempComp);
}
comp.setTag(this.contentName, contentList);
}
}
public void setCraftingListener(Container container)
{
this.handler = container;
}
public ItemStack decrStackSize(int i, int j)
{
if (this.contents[i] == null) {
return null;
}
if (this.contents[i].stackSize <= j)
{
ItemStack product = this.contents[i];
this.contents[i] = null;
markDirty();
return product;
}
ItemStack product = this.contents[i].splitStack(j);
if (this.contents[i].stackSize == 0) {
this.contents[i] = null;
}
markDirty();
return product;
}
public ItemStack getStackInSlotOnClosing(int slot)
{
if (this.contents[slot] == null)
return null;
ItemStack returnVal = this.contents[slot];
this.contents[slot] = null;
markDirty();
return returnVal;
}
public void setInventorySlotContents(int index, ItemStack stack)
{
this.contents[index] = stack;
markDirty();
}
public int getFirstEmptyStack()
{
for (int i = 0; i < this.contents.length; i++) {
if (this.contents[i] == null)
return i;
}
return -1;
}
public int getFreeSlots()
{
int free = 0;
if ((this.contents != null) && (this.contents.length > 0)) {
for (ItemStack checkStack : this.contents)
if (checkStack == null)
free++;
}
return free;
}
private int storePartialItemStack(ItemStack stack)
{
Item i = stack.getItem();
int j = stack.stackSize;
if (stack.getMaxStackSize() == 1)
{
int k = getFirstEmptyStack();
if (k < 0) {
return j;
}
if (this.contents[k] == null) {
this.contents[k] = ItemStack.copyItemStack(stack);
}
return 0;
}
int k = storeItemStack(stack);
if (k < 0) {
k = getFirstEmptyStack();
}
if (k < 0) {
return j;
}
if (this.contents[k] == null)
{
this.contents[k] = new ItemStack(i, 0, stack.getItemDamage());
if (stack.hasTagCompound()) {
this.contents[k].setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
}
}
int l = j;
if (j > this.contents[k].getMaxStackSize() - this.contents[k].stackSize) {
l = this.contents[k].getMaxStackSize() - this.contents[k].stackSize;
}
if (l > getInventoryStackLimit() - this.contents[k].stackSize) {
l = getInventoryStackLimit() - this.contents[k].stackSize;
}
if (l == 0) {
return j;
}
j -= l;
this.contents[k].stackSize += l;
this.contents[k].animationsToGo = 5;
return j;
}
public int storeItemStack(ItemStack stack)
{
for (int i = 0; i < this.contents.length; i++) {
if ((this.contents[i] != null) && (this.contents[i].getItem() == stack.getItem()) && (this.contents[i].isStackable()) && (this.contents[i].stackSize < this.contents[i].getMaxStackSize()) && (this.contents[i].stackSize < getInventoryStackLimit()) && ((!this.contents[i].getHasSubtypes()) || (this.contents[i].getItemDamage() == stack.getItemDamage())) && (ItemStack.areItemStackTagsEqual(this.contents[i], stack)))
{
return i;
}
}
return -1;
}
public boolean addItemToInventory(ItemStack stack)
{
if (stack == null) {
return false;
}
if (stack.isItemDamaged())
{
int i = getFirstEmptyStack();
if (i >= 0)
{
this.contents[i] = ItemStack.copyItemStack(stack);
this.contents[i].animationsToGo = 5;
stack.stackSize = 0;
markDirty();
return true;
}
return false;
}
int i;
do
{
i = stack.stackSize;
stack.stackSize = storePartialItemStack(stack);
}
while ((stack.stackSize > 0) && (stack.stackSize < i));
return stack.stackSize < i;
}
public ItemStack getStackInSlot(int index)
{
return this.contents[index];
}
public int getSizeInventory() { return this.contents.length; }
public String getInventoryName() {
return "inventory.simulated";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
public int getInventoryStackLimit() { return 64; }
public void markDirty()
{
if (this.handler != null) {
this.handler.onCraftMatrixChanged(this);
}
}
public boolean isUseableByPlayer(EntityPlayer player)
{
return true;
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return false;
}
}

View file

@ -67,7 +67,7 @@ public class IForceUpgrade {
if(this.materials != null && this.materials.size() > 0) {
for(int i = 0; i < this.materials.size(); ++i) {
IForceUpgradeMaterial check = (IForceUpgradeMaterial)this.materials.get(i);
if(check.getUpgradeID() == mat.getUpgradeID() && check.getItemID() == mat.getItemID() && check.getItemMeta() == mat.getItemMeta()) {
if(check.getUpgradeID() == mat.getUpgradeID() && check.getItem() == mat.getItem() && check.getItemMeta() == mat.getItemMeta()) {
return i;
}
}

View file

@ -1,9 +1,11 @@
package ley.modding.dartcraft.api.upgrades;
import net.minecraft.item.Item;
public interface IForceUpgradeMaterial {
int getItemID();
Item getItem();
int getItemMeta();

View file

@ -0,0 +1,78 @@
package ley.modding.dartcraft.api.upgrades;
import ley.modding.dartcraft.util.ForceUpgradeManager;
import net.minecraft.item.Item;
public class UpgradeMaterialHelper
{
public static IForceUpgradeMaterial createMaterial(Item item, int upgradeID, int bonus, float efficiency, String description, boolean required) {
try {
if (ForceUpgradeManager.getFromID(upgradeID) == null)
return null;
return new UpgradeAdapter(item, 0, upgradeID, bonus, efficiency, description, required);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static IForceUpgradeMaterial createMaterial(Item item, int meta, int upgradeID, int bonus, float efficiency, String description, boolean required) {
try {
if (ForceUpgradeManager.getFromID(upgradeID) == null)
return null;
return new UpgradeAdapter(item, meta, upgradeID, bonus, efficiency, description, required);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private static class UpgradeAdapter
implements IForceUpgradeMaterial
{
private Item item;
private int meta;
private int upgradeID;
private int bonus;
private float efficiency;
private String description;
private boolean required;
public UpgradeAdapter(Item item, int meta, int upgradeID, int bonus, float efficiency, String description, boolean required)
{
this.item = item;
this.meta = meta;
this.upgradeID = upgradeID;
this.bonus = bonus;
this.efficiency = efficiency;
this.description = description;
this.required = required;
}
public int getUpgradeID() {
return this.upgradeID;
}
public int getBonus() { return this.bonus; }
public float getEfficiency() {
return this.efficiency;
}
public Item getItem() { return this.item; }
public int getItemMeta() {
return this.meta;
}
public String getDescription() { return this.description; }
public boolean isRequired() {
return this.required;
}
}
}

View file

@ -23,6 +23,14 @@ public class DartItems {
public static Item forceflask;
public static Item entitybottle;
//Useless Items
public static Item fortune;
public static Item soulwafer;
public static Item claw;
public static Item goldenpower;
public static Item resource;
public static void regsiter(IRegistry reg) {
DartItems.forcegem = reg.registerItem(new BaseItem("forcegem"));
DartItems.forceingot = reg.registerItem(new BaseItem("forceingot"));
@ -36,5 +44,12 @@ public class DartItems {
DartItems.forceshears = reg.registerItem(new ItemForceShears());
DartItems.forceflask = reg.registerItem(new ItemForceFlask());
DartItems.entitybottle = reg.registerItem(new ItemEntityBottle());
DartItems.fortune = reg.registerItem(new BaseItem("fortune"));
DartItems.soulwafer = reg.registerItem(new BaseItem("soulwafer"));
DartItems.claw = reg.registerItem(new BaseItem("claw"));
DartItems.goldenpower = reg.registerItem(new BaseItem("goldenpower"));
DartItems.resource = reg.registerItem(new BaseItem("resource"));
}
}

View file

@ -5,8 +5,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ley.modding.dartcraft.Dartcraft;
import ley.modding.dartcraft.api.IBreakable;
import ley.modding.dartcraft.api.IForceConsumer;
import ley.modding.dartcraft.api.upgrades.IForceUpgradable;
import ley.modding.dartcraft.item.DartItems;
import ley.modding.dartcraft.util.ForceConsumerUtils;
import ley.modding.dartcraft.util.ForceUpgradeManager;
import ley.modding.dartcraft.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@ -18,7 +20,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.EnumHelper;
public class ItemForcePickaxe extends ItemPickaxe implements IBreakable, IForceConsumer {
public class ItemForcePickaxe extends ItemPickaxe implements IBreakable, IForceConsumer, IForceUpgradable {
private static int damage = 1;
private static float efficiency = 5.0F;
@ -108,11 +110,17 @@ public class ItemForcePickaxe extends ItemPickaxe implements IBreakable, IForceC
@Override
public boolean useForce(ItemStack stack, int var2, boolean var3) {
return false;
return ForceConsumerUtils.useForce(stack, var2, var3);
}
@Override
public boolean attemptRepair(ItemStack stack) {
return ForceConsumerUtils.attemptRepair(stack);
}
public int[] validUpgrades()
{
return new int[] { ForceUpgradeManager.HEAT.getID(), ForceUpgradeManager.SPEED.getID(), ForceUpgradeManager.LUCK.getID(), ForceUpgradeManager.TOUCH.getID(), ForceUpgradeManager.STURDY.getID(), ForceUpgradeManager.GRINDING.getID(), ForceUpgradeManager.REPAIR.getID(), ForceUpgradeManager.IMPERVIOUS.getID() };
}
}

View file

@ -1,6 +1,7 @@
package ley.modding.dartcraft.proxy;
import cpw.mods.fml.client.FMLClientHandler;
import ley.modding.dartcraft.util.ForceUpgradeManager;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
@ -28,7 +29,7 @@ public class CommonProxy {
}
public void init() {
ForceUpgradeManager.load();
}
}

View file

@ -1,13 +1,18 @@
package ley.modding.dartcraft.util;
import java.util.Random;
import ley.modding.dartcraft.Dartcraft;
import ley.modding.dartcraft.Config;
import ley.modding.dartcraft.api.IForceConsumer;
import net.minecraft.entity.player.EntityPlayer;
import ley.modding.dartcraft.api.inventory.ItemInventory;
import ley.modding.dartcraft.item.DartItems;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.Random;
import java.util.logging.Logger;
public class ForceConsumerUtils {
@ -49,4 +54,62 @@ public class ForceConsumerUtils {
return repaired;
}
public static boolean useForce(ItemStack stack, int amount, boolean use)
{
if ((stack == null) || (!stack.hasTagCompound()) || (amount < 0) || (stack.getItem() == null) || (!(stack.getItem() instanceof IForceConsumer)))
{
return false;
}
boolean canUse = stack.getTagCompound().getInteger("storedForce") >= amount;
try
{
if (use)
{
stack.getTagCompound().setInteger("storedForce", stack.getTagCompound().getInteger("storedForce") - amount);
ItemInventory inv = new ItemInventory(1, stack, "consumerContents");
IForceConsumer consumer = (IForceConsumer)stack.getItem();
ItemStack invStack = inv.getStackInSlot(0);
int defecit = consumer.getMaxStored(stack) - stack.getTagCompound().getInteger("storedForce");
if ((defecit > 0) && (invStack != null) && (invStack.stackSize > 0))
{
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(new ItemStack(invStack.getItem(), 1, invStack.getItemDamage()));
if ((liquid == null) && (invStack.getItem() == DartItems.forcegem)) {
liquid = new FluidStack(FluidRegistry.getFluid("liquidforce"), (int)(1000.0F * Config.gemValue));
}
if ((liquid != null) && (liquid.getFluid().getName().equalsIgnoreCase("liquidforce")))
{
while ((defecit >= liquid.amount) && (invStack.stackSize > 0))
{
stack.getTagCompound().setInteger("storedForce", stack.getTagCompound().getInteger("storedForce") + liquid.amount);
invStack.stackSize -= 1;
if (invStack.stackSize <= 0) {
inv.setInventorySlotContents(0, invStack.getItem().hasContainerItem() ? new ItemStack(invStack.getItem().getContainerItem()) : (ItemStack)null);
}
inv.save();
defecit = consumer.getMaxStored(stack) - stack.getTagCompound().getInteger("storedForce");
}
}
}
}
}
catch (Exception e)
{
Logger.getLogger("DartCraft").info("There was a problem in IForceConsumer implementation.");
e.printStackTrace();
}
return canUse;
}
}

View file

@ -0,0 +1,306 @@
package ley.modding.dartcraft.util;
import ley.modding.dartcraft.Config;
import ley.modding.dartcraft.api.upgrades.IForceUpgradable;
import ley.modding.dartcraft.api.upgrades.IForceUpgrade;
import ley.modding.dartcraft.api.upgrades.IForceUpgradeMaterial;
import ley.modding.dartcraft.api.upgrades.UpgradeMaterialHelper;
import ley.modding.dartcraft.block.DartBlocks;
import ley.modding.dartcraft.item.DartItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
public class ForceUpgradeManager
{
public static int firstUniqueID = 0;
public static final String tomeDesc = "If you haven't already done so, you should make a Book of Mudora, as it contains the sum of all DartCraft knowledge. Simply Force Transmute a Bookshelf and you'll be on your way to mastering DartCraft!";
public static final String forceDesc = "This upgrade can be used to turn certain items into more Forceful versions of themselves. It also seems to imbue Force Swords with Knockback.";
public static final String speedDesc = "This upgrade imbues Force Tools with the ability to break blocks faster, and gives an overall speed boost to players when used on a Force Rod. If used to upgrade armor the player will move faster.";
public static final String lumberjackDesc = "This upgrade transforms a Force Axe into a treebliterating tool of mass destruction, although the durability cost for such a monstrous tool is also, well, monstrous.";
public static final String damageDesc = "This upgrade serves to boost the damage of the weapon to which it is attached. On Force Swords it gives Sharpness, while Punch is given to Force Bows.";
public static final String luckDesc = "The Luck upgrade enhances the amount of loot one receives for performing almost any task. On the Force Sword it gives Looting, causing enemies slain to drop more loot. On any standard block breaking tool it will give Fortune, which increases the drop rate of certain items.";
public static final String grindingDesc = "This upgrade allows for certain items and drops to be ground into powdery substances or other useful materials. Try mining some ore with it and you'll get more return than usual.";
public static final String rainbowDesc = "This upgrade is only valid on the Force Shears and randomly changes the color of wool dropped from sheep. Try it out!";
public static final String storageDesc = "This unique upgrade serves to increase the storage capacity of Force Packs by 8 slots per upgrade, up to a total size of 40 slots. Force Packs can only be upgraded once per tier, so you'll have to get to tier 5 before you can max out any Force Pack.";
public static final String storage2Desc = "This unique upgrade serves to increase the storage capacity of Storage Units by approximately one Storage Unit per upgrade. You can only use one upgrade per tier and max size is dependent upon config settings.";
public static final String expDesc = "This upgrade has only one function: to upgrade a normal book into an Experience Tome, which is able to store an infinite amount of experience for the player. Shift right-click it to store experience, and right-click to recall it. There is a small percent loss, but it's free.";
public static final String touchDesc = "This upgrade imbues basic Force Tools with Silk Touch, which generally applies before upgrades like Grinding or Heat.";
public static final String falseDesc = "The False upgrade, when present on a Force Sword will never deal a finishing blow to an enemy when struck. This could be useful for weakening monsters so they can be easily captured in Force Flasks.";
public static final String bleedDesc = "Bleeding will cause entities that are struck to quickly take small amounts of bleed damage over time. This works on both the Force Sword and Bow and does stack with burning damage.";
public static final String craftDesc = "This upgrade is only valid for the Item Card, and will allow the card to automatically craft the configured recipe from inside a Force Pack or Force Transport Pipe.";
public static final String baneDesc = "When an entity is struck with a Bane imbued weapon they are likely to lose some of their inherent abilities. Creepers and Endermen are perfect examples of this principle.";
public static final String chargeDesc = "This upgrade can only be added to Force Armor. Each IC2 battery added gives 10k EU storage, and of course allows the Force Armor to be recharged with IC2 power.";
public static final String forgeDesc = "This upgrade is only valid for Item Cards, and allows them to transmute freely between items marked as 'equivalent' on the Ore Dictionary.";
public static final String heatDesc = "Heat is valid on every iteration of Force Tool, and has a tendency to ignite things it comes into contact with. If you put Heat on shears...you're a terrible person.";
public static final String freezingDesc = "Don't eat that cookie! It doesn't do anything anyway. Upgrading your Force Bow with Freezing will allow it to shoot Ice Arrows which will freeze your enemies in place for a short time, and even change some blocks in the world.";
public static final String wingDesc = "Wing Swords will fling their user when they right-click while holding the jump key, or allow small amounts of flight with a sneak jump right-click combination. On armor it will also allow flight and increase the maximum duration of flight.";
public static final String charge2Desc = "A more potent version of Charge, holding 100,000 EU per upgrade. Multiple Charge2 upgrades are recommended for chest pieces as they will function like Lappacks.";
public static final String healingDesc = "Healing will heal any entity it hits for 1 heart per level, unless of course that entity happens to be undead. Healing can be placed on a sword, bow and rod, and will heal the user when the rod is used.";
public static final String camoDesc = "Camo will make Force Armor invisible, if you'd rather not appear to be wearing armor, or it can be placed on a Force Rod to give short spurts of invisibility to its user.";
public static final String sightDesc = "Upgrading a Force Rod with Sight will give Night Vision to the user for about a minute per use. It's worth noting that only an unmodified Potion of Night Vision may be used.";
public static final String enderDesc = "Teleportation - not just for endermen anymore! Harness this space-bending upgrade on a Force Sword or Rod for easy transportation, or have loads of fun griefing your buddies with the Ender Bow. Teleport responsibly.";
public static final String sturdyDesc = "This upgrade can be used to imbue Unbreaking on all Force Tools but the Shears and Sword, or it can be attached to Force Armor once to reduce incoming damage by a fairly signifcant amount. Sturdy can also be used to upgrade packs and belts to make them immune to damage and despawning.";
public static final String explosionDesc = "This upgrade is not yet used.";
public static final String graftingDesc = "This upgrade will give the Force Axe the potential to function as a Forestry Grafter on leaves that a grafter would normally function on. Of course this uses significant durability each time, so be prepared to throw some serious Liquid Force at this tool and apply some Sturdy upgrades if possible.";
public static final String repairDesc = "This upgrade gives the Repair enchant from Thaumcraft on Force Tools. Repair will attempt to repair one durability damage per 10 seconds.";
public static final String soulDesc = "The Soul upgrade on Force Swords and socketed Power Saws will occasionally cause Mob Chunks to drop, which can be used to craft vanilla spawners for that mob or even be smelted into colored Mob Ingots.";
public static final String lightDesc = "At the moment this can only be used to add Smite to Force Swords. (This will change eventually.)";
public static final String treasureDesc = "When entities are killed with a Treasure imbued weapon they will occasionally drop Treasure Cards, which can then be crafted into a Spoils Bag for some phat loot. Fortune increases the drop rate as well.";
public static final String imperviousDesc = "An insanely powerful upgrade that prevents any Force Tool possessing this enhancement from ever breaking.";
public static final String timeDesc = "Time is relative. At least it will be when you place this upgrade on a Force Sword or Force Rod. Shift right clicking the rod will change modes while right clicking will use it. Try it out!";
public static IForceUpgrade INFO;
public static IForceUpgrade FORCE;
public static IForceUpgrade SPEED;
public static IForceUpgrade LUMBERJACK;
public static IForceUpgrade DAMAGE;
public static IForceUpgrade LUCK;
public static IForceUpgrade GRINDING;
public static IForceUpgrade RAINBOW;
public static IForceUpgrade STORAGE;
public static IForceUpgrade EXP;
public static IForceUpgrade TOUCH;
public static IForceUpgrade FALSE;
public static IForceUpgrade BLEED;
public static IForceUpgrade CRAFT;
public static IForceUpgrade BANE;
public static IForceUpgrade CHARGE;
public static IForceUpgrade FORGE;
public static IForceUpgrade HEAT;
public static IForceUpgrade FREEZING;
public static IForceUpgrade STORAGE2;
public static IForceUpgrade WING;
public static IForceUpgrade CHARGE2;
public static IForceUpgrade HEALING;
public static IForceUpgrade CAMO;
public static IForceUpgrade SIGHT;
public static IForceUpgrade ENDER;
public static IForceUpgrade STURDY;
public static IForceUpgrade TIME;
public static IForceUpgrade EXPLOSION;
public static IForceUpgrade GRAFTING;
public static IForceUpgrade REPAIR;
public static IForceUpgrade SOUL;
public static IForceUpgrade LIGHT;
public static IForceUpgrade TREASURE;
public static IForceUpgrade IMPERVIOUS;
public static ArrayList<IForceUpgrade> upgrades = new ArrayList();
public static ArrayList<IForceUpgradeMaterial> materials = new ArrayList();
public static void load()
{
loadUpgrades();
addUpgrades();
loadUpgradeMaterials();
//loadWildCards();
}
private static void loadUpgrades()
{
INFO = new IForceUpgrade(0, "Info", 1, "");
FORCE = new IForceUpgrade(1, "Force", 2, "This upgrade can be used to turn certain items into more Forceful versions of themselves. It also seems to imbue Force Swords with Knockback.");
SPEED = new IForceUpgrade(1, "Speed", Config.speedLevel, "This upgrade imbues Force Tools with the ability to break blocks faster, and gives an overall speed boost to players when used on a Force Rod. If used to upgrade armor the player will move faster.");
LUMBERJACK = new IForceUpgrade(1, "Lumberjack", 1, "This upgrade transforms a Force Axe into a treebliterating tool of mass destruction, although the durability cost for such a monstrous tool is also, well, monstrous.");
DAMAGE = new IForceUpgrade(1, "Damage", Config.damageLevel, "This upgrade serves to boost the damage of the weapon to which it is attached. On Force Swords it gives Sharpness, while Punch is given to Force Bows.");
LUCK = new IForceUpgrade(2, "Luck", 4, "The Luck upgrade enhances the amount of loot one receives for performing almost any task. On the Force Sword it gives Looting, causing enemies slain to drop more loot. On any standard block breaking tool it will give Fortune, which increases the drop rate of certain items.");
GRINDING = new IForceUpgrade(2, "Grinding", 1, "This upgrade allows for certain items and drops to be ground into powdery substances or other useful materials. Try mining some ore with it and you'll get more return than usual.");
RAINBOW = new IForceUpgrade(2, "Rainbow", 1, "This upgrade is only valid on the Force Shears and randomly changes the color of wool dropped from sheep. Try it out!");
STORAGE = new IForceUpgrade(2, "Holding", 1, "This unique upgrade serves to increase the storage capacity of Force Packs by 8 slots per upgrade, up to a total size of 40 slots. Force Packs can only be upgraded once per tier, so you'll have to get to tier 5 before you can max out any Force Pack.");
EXP = new IForceUpgrade(2, "Experience", 1, "This upgrade has only one function: to upgrade a normal book into an Experience Tome, which is able to store an infinite amount of experience for the player. Shift right-click it to store experience, and right-click to recall it. There is a small percent loss, but it's free.");
TOUCH = new IForceUpgrade(3, "Touch", 1, "This upgrade imbues basic Force Tools with Silk Touch, which generally applies before upgrades like Grinding or Heat.");
FALSE = new IForceUpgrade(3, "False", 1, "The False upgrade, when present on a Force Sword will never deal a finishing blow to an enemy when struck. This could be useful for weakening monsters so they can be easily captured in Force Flasks.");
BLEED = new IForceUpgrade(3, "Bleed", 3, "Bleeding will cause entities that are struck to quickly take small amounts of bleed damage over time. This works on both the Force Sword and Bow and does stack with burning damage.");
CRAFT = new IForceUpgrade(3, "Craft", 1, "This upgrade is only valid for the Item Card, and will allow the card to automatically craft the configured recipe from inside a Force Pack or Force Transport Pipe.");
BANE = new IForceUpgrade(3, "Bane", 1, "When an entity is struck with a Bane imbued weapon they are likely to lose some of their inherent abilities. Creepers and Endermen are perfect examples of this principle.");
TIME = new IForceUpgrade(3, "Time", 1, "Time is relative. At least it will be when you place this upgrade on a Force Sword or Force Rod. Shift right clicking the rod will change modes while right clicking will use it. Try it out!");
CHARGE = new IForceUpgrade(4, "Charge", 5, "This upgrade can only be added to Force Armor. Each IC2 battery added gives 10k EU storage, and of course allows the Force Armor to be recharged with IC2 power.");
FORGE = new IForceUpgrade(4, "Forge", 1, "This upgrade is only valid for Item Cards, and allows them to transmute freely between items marked as 'equivalent' on the Ore Dictionary.");
HEAT = new IForceUpgrade(4, "Heat", 1, "Heat is valid on every iteration of Force Tool, and has a tendency to ignite things it comes into contact with. If you put Heat on shears...you're a terrible person.");
FREEZING = new IForceUpgrade(4, "Freezing", 1, "Don't eat that cookie! It doesn't do anything anyway. Upgrading your Force Bow with Freezing will allow it to shoot Ice Arrows which will freeze your enemies in place for a short time, and even change some blocks in the world.");
STORAGE2 = new IForceUpgrade(4, "Storage", 1, "This unique upgrade serves to increase the storage capacity of Storage Units by approximately one Storage Unit per upgrade. You can only use one upgrade per tier and max size is dependent upon config settings.");
WING = new IForceUpgrade(5, "Wing", 1, "Wing Swords will fling their user when they right-click while holding the jump key, or allow small amounts of flight with a sneak jump right-click combination. On armor it will also allow flight and increase the maximum duration of flight.");
CHARGE2 = new IForceUpgrade(5, "Charge2", 5, "A more potent version of Charge, holding 100,000 EU per upgrade. Multiple Charge2 upgrades are recommended for chest pieces as they will function like Lappacks.");
HEALING = new IForceUpgrade(5, "Healing", 2, "Healing will heal any entity it hits for 1 heart per level, unless of course that entity happens to be undead. Healing can be placed on a sword, bow and rod, and will heal the user when the rod is used.");
CAMO = new IForceUpgrade(5, "Camo", 1, "Camo will make Force Armor invisible, if you'd rather not appear to be wearing armor, or it can be placed on a Force Rod to give short spurts of invisibility to its user.");
SIGHT = new IForceUpgrade(5, "Sight", 1, "Upgrading a Force Rod with Sight will give Night Vision to the user for about a minute per use. It's worth noting that only an unmodified Potion of Night Vision may be used.");
ENDER = new IForceUpgrade(6, "Ender", 1, "Teleportation - not just for endermen anymore! Harness this space-bending upgrade on a Force Sword or Rod for easy transportation, or have loads of fun griefing your buddies with the Ender Bow. Teleport responsibly.");
STURDY = new IForceUpgrade(6, "Sturdy", Config.sturdyLevel, "This upgrade can be used to imbue Unbreaking on all Force Tools but the Shears and Sword, or it can be attached to Force Armor once to reduce incoming damage by a fairly signifcant amount. Sturdy can also be used to upgrade packs and belts to make them immune to damage and despawning.");
SOUL = new IForceUpgrade(6, "Soul", 1, "The Soul upgrade on Force Swords and socketed Power Saws will occasionally cause Mob Chunks to drop, which can be used to craft vanilla spawners for that mob or even be smelted into colored Mob Ingots.");
EXPLOSION = new IForceUpgrade(7, "Explosion", 1, "This upgrade is not yet used.");
GRAFTING = new IForceUpgrade(7, "Grafting", 1, "This upgrade will give the Force Axe the potential to function as a Forestry Grafter on leaves that a grafter would normally function on. Of course this uses significant durability each time, so be prepared to throw some serious Liquid Force at this tool and apply some Sturdy upgrades if possible.");
REPAIR = new IForceUpgrade(7, "Repair", 1, "This upgrade gives the Repair enchant from Thaumcraft on Force Tools. Repair will attempt to repair one durability damage per 10 seconds.");
LIGHT = new IForceUpgrade(7, "Light", 5, "At the moment this can only be used to add Smite to Force Swords. (This will change eventually.)");
TREASURE = new IForceUpgrade(7, "Treasure", 1, "When entities are killed with a Treasure imbued weapon they will occasionally drop Treasure Cards, which can then be crafted into a Spoils Bag for some phat loot. Fortune increases the drop rate as well.");
IMPERVIOUS = new IForceUpgrade(7, "Impervious", 1, "An insanely powerful upgrade that prevents any Force Tool possessing this enhancement from ever breaking.");
}
private static void addUpgrades()
{
addUpgrade(INFO);
addUpgrade(FORCE);
addUpgrade(DAMAGE);
addUpgrade(FALSE);
addUpgrade(HEAT);
addUpgrade(SPEED);
addUpgrade(LUMBERJACK);
addUpgrade(LUCK);
addUpgrade(TOUCH);
addUpgrade(BLEED);
addUpgrade(HEALING);
addUpgrade(CAMO);
addUpgrade(CRAFT);
addUpgrade(RAINBOW);
addUpgrade(BANE);
addUpgrade(STORAGE);
addUpgrade(STORAGE2);
addUpgrade(STURDY);
addUpgrade(SOUL);
addUpgrade(SIGHT);
addUpgrade(FORGE);
addUpgrade(FREEZING);
addUpgrade(GRINDING);
addUpgrade(CHARGE);
addUpgrade(CHARGE2);
addUpgrade(WING);
addUpgrade(ENDER);
addUpgrade(EXP);
addUpgrade(TIME);
addUpgrade(LIGHT);
addUpgrade(EXPLOSION);
addUpgrade(GRAFTING);
addUpgrade(REPAIR);
addUpgrade(TREASURE);
addUpgrade(IMPERVIOUS);
}
private static void loadUpgradeMaterials()
{
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 416, INFO.getID(), 0, 0.0F, "If you haven't already done so, you should make a Book of Mudora, as it contains the sum of all DartCraft knowledge. Simply Force Transmute a Bookshelf and you'll be on your way to mastering DartCraft!", false));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.forcenugget, FORCE.getID(), -5, 0.75F, "It appears to be a small fragment of Force. Perhaps I could use this to modify a sword.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.claw, DAMAGE.getID(), 0, 0.75F, "They say that bats hold the secret to increased damage.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.sugar, SPEED.getID(), 0, 1.0F, "Tastes like win, and diabetes.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 128, FALSE.getID(), 10, 1.5F, "It appears to be some sort of dust left behind by a Flask-wielding lunatic.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(DartBlocks.forcelog), LUMBERJACK.getID(), 5, 1.5F, "Apparently these Forceful Logs hold the power to quickly destroying their brethren.", true));
if (!Config.hardHeat) {
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.goldenpower, HEAT.getID(), 5, 1.5F, "This Golden Power is not so hard to obtain.", true));
}
else {
addMaterial(UpgradeMaterialHelper.createMaterial(Items.potionitem, 8195, HEAT.getID(), 10, 2.0F, "This fiery brew seems like it would help one to swim in lava... Successfully that is.", true));
}
addMaterial(UpgradeMaterialHelper.createMaterial(Items.dye, 4, RAINBOW.getID(), 0, 0.25F, "Colorful cloth abounds with this gorgeous gem.", true));
if (!Config.hardSturdy)
{
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(Blocks.brick_block), STURDY.getID(), 0, 1.25F, "Well, at least it's harder than dirt.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(Blocks.obsidian), STURDY.getID(), 10, 1.75F, "Collecting this surrepticiously sturdy stone can be a seriously strenuous stint.", true));
}
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 129, STURDY.getID(), 25, 3.0F, "The hardest substance known to post-apocalyptic blocky man, ground into a powdery substance.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.fortune, LUCK.getID(), 0, 2.0F, "A nugget of otherworldly wisdom stuffed inside a delicious confection", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(Blocks.web), TOUCH.getID(), 5, 2.0F, "Spiders aren't the only ones who can weave this Silky material.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.arrow, BLEED.getID(), 0, 1.0F, "You'll shoot your eye out!", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.spider_eye, BANE.getID(), 10, 1.5F, "You probably shouldn't eat this... Just jam it on a sword.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 134, STORAGE.getID(), 0, 0.25F, "I might try and upgrade a Force Pack with this strange item.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 135, STORAGE2.getID(), 0, 0.5F, "It looks like this item could increase the storage capacity of a Storage Unit.", true));
if (Config.easyWing) {
addMaterial(UpgradeMaterialHelper.createMaterial(Items.feather, WING.getID(), 0, 3.0F, "The traditional symbol of freedom... and avian flu.", true));
}
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 131, WING.getID(), 5, 3.0F, "The traditional symbol of freedom... and avian flu.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.flint, GRINDING.getID(), 0, 1.5F, "This is either a rock, or a really misshapen pancreas.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.ghast_tear, HEALING.getID(), 10, 2.0F, "Your tears give me strength... and regeneration.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.potionitem, 8206, CAMO.getID(), 5, 2.0F, "Nothing to see here, except a floating set of armor.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.potionitem, 8198, SIGHT.getID(), 5, 2.0F, "I'm pretty sure it's a potion of some kind, but then again I'm just a sentence. Perhaps if I could just See a little better...", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(Blocks.crafting_table), CRAFT.getID(), -20, 1.0F, "A very Crafty block.", false));
addMaterial(UpgradeMaterialHelper.createMaterial(Item.getItemFromBlock(Blocks.furnace), FORGE.getID(), -25, 2.0F, "Our best traits are Forged by fire. Perhaps an Item Card might be able to use this.", false));
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 195, FREEZING.getID(), 0, 2.0F, "Is this made out of snow?", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.ender_pearl, ENDER.getID(), 0, 5.0F, "This dark orb must house some potent spatial magic.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.experience_bottle, EXP.getID(), 15, 2.25F, "I might be able to get one from an Enchanted Book. Now where did that Force Rod go? If I can manage to get one I should put it on a book.", true));
addMaterial(UpgradeMaterialHelper.createMaterial(Items.glowstone_dust, LIGHT.getID(), 0, 3.0F, "It's glowing, yet stone-like.", true));
if ((Config.timeUpgradeRod) || (Config.timeUpgradeSword) || (Config.timeUpgradeTorch)) {
addMaterial(UpgradeMaterialHelper.createMaterial(Items.clock, TIME.getID(), 0, 2.5F, "A perfect timepiece.", true));
}
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 132, TREASURE.getID(), 0, 8.0F, "When entities are killed with a Treasure imbued weapon they will occasionally drop Treasure Cards, which can then be crafted into a Spoils Bag for some phat loot. Fortune increases the drop rate as well.", false));
if (Config.insaneImpervious) {
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.resource, 133, IMPERVIOUS.getID(), 0, 8.0F, "An insanely powerful upgrade that prevents any Force Tool possessing this enhancement from ever breaking.", false));
}
addMaterial(UpgradeMaterialHelper.createMaterial(DartItems.soulwafer, SOUL.getID(), 0, 2.0F, "The Soul upgrade on Force Swords and socketed Power Saws will occasionally cause Mob Chunks to drop, which can be used to craft vanilla spawners for that mob or even be smelted into colored Mob Ingots.", true));
}
/*private static void loadWildCards() {
ForceWildCards.addWildCard(new IForceWildCard(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(DartBlock.forceBrick, 1, 11), FORCE));
ItemStack tomeStack = new ItemStack((Item)DartItem.forceTome);
tomeStack.setTagCompound(TomeUtils.initExpComp());
ForceWildCards.addWildCard(new IForceWildCard(new ItemStack(Items.book), tomeStack, EXP));
}*/
public static boolean addUpgrade(IForceUpgrade upgrade) {
if (upgrades.size() > 0)
for (IForceUpgrade temp : upgrades) {
if (temp.getID() == upgrade.getID())
return false;
}
upgrades.add(upgrade);
return true;
}
public static int getFirstUniqueUpgradeID() {
firstUniqueID++;
return firstUniqueID - 1;
}
public static void addMaterial(IForceUpgradeMaterial mat) {
try {
materials.add(mat);
getFromID(mat.getUpgradeID()).addMat(mat);
} catch (Exception e) {
if (!(e instanceof NullPointerException))
e.printStackTrace();
}
}
public static IForceUpgrade getFromID(int id) {
if (upgrades.size() > 0)
for (IForceUpgrade temp : upgrades) {
if (temp.getID() == id)
return temp;
}
return null;
}
public static IForceUpgradeMaterial getMaterialFromItemStack(ItemStack stack) {
if (stack == null)
return null;
for (IForceUpgradeMaterial mat : materials) {
if (mat == null)
continue;
if (mat.getItem() == (stack.getItem()) && (mat.getItemMeta() == stack.getItemDamage() || mat.getItemMeta() == 32767))
return mat;
}
return null;
}
public static boolean isUpgradeValid(IForceUpgrade upgrade, IForceUpgradable item) {
if (item.validUpgrades() != null)
for (int id : item.validUpgrades()) {
if (upgrade.getID() == id)
return true;
}
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB