Testing
This commit is contained in:
commit
8601e9faff
498 changed files with 45817 additions and 0 deletions
247
BM_src/thaumcraft/api/aspects/Aspect.java
Normal file
247
BM_src/thaumcraft/api/aspects/Aspect.java
Normal file
|
@ -0,0 +1,247 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
public class Aspect
|
||||
{
|
||||
String tag;
|
||||
Aspect[] components;
|
||||
int color;
|
||||
private String chatcolor;
|
||||
ResourceLocation image;
|
||||
int blend;
|
||||
|
||||
/**
|
||||
* Use this constructor to register your own aspects.
|
||||
* @param tag the key that will be used to reference this aspect, as well as its latin display name
|
||||
* @param color color to display the tag in
|
||||
* @param components the aspects this one is formed from
|
||||
* @param image ResourceLocation pointing to a 32x32 icon of the aspect
|
||||
* @param blend GL11 blendmode (1 or 771). Used for rendering nodes. Default is 1
|
||||
*/
|
||||
public Aspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend)
|
||||
{
|
||||
if (aspects.containsKey(tag))
|
||||
{
|
||||
throw new IllegalArgumentException(tag + " already registered!");
|
||||
}
|
||||
|
||||
this.tag = tag;
|
||||
this.components = components;
|
||||
this.color = color;
|
||||
this.image = image;
|
||||
this.blend = blend;
|
||||
aspects.put(tag, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
|
||||
*/
|
||||
public Aspect(String tag, int color, Aspect[] components)
|
||||
{
|
||||
this(tag, color, components, new ResourceLocation("thaumcraft", "textures/aspects/" + tag.toLowerCase() + ".png"), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
|
||||
*/
|
||||
public Aspect(String tag, int color, Aspect[] components, int blend)
|
||||
{
|
||||
this(tag, color, components, new ResourceLocation("thaumcraft", "textures/aspects/" + tag.toLowerCase() + ".png"), blend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut constructor I use for the primal aspects -
|
||||
* you shouldn't use this as making your own primal aspects will break all the things.
|
||||
*/
|
||||
public Aspect(String tag, int color, String chatcolor, int blend)
|
||||
{
|
||||
this(tag, color, (Aspect[])null, blend);
|
||||
this.setChatcolor(chatcolor);
|
||||
}
|
||||
|
||||
public int getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return WordUtils.capitalizeFully(tag);
|
||||
}
|
||||
|
||||
public String getLocalizedDescription()
|
||||
{
|
||||
return StatCollector.translateToLocal("tc.aspect." + tag);
|
||||
}
|
||||
|
||||
public String getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag)
|
||||
{
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public Aspect[] getComponents()
|
||||
{
|
||||
return components;
|
||||
}
|
||||
|
||||
public void setComponents(Aspect[] components)
|
||||
{
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
public ResourceLocation getImage()
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
public static Aspect getAspect(String tag)
|
||||
{
|
||||
return aspects.get(tag);
|
||||
}
|
||||
|
||||
public int getBlend()
|
||||
{
|
||||
return blend;
|
||||
}
|
||||
|
||||
public void setBlend(int blend)
|
||||
{
|
||||
this.blend = blend;
|
||||
}
|
||||
|
||||
public boolean isPrimal()
|
||||
{
|
||||
return getComponents() == null || getComponents().length != 2;
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
public static ArrayList<Aspect> getPrimalAspects()
|
||||
{
|
||||
ArrayList<Aspect> primals = new ArrayList<Aspect>();
|
||||
Collection<Aspect> pa = aspects.values();
|
||||
|
||||
for (Aspect aspect: pa)
|
||||
{
|
||||
if (aspect.isPrimal())
|
||||
{
|
||||
primals.add(aspect);
|
||||
}
|
||||
}
|
||||
|
||||
return primals;
|
||||
}
|
||||
|
||||
public static ArrayList<Aspect> getCompoundAspects()
|
||||
{
|
||||
ArrayList<Aspect> compounds = new ArrayList<Aspect>();
|
||||
Collection<Aspect> pa = aspects.values();
|
||||
|
||||
for (Aspect aspect: pa)
|
||||
{
|
||||
if (!aspect.isPrimal())
|
||||
{
|
||||
compounds.add(aspect);
|
||||
}
|
||||
}
|
||||
|
||||
return compounds;
|
||||
}
|
||||
|
||||
public String getChatcolor()
|
||||
{
|
||||
return chatcolor;
|
||||
}
|
||||
|
||||
public void setChatcolor(String chatcolor)
|
||||
{
|
||||
this.chatcolor = chatcolor;
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
public static LinkedHashMap<String, Aspect> aspects = new LinkedHashMap<String, Aspect>();
|
||||
|
||||
//PRIMAL
|
||||
public static final Aspect AIR = new Aspect("aer", 0xffff7e, "e", 1);
|
||||
public static final Aspect EARTH = new Aspect("terra", 0x56c000, "2", 1);
|
||||
public static final Aspect FIRE = new Aspect("ignis", 0xff5a01, "c", 1);
|
||||
public static final Aspect WATER = new Aspect("aqua", 0x3cd4fc, "3", 1);
|
||||
public static final Aspect ORDER = new Aspect("ordo", 0xd5d4ec, "7", 1);
|
||||
public static final Aspect ENTROPY = new Aspect("perditio", 0x404040, "8", 771);
|
||||
|
||||
//SECONDARY TODO
|
||||
public static final Aspect VOID = new Aspect("vacuos", 0x888888, new Aspect[] {AIR, ENTROPY}, 771);
|
||||
public static final Aspect LIGHT = new Aspect("lux", 0xfff663, new Aspect[] {AIR, FIRE});
|
||||
public static final Aspect ENERGY = new Aspect("potentia", 0xc0ffff, new Aspect[] {ORDER, FIRE});
|
||||
public static final Aspect MOTION = new Aspect("motus", 0xcdccf4, new Aspect[] {AIR, ORDER});
|
||||
public static final Aspect STONE = new Aspect("saxum", 0x808080, new Aspect[] {EARTH, EARTH});
|
||||
public static final Aspect LIFE = new Aspect("victus", 0xde0005, new Aspect[] {WATER, EARTH});
|
||||
public static final Aspect WEATHER = new Aspect("tempestas", 0xFFFFFF, new Aspect[] {AIR, WATER});
|
||||
public static final Aspect ICE = new Aspect("gelum", 0xe1ffff, new Aspect[] {WATER, ORDER});
|
||||
public static final Aspect CRYSTAL = new Aspect("vitreus", 0x80ffff, new Aspect[] {STONE, WATER});
|
||||
|
||||
//TERTIARY TODO
|
||||
|
||||
public static final Aspect DEATH = new Aspect("mortuus", 0x887788, new Aspect[] {LIFE, ENTROPY});
|
||||
public static final Aspect FLIGHT = new Aspect("volatus", 0xe7e7d7, new Aspect[] {AIR, MOTION});
|
||||
public static final Aspect DARKNESS = new Aspect("tenebrae", 0x222222, new Aspect[] {VOID, LIGHT});
|
||||
public static final Aspect SOUL = new Aspect("spiritus", 0xebebfb, new Aspect[] {LIFE, DEATH});
|
||||
public static final Aspect HEAL = new Aspect("sano", 0xff2f34, new Aspect[] {LIFE, LIFE});
|
||||
|
||||
public static final Aspect TRAVEL = new Aspect("iter", 0xe0585b, new Aspect[] {MOTION, EARTH});
|
||||
public static final Aspect POISON = new Aspect("venenum", 0x89f000, new Aspect[] {WATER, DEATH});
|
||||
|
||||
public static final Aspect ELDRITCH = new Aspect("alienis", 0x805080, new Aspect[] {VOID, DARKNESS});
|
||||
public static final Aspect MAGIC = new Aspect("praecantatio", 0x9700c0, new Aspect[] {VOID, ENERGY});
|
||||
public static final Aspect AURA = new Aspect("auram", 0xffc0ff, new Aspect[] {MAGIC, AIR});
|
||||
public static final Aspect TAINT = new Aspect("vitium", 0x800080, new Aspect[] {MAGIC, ENTROPY});
|
||||
|
||||
public static final Aspect SEED = new Aspect("granum", 0xeea16e, new Aspect[] {LIFE, EARTH});
|
||||
public static final Aspect SLIME = new Aspect("limus", 0x01f800, new Aspect[] {LIFE, WATER});
|
||||
public static final Aspect PLANT = new Aspect("herba", 0x01ac00, new Aspect[] {SEED, EARTH});
|
||||
public static final Aspect TREE = new Aspect("arbor", 0x876531, new Aspect[] {EARTH, PLANT});
|
||||
|
||||
public static final Aspect BEAST = new Aspect("bestia", 0x9f6409, new Aspect[] {MOTION, LIFE});
|
||||
public static final Aspect FLESH = new Aspect("corpus", 0xee478d, new Aspect[] {DEATH, BEAST});
|
||||
public static final Aspect UNDEAD = new Aspect("exanimis", 0x3a4000, new Aspect[] {MOTION, DEATH});
|
||||
public static final Aspect MIND = new Aspect("cognitio", 0xffc2b3, new Aspect[] {EARTH, SOUL});
|
||||
public static final Aspect SENSES = new Aspect("sensus", 0x0fd9ff, new Aspect[] {AIR, SOUL});
|
||||
|
||||
public static final Aspect MAN = new Aspect("humanus", 0xffd7c0, new Aspect[] {BEAST, MIND});
|
||||
public static final Aspect CROP = new Aspect("messis", 0xe1b371, new Aspect[] {SEED, MAN});
|
||||
public static final Aspect HARVEST = new Aspect("meto", 0xeead82, new Aspect[] {CROP, MAN});
|
||||
public static final Aspect METAL = new Aspect("metallum", 0xb5b5cd, new Aspect[] {STONE, ORDER});
|
||||
public static final Aspect MINE = new Aspect("perfodio", 0xdcd2d8, new Aspect[] {MAN, STONE});
|
||||
public static final Aspect TOOL = new Aspect("instrumentum", 0x4040ee, new Aspect[] {MAN, METAL});
|
||||
public static final Aspect WEAPON = new Aspect("telum", 0xc05050, new Aspect[] {TOOL, ENTROPY});
|
||||
public static final Aspect ARMOR = new Aspect("tutamen", 0x00c0c0, new Aspect[] {TOOL, EARTH});
|
||||
public static final Aspect HUNGER = new Aspect("fames", 0x9a0305, new Aspect[] {LIFE, VOID});
|
||||
public static final Aspect GREED = new Aspect("lucrum", 0xe6be44, new Aspect[] {MAN, HUNGER});
|
||||
public static final Aspect CRAFT = new Aspect("fabrico", 0x809d80, new Aspect[] {MAN, TOOL});
|
||||
|
||||
public static final Aspect CLOTH = new Aspect("pannus", 0xeaeac2, new Aspect[] {TOOL, BEAST});
|
||||
public static final Aspect MECHANISM = new Aspect("machina", 0x8080a0, new Aspect[] {MOTION, TOOL});
|
||||
public static final Aspect TRAP = new Aspect("vinculum", 0x9a8080, new Aspect[] {MOTION, ENTROPY});
|
||||
public static final Aspect EXCHANGE = new Aspect("permutatio", 0x578357, new Aspect[] {MOTION, WATER});
|
||||
|
||||
// public static final Aspect LAVA = new Aspect("lava",0xe85729, new Aspect[] {EARTH, FIRE});
|
||||
// public static final Aspect STEAM = new Aspect("steam",0xFFFFFF, new Aspect[] {WATER, FIRE});
|
||||
// public static final Aspect MUD = new Aspect("lutum",0x473423, new Aspect[] {WATER, EARTH});
|
||||
// public static final Aspect SAND = new Aspect("sand",0xFFFFFF, new Aspect[] {AIR, EARTH});
|
||||
// public static final Aspect ASTRAL = new Aspect("Astral",0xFFFFFF, new Aspect[] {VOID, DARKNESS});
|
||||
// public static final Aspect HARM = new Aspect("Harm",0xFFFFFF, new Aspect[] {ENTROPY, LIFE});
|
||||
// public static final Aspect BIRD = new Aspect("Bird",0xFFFFFF, new Aspect[] {BEAST, AIR});
|
||||
// public static final Aspect FISH = new Aspect("Fish",0xFFFFFF, new Aspect[] {BEAST, WATER});
|
||||
}
|
311
BM_src/thaumcraft/api/aspects/AspectList.java
Normal file
311
BM_src/thaumcraft/api/aspects/AspectList.java
Normal file
|
@ -0,0 +1,311 @@
|
|||
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
|
||||
|
||||
/**
|
||||
* 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 meta the damage value of an existing item
|
||||
*/
|
||||
public AspectList(int id, int meta)
|
||||
{
|
||||
try
|
||||
{
|
||||
AspectList temp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id, 1, meta));
|
||||
|
||||
if (temp != null)
|
||||
for (Aspect tag: temp.getAspects())
|
||||
{
|
||||
add(tag, temp.getAmount(tag));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {}
|
||||
}
|
||||
|
||||
public AspectList()
|
||||
{
|
||||
}
|
||||
|
||||
public AspectList copy()
|
||||
{
|
||||
AspectList out = new AspectList();
|
||||
|
||||
for (Aspect a: this.getAspects())
|
||||
{
|
||||
out.add(a, this.getAmount(a));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of different aspects in this collection
|
||||
*/
|
||||
public int size()
|
||||
{
|
||||
return aspects.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of total vis in this collection
|
||||
*/
|
||||
public int visSize()
|
||||
{
|
||||
int q = 0;
|
||||
|
||||
for (Aspect as: aspects.keySet())
|
||||
{
|
||||
q += this.getAmount(as);
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection
|
||||
*/
|
||||
public Aspect[] getAspects()
|
||||
{
|
||||
Aspect[] q = new Aspect[1];
|
||||
return aspects.keySet().toArray(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection
|
||||
*/
|
||||
public Aspect[] getPrimalAspects()
|
||||
{
|
||||
AspectList t = new AspectList();
|
||||
|
||||
for (Aspect as: aspects.keySet())
|
||||
{
|
||||
if (as.isPrimal())
|
||||
{
|
||||
t.add(as, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Aspect[] q = new Aspect[1];
|
||||
return t.aspects.keySet().toArray(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection sorted by name
|
||||
*/
|
||||
public Aspect[] getAspectsSorted()
|
||||
{
|
||||
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
|
||||
boolean change = false;
|
||||
|
||||
do
|
||||
{
|
||||
change = false;
|
||||
|
||||
for (int a = 0; a < out.length - 1; a++)
|
||||
{
|
||||
Aspect e1 = out[a];
|
||||
Aspect e2 = out[a + 1];
|
||||
|
||||
if (e1 != null && e2 != null && e1.getTag().compareTo(e2.getTag()) > 0)
|
||||
{
|
||||
out[a] = e2;
|
||||
out[a + 1] = e1;
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (change == true);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection sorted by amount
|
||||
*/
|
||||
public Aspect[] getAspectsSortedAmount()
|
||||
{
|
||||
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
|
||||
boolean change = false;
|
||||
|
||||
do
|
||||
{
|
||||
change = false;
|
||||
|
||||
for (int a = 0; a < out.length - 1; a++)
|
||||
{
|
||||
int e1 = getAmount(out[a]);
|
||||
int e2 = getAmount(out[a + 1]);
|
||||
|
||||
if (e1 > 0 && e2 > 0 && e2 > e1)
|
||||
{
|
||||
Aspect ea = out[a];
|
||||
Aspect eb = out[a + 1];
|
||||
out[a] = eb;
|
||||
out[a + 1] = ea;
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (change == true);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the amount associated with the given aspect in this collection
|
||||
*/
|
||||
public int getAmount(Aspect 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
|
||||
*/
|
||||
public boolean reduce(Aspect key, int amount)
|
||||
{
|
||||
if (getAmount(key) >= amount)
|
||||
{
|
||||
int am = getAmount(key) - amount;
|
||||
aspects.put(key, am);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public AspectList remove(Aspect key, int amount)
|
||||
{
|
||||
int am = getAmount(key) - amount;
|
||||
|
||||
if (am <= 0)
|
||||
{
|
||||
aspects.remove(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.aspects.put(key, am);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply removes the aspect from the list
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList remove(Aspect key)
|
||||
{
|
||||
aspects.remove(key);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public AspectList add(Aspect aspect, int amount)
|
||||
{
|
||||
if (this.aspects.containsKey(aspect))
|
||||
{
|
||||
int oldamount = this.aspects.get(aspect);
|
||||
amount += oldamount;
|
||||
}
|
||||
|
||||
this.aspects.put(aspect, amount);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public AspectList merge(Aspect aspect, int amount)
|
||||
{
|
||||
if (this.aspects.containsKey(aspect))
|
||||
{
|
||||
int oldamount = this.aspects.get(aspect);
|
||||
|
||||
if (amount < oldamount)
|
||||
{
|
||||
amount = oldamount;
|
||||
}
|
||||
}
|
||||
|
||||
this.aspects.put(aspect, amount);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the list of aspects from nbt
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
aspects.clear();
|
||||
NBTTagList tlist = nbttagcompound.getTagList("Aspects");
|
||||
|
||||
for (int j = 0; j < tlist.tagCount(); j++)
|
||||
{
|
||||
NBTTagCompound rs = (NBTTagCompound) tlist.tagAt(j);
|
||||
|
||||
if (rs.hasKey("key"))
|
||||
{
|
||||
add(Aspect.getAspect(rs.getString("key")),
|
||||
rs.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the list of aspects to nbt
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
NBTTagList tlist = new NBTTagList();
|
||||
nbttagcompound.setTag("Aspects", tlist);
|
||||
|
||||
for (Aspect aspect : getAspects())
|
||||
if (aspect != null)
|
||||
{
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("key", aspect.getTag());
|
||||
f.setInteger("amount", getAmount(aspect));
|
||||
tlist.appendTag(f);
|
||||
}
|
||||
}
|
||||
}
|
67
BM_src/thaumcraft/api/aspects/IAspectContainer.java
Normal file
67
BM_src/thaumcraft/api/aspects/IAspectContainer.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Used by blocks like the crucible and alembic to hold their aspects.
|
||||
* Tiles extending this interface will have their aspects show up when viewed by goggles of revealing
|
||||
*
|
||||
*/
|
||||
public interface IAspectContainer
|
||||
{
|
||||
public AspectList getAspects();
|
||||
public void setAspects(AspectList aspects);
|
||||
|
||||
/**
|
||||
* This method is used to determine of a specific aspect can be added to this container.
|
||||
* @param tag
|
||||
* @return true or false
|
||||
*/
|
||||
public boolean doesContainerAccept(Aspect tag);
|
||||
|
||||
/**
|
||||
* This method is used to add a certain amount of an aspect to the tile entity.
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return the amount of aspect left over that could not be added.
|
||||
*/
|
||||
public int addToContainer(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* Removes a certain amount of a specific aspect from the tile entity
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return true if that amount of aspect was available and was removed
|
||||
*/
|
||||
public boolean takeFromContainer(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* removes a bunch of different aspects and amounts from the tile entity.
|
||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
||||
* @return true if all the aspects and their amounts were available and successfully removed
|
||||
*/
|
||||
public boolean takeFromContainer(AspectList ot);
|
||||
|
||||
/**
|
||||
* Checks if the tile entity contains the listed amount (or more) of the aspect
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean doesContainerContainAmount(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* Checks if the tile entity contains all the listed aspects and their amounts
|
||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
||||
* @return
|
||||
*/
|
||||
public boolean doesContainerContain(AspectList ot);
|
||||
|
||||
/**
|
||||
* Returns how much of the aspect this tile entity contains
|
||||
* @param tag
|
||||
* @return the amount of that aspect found
|
||||
*/
|
||||
public int containerContains(Aspect tag);
|
||||
}
|
12
BM_src/thaumcraft/api/aspects/IAspectSource.java
Normal file
12
BM_src/thaumcraft/api/aspects/IAspectSource.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
*
|
||||
* This interface is implemented by tile entites (or possibly anything else) like jars
|
||||
* so that they can act as an essentia source for blocks like the infusion altar.
|
||||
*
|
||||
*/
|
||||
public interface IAspectSource extends IAspectContainer
|
||||
{
|
||||
}
|
38
BM_src/thaumcraft/api/aspects/IEssentiaContainerItem.java
Normal file
38
BM_src/thaumcraft/api/aspects/IEssentiaContainerItem.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Used by wispy essences and essentia phials to hold their aspects.
|
||||
* Useful for similar item containers that store their aspect information in nbt form so TC
|
||||
* automatically picks up the aspects they contain
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaContainerItem
|
||||
{
|
||||
public AspectList getAspects(ItemStack itemstack);
|
||||
public void setAspects(ItemStack itemstack, AspectList aspects);
|
||||
}
|
||||
|
||||
//Example implementation
|
||||
/*
|
||||
@Override
|
||||
public AspectList getAspects(ItemStack itemstack) {
|
||||
if (itemstack.hasTagCompound()) {
|
||||
AspectList aspects = new AspectList();
|
||||
aspects.readFromNBT(itemstack.getTagCompound());
|
||||
return aspects.size()>0?aspects:null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(ItemStack itemstack, AspectList aspects) {
|
||||
if (!itemstack.hasTagCompound()) itemstack.setTagCompound(new NBTTagCompound());
|
||||
aspects.writeToNBT(itemstack.getTagCompound());
|
||||
}
|
||||
*/
|
86
BM_src/thaumcraft/api/aspects/IEssentiaTransport.java
Normal file
86
BM_src/thaumcraft/api/aspects/IEssentiaTransport.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
* This interface is used by tiles that use or transport vis.
|
||||
* Only tiles that implement this interface will be able to connect to vis conduits or other thaumic devices
|
||||
*/
|
||||
public interface IEssentiaTransport
|
||||
{
|
||||
/**
|
||||
* Is this tile able to connect to other vis users/sources on the specified side?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
public boolean isConnectable(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Is this side used to input essentia?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
boolean canInputFrom(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Is this side used to output essentia?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
boolean canOutputTo(ForgeDirection face);
|
||||
|
||||
// /**
|
||||
// * Can this tile act as a source of vis?
|
||||
// * @return
|
||||
// */
|
||||
// public boolean isVisSource();
|
||||
//
|
||||
// /**
|
||||
// * Is this tile a conduit that transports vis?
|
||||
// * @return
|
||||
// */
|
||||
// public boolean isVisConduit();
|
||||
|
||||
/**
|
||||
* Sets the amount of suction this block will apply
|
||||
* @param suction
|
||||
*/
|
||||
public void setSuction(AspectList suction);
|
||||
|
||||
/**
|
||||
* Sets the amount of suction this block will apply
|
||||
* @param suction
|
||||
*/
|
||||
public void setSuction(Aspect aspect, int amount);
|
||||
|
||||
/**
|
||||
* Returns the amount of suction this block is applying.
|
||||
* @param loc
|
||||
* the location from where the suction is being checked
|
||||
* @return
|
||||
*/
|
||||
public AspectList getSuction(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* remove the specified amount of vis from this transport tile
|
||||
* @param suction
|
||||
* @return how much was actually taken
|
||||
*/
|
||||
public int takeVis(Aspect aspect, int amount);
|
||||
|
||||
public AspectList getEssentia(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Essentia will not be drawn from this container unless the suction exceeds this amount.
|
||||
* @return the amount
|
||||
*/
|
||||
public int getMinimumSuction();
|
||||
|
||||
/**
|
||||
* Return true if you want the conduit to extend a little further into the block.
|
||||
* Used by jars and alembics that have smaller than normal hitboxes
|
||||
* @return
|
||||
*/
|
||||
boolean renderExtendedTube();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue