Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are handled to clean up it and give space. You can change the config line to AWWayofTime if you want to keep the compatibility with old configs. Now you reference the blocks from the ModBlocks and Items from the ModItems.
This commit is contained in:
parent
8601e9faff
commit
e3644f2d2b
304 changed files with 3941 additions and 5108 deletions
|
@ -1,20 +1,20 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class AspectList implements Serializable
|
||||
{
|
||||
public LinkedHashMap<Aspect, Integer> aspects = new LinkedHashMap<Aspect, Integer>(); //aspects associated with this object
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class AspectList implements Serializable {
|
||||
public LinkedHashMap<Aspect,Integer> aspects = new LinkedHashMap<Aspect,Integer>(); //aspects associated with this object
|
||||
|
||||
/**
|
||||
* this creates a new aspect list with preloaded values based off the aspects of the given item.
|
||||
* @param id the item/block id of an existing item
|
||||
*
|
||||
* @param id the item/block id of an existing item
|
||||
* @param meta the damage value of an existing item
|
||||
*/
|
||||
public AspectList(int id, int meta)
|
||||
|
@ -24,12 +24,13 @@ public class AspectList implements Serializable
|
|||
AspectList temp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id, 1, meta));
|
||||
|
||||
if (temp != null)
|
||||
for (Aspect tag: temp.getAspects())
|
||||
for (Aspect tag : temp.getAspects())
|
||||
{
|
||||
add(tag, temp.getAmount(tag));
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
}
|
||||
catch (Exception e) {}
|
||||
}
|
||||
|
||||
public AspectList()
|
||||
|
@ -40,7 +41,7 @@ public class AspectList implements Serializable
|
|||
{
|
||||
AspectList out = new AspectList();
|
||||
|
||||
for (Aspect a: this.getAspects())
|
||||
for (Aspect a : this.getAspects())
|
||||
{
|
||||
out.add(a, this.getAmount(a));
|
||||
}
|
||||
|
@ -63,7 +64,7 @@ public class AspectList implements Serializable
|
|||
{
|
||||
int q = 0;
|
||||
|
||||
for (Aspect as: aspects.keySet())
|
||||
for (Aspect as : aspects.keySet())
|
||||
{
|
||||
q += this.getAmount(as);
|
||||
}
|
||||
|
@ -87,7 +88,7 @@ public class AspectList implements Serializable
|
|||
{
|
||||
AspectList t = new AspectList();
|
||||
|
||||
for (Aspect as: aspects.keySet())
|
||||
for (Aspect as : aspects.keySet())
|
||||
{
|
||||
if (as.isPrimal())
|
||||
{
|
||||
|
@ -169,11 +170,12 @@ public class AspectList implements Serializable
|
|||
*/
|
||||
public int getAmount(Aspect key)
|
||||
{
|
||||
return aspects.get(key) == null ? 0 : aspects.get(key);
|
||||
return aspects.get(key) == null ? 0 : aspects.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
*
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
|
@ -193,6 +195,7 @@ public class AspectList implements Serializable
|
|||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
* If reduced to 0 or less the aspect will be removed completely.
|
||||
*
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
|
@ -204,8 +207,7 @@ public class AspectList implements Serializable
|
|||
if (am <= 0)
|
||||
{
|
||||
aspects.remove(key);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
this.aspects.put(key, am);
|
||||
}
|
||||
|
@ -215,6 +217,7 @@ public class AspectList implements Serializable
|
|||
|
||||
/**
|
||||
* Simply removes the aspect from the list
|
||||
*
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
|
@ -228,6 +231,7 @@ public class AspectList implements Serializable
|
|||
/**
|
||||
* Adds this aspect and amount to the collection.
|
||||
* If the aspect exists then its value will be increased by the given amount.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @return
|
||||
|
@ -247,6 +251,7 @@ public class AspectList implements Serializable
|
|||
/**
|
||||
* Adds this aspect and amount to the collection.
|
||||
* If the aspect exists then only the highest of the old or new amount will be used.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @return
|
||||
|
@ -269,6 +274,7 @@ public class AspectList implements Serializable
|
|||
|
||||
/**
|
||||
* Reads the list of aspects from nbt
|
||||
*
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
|
@ -284,13 +290,14 @@ public class AspectList implements Serializable
|
|||
if (rs.hasKey("key"))
|
||||
{
|
||||
add(Aspect.getAspect(rs.getString("key")),
|
||||
rs.getInteger("amount"));
|
||||
rs.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the list of aspects to nbt
|
||||
*
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue