Updated to an experimental Thaumcraft 3.1 API
This commit is contained in:
parent
3e7eceb3f7
commit
39ee1ed874
42 changed files with 3185 additions and 2950 deletions
|
@ -1,9 +1,9 @@
|
|||
package biomesoplenty.integration;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import biomesoplenty.api.BlockReferences;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.api.Fluids;
|
||||
|
@ -28,192 +28,192 @@ public class ThaumcraftIntegration {
|
|||
private static void addAspects()
|
||||
{
|
||||
|
||||
//TODO: Ensure all tags are balanced (Logs shouldn't give more light when turned into planks)
|
||||
//TODO: Compare against Thaumcraft 3.1 defaults and check balancing
|
||||
|
||||
//Woods
|
||||
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaLog"), getBMeta("acaciaLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cherryLog"), getBMeta("cherryLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaLog"), getBMeta("acaciaLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cherryLog"), getBMeta("cherryLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkLog"), getBMeta("darkLog"), (new ObjectTags()).add(EnumTag.WOOD, 8).add(EnumTag.DARK, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firLog"), getBMeta("firLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkLog"), getBMeta("darkLog"), (new AspectList()).add(Aspect.TREE, 4).add(Aspect.DARKNESS, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firLog"), getBMeta("firLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyLog"), getBMeta("holyLog"), (new ObjectTags()).add(EnumTag.WOOD, 8).add(EnumTag.LIGHT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicLog"), getBMeta("magicLog"), (new ObjectTags()).add(EnumTag.WOOD, 8).add(EnumTag.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveLog"), getBMeta("mangroveLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmLog"), getBMeta("palmLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyLog"), getBMeta("holyLog"), (new AspectList()).add(Aspect.TREE, 4).add(Aspect.LIGHT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicLog"), getBMeta("magicLog"), (new AspectList()).add(Aspect.TREE, 4).add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveLog"), getBMeta("mangroveLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmLog"), getBMeta("palmLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodLog"), getBMeta("redwoodLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowLog"), getBMeta("willowLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineLog"), getBMeta("pineLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkLog"), getBMeta("hellBarkLog"), (new ObjectTags()).add(EnumTag.WOOD, 8).add(EnumTag.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaLog"), getBMeta("jacarandaLog"), (new ObjectTags()).add(EnumTag.WOOD, 8));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadLog"), getBMeta("deadLog"), (new ObjectTags()).add(EnumTag.WOOD, 8)); ///Working
|
||||
ThaumcraftApi.registerObjectTag(getBID("bigFlowerStem"), getBMeta("bigFlowerStem"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodLog"), getBMeta("redwoodLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowLog"), getBMeta("willowLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineLog"), getBMeta("pineLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkLog"), getBMeta("hellBarkLog"), (new AspectList()).add(Aspect.TREE, 4).add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaLog"), getBMeta("jacarandaLog"), (new AspectList()).add(Aspect.TREE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadLog"), getBMeta("deadLog"), (new AspectList()).add(Aspect.TREE, 4)); ///Working
|
||||
ThaumcraftApi.registerObjectTag(getBID("bigFlowerStem"), getBMeta("bigFlowerStem"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1));
|
||||
|
||||
//Planks
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaPlank"), getBMeta("acaciaPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cherryPlank"), getBMeta("cherryPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkPlank"), getBMeta("darkPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2)/*.add(EnumTag.DARK, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("firPlank"), getBMeta("firPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyPlank"), getBMeta("holyPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2)/*.add(EnumTag.LIGHT, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicPlank"), getBMeta("magicPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2)/*.add(EnumTag.MAGIC, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangrovePlank"), getBMeta("mangrovePlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmPlank"), getBMeta("palmPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodPlank"), getBMeta("redwoodPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowPlank"), getBMeta("willowPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinePlank"), getBMeta("pinePlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkPlank"), getBMeta("hellBarkPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2).add(EnumTag.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaPlank"), getBMeta("jacarandaPlank"), (new ObjectTags()).add(EnumTag.WOOD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooThatching"), getBMeta("bambooThatching"), (new ObjectTags()).add(EnumTag.WATER, 14).add(EnumTag.PLANT, 14));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaPlank"), getBMeta("acaciaPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cherryPlank"), getBMeta("cherryPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkPlank"), getBMeta("darkPlank"), (new AspectList()).add(Aspect.TREE, 1)/*.add(Aspect.DARK, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("firPlank"), getBMeta("firPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyPlank"), getBMeta("holyPlank"), (new AspectList()).add(Aspect.TREE, 1)/*.add(Aspect.LIGHT, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicPlank"), getBMeta("magicPlank"), (new AspectList()).add(Aspect.TREE, 1)/*.add(Aspect.MAGIC, 1)*/);
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangrovePlank"), getBMeta("mangrovePlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmPlank"), getBMeta("palmPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodPlank"), getBMeta("redwoodPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowPlank"), getBMeta("willowPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinePlank"), getBMeta("pinePlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkPlank"), getBMeta("hellBarkPlank"), (new AspectList()).add(Aspect.TREE, 1).add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaPlank"), getBMeta("jacarandaPlank"), (new AspectList()).add(Aspect.TREE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooThatching"), getBMeta("bambooThatching"), (new AspectList()).add(Aspect.WATER, 14).add(Aspect.PLANT, 14));
|
||||
|
||||
//Leaves
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyLeaves"), getBMeta("holyLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicLeaves"), getBMeta("magicLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkLeaves"), getBMeta("darkLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.DARK, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadLeaves"), getBMeta("deadLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.DEATH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleLeaves"), getBMeta("appleLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaLeaves"), getBMeta("acaciaLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firLeaves"), getBMeta("firLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveLeaves"), getBMeta("mangroveLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmLeaves"), getBMeta("palmLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodLeaves"), getBMeta("redwoodLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowLeaves"), getBMeta("willowLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("yellowAutumnLeaves"), getBMeta("yellowAutumnLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mapleLeaves"), getBMeta("mapleLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("orangeAutumnLeaves"), getBMeta("orangeAutumnLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinkCherryLeaves"), getBMeta("pinkCherryLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("whiteCherryLeaves"), getBMeta("whiteCherryLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineLeaves"), getBMeta("pineLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkLeaves"), getBMeta("hellBarkLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaLeaves"), getBMeta("jacarandaLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooLeaves"), getBMeta("bambooLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originLeaves"), getBMeta("originLeaves"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleLeavesFruitless"), getBMeta("appleLeavesFruitless"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyLeaves"), getBMeta("holyLeaves"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicLeaves"), getBMeta("magicLeaves"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkLeaves"), getBMeta("darkLeaves"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.DARKNESS, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadLeaves"), getBMeta("deadLeaves"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.DEATH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleLeaves"), getBMeta("appleLeaves"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaLeaves"), getBMeta("acaciaLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firLeaves"), getBMeta("firLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveLeaves"), getBMeta("mangroveLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmLeaves"), getBMeta("palmLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodLeaves"), getBMeta("redwoodLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowLeaves"), getBMeta("willowLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("yellowAutumnLeaves"), getBMeta("yellowAutumnLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mapleLeaves"), getBMeta("mapleLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("orangeAutumnLeaves"), getBMeta("orangeAutumnLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinkCherryLeaves"), getBMeta("pinkCherryLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("whiteCherryLeaves"), getBMeta("whiteCherryLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineLeaves"), getBMeta("pineLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkLeaves"), getBMeta("hellBarkLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaLeaves"), getBMeta("jacarandaLeaves"), (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooLeaves"), getBMeta("bambooLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originLeaves"), getBMeta("originLeaves"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleLeavesFruitless"), getBMeta("appleLeavesFruitless"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
|
||||
//Saplings
|
||||
ThaumcraftApi.registerObjectTag(getBID("holySapling"), getBMeta("holySapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2).add(EnumTag.LIGHT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicSapling"), getBMeta("magicSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2).add(EnumTag.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkSapling"), getBMeta("darkSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2).add(EnumTag.DARK, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadSapling"), getBMeta("deadSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2).add(EnumTag.DEATH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaSapling"), getBMeta("acaciaSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firSapling"), getBMeta("firSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveSapling"), getBMeta("mangroveSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmSapling"), getBMeta("palmSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodSapling"), getBMeta("redwoodSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowSapling"), getBMeta("willowSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mapleSapling"), getBMeta("mapleSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("orangeAutumnSapling"), getBMeta("orangeAutumnSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinkCherrySapling"), getBMeta("pinkCherrySapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("whiteCherrySapling"), getBMeta("whiteCherrySapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleSapling"), getBMeta("appleSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originSapling"), getBMeta("originSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("yellowAutumnSapling"), getBMeta("yellowAutumnSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineSapling"), getBMeta("pineSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkSapling"), getBMeta("hellBarkSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2).add(EnumTag.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaSapling"), getBMeta("jacarandaSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooSapling"), getBMeta("bambooSapling"), (new ObjectTags()).add(EnumTag.WOOD, 4).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holySapling"), getBMeta("holySapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.LIGHT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("magicSapling"), getBMeta("magicSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("darkSapling"), getBMeta("darkSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.DARKNESS, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadSapling"), getBMeta("deadSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.DEATH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("acaciaSapling"), getBMeta("acaciaSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("firSapling"), getBMeta("firSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mangroveSapling"), getBMeta("mangroveSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("palmSapling"), getBMeta("palmSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redwoodSapling"), getBMeta("redwoodSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willowSapling"), getBMeta("willowSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mapleSapling"), getBMeta("mapleSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("orangeAutumnSapling"), getBMeta("orangeAutumnSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pinkCherrySapling"), getBMeta("pinkCherrySapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("whiteCherrySapling"), getBMeta("whiteCherrySapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("appleSapling"), getBMeta("appleSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originSapling"), getBMeta("originSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("yellowAutumnSapling"), getBMeta("yellowAutumnSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("pineSapling"), getBMeta("pineSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hellBarkSapling"), getBMeta("hellBarkSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("jacarandaSapling"), getBMeta("jacarandaSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bambooSapling"), getBMeta("bambooSapling"), (new AspectList()).add(Aspect.TREE, 2).add(Aspect.PLANT, 2));
|
||||
|
||||
//Blocks
|
||||
ThaumcraftApi.registerObjectTag(getBID("mud"), getBMeta("mud"), (new ObjectTags()).add(EnumTag.WATER, 3).add(EnumTag.EARTH, 6));
|
||||
ThaumcraftApi.registerObjectTag(getBID("driedDirt"), getBMeta("driedDirt"), (new ObjectTags()).add(EnumTag.DESTRUCTION, 1).add(EnumTag.EARTH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redRock"), getBMeta("redRock"), (new ObjectTags()).add(EnumTag.ROCK, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("ash"), getBMeta("ash"), (new ObjectTags()).add(EnumTag.DESTRUCTION, 3).add(EnumTag.EXCHANGE, 3));
|
||||
ThaumcraftApi.registerObjectTag(getBID("ashStone"), getBMeta("ashStone"), (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardIce"), getBMeta("hardIce"), (new ObjectTags()).add(EnumTag.ROCK, 2).add(EnumTag.COLD, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originGrass"), getBMeta("originGrass"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardSand"), getBMeta("hardSand"), (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardDirt"), getBMeta("hardDirt"), (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyGrass"), getBMeta("holyGrass"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.EARTH, 2).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyDirt"), getBMeta("holyDirt"), (new ObjectTags()).add(EnumTag.LIGHT, 1).add(EnumTag.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyStone"), getBMeta("holyStone"), (new ObjectTags()).add(EnumTag.LIGHT, 1).add(EnumTag.ROCK, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("crystal"), getBMeta("crystal"), (new ObjectTags()).add(EnumTag.VALUABLE, 58).add(EnumTag.LIGHT, 15).add(EnumTag.MAGIC, 20).add(EnumTag.CRYSTAL, 50));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cragRock"), getBMeta("cragRock"), (new ObjectTags()).add(EnumTag.ROCK, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("quicksand"), getBMeta("quicksand"), (new ObjectTags()).add(EnumTag.EARTH, 2).add(EnumTag.TRAP, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("smolderingGrass"), getBMeta("smolderingGrass"), (new ObjectTags()).add(EnumTag.EARTH, 2).add(EnumTag.FIRE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("amethystBlock"), getBMeta("amethystBlock"), (new ObjectTags()).add(EnumTag.VALUABLE, 58).add(EnumTag.PURE, 58).add(EnumTag.CRYSTAL, 87));
|
||||
ThaumcraftApi.registerObjectTag(getBID("amethystOre"), getBMeta("amethystOre"), (new ObjectTags()).add(EnumTag.VALUABLE, 6).add(EnumTag.PURE, 6).add(EnumTag.CRYSTAL, 14).add(EnumTag.ROCK, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redRockCobble"), getBMeta("redRockCobble"), (new ObjectTags()).add(EnumTag.DESTRUCTION, 1).add(EnumTag.ROCK, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("giantFlowerRed"), getBMeta("giantFlowerRed"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("giantFlowerYellow"), getBMeta("giantFlowerYellow"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("smallBoneSegment"), getBMeta("smallBoneSegment"), (new ObjectTags()).add(EnumTag.FLESH, 1).add(EnumTag.DEATH, 3));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mediumBoneSegment"), getBMeta("mediumBoneSegment"), (new ObjectTags()).add(EnumTag.FLESH, 2).add(EnumTag.DEATH, 6));
|
||||
ThaumcraftApi.registerObjectTag(getBID("largeBoneSegment"), getBMeta("largeBoneSegment"), (new ObjectTags()).add(EnumTag.FLESH, 4).add(EnumTag.DEATH, 12));
|
||||
ThaumcraftApi.registerObjectTag(getBID("ivy"), getBMeta("ivy"), (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.FIRE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mud"), getBMeta("mud"), (new AspectList()).add(Aspect.WATER, 3).add(Aspect.EARTH, 6));
|
||||
ThaumcraftApi.registerObjectTag(getBID("driedDirt"), getBMeta("driedDirt"), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redRock"), getBMeta("redRock"), (new AspectList()).add(Aspect.STONE, 2));
|
||||
//ThaumcraftApi.registerObjectTag(getBID("ash"), getBMeta("ash"), (new AspectList()).add(Aspect.ENTROPY, 3).add(Aspect.EXCHANGE, 3));
|
||||
//ThaumcraftApi.registerObjectTag(getBID("ashStone"), getBMeta("ashStone"), (new AspectList()).add(Aspect.STONE, 1).add(Aspect.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardIce"), getBMeta("hardIce"), (new AspectList()).add(Aspect.STONE, 2).add(Aspect.ICE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("originGrass"), getBMeta("originGrass"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardSand"), getBMeta("hardSand"), (new AspectList()).add(Aspect.STONE, 1).add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hardDirt"), getBMeta("hardDirt"), (new AspectList()).add(Aspect.STONE, 1).add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyGrass"), getBMeta("holyGrass"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.EARTH, 2).add(Aspect.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyDirt"), getBMeta("holyDirt"), (new AspectList()).add(Aspect.LIGHT, 1).add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyStone"), getBMeta("holyStone"), (new AspectList()).add(Aspect.LIGHT, 1).add(Aspect.STONE, 2));
|
||||
//ThaumcraftApi.registerObjectTag(getBID("crystal"), getBMeta("crystal"), (new AspectList()).add(Aspect.VALUABLE, 58).add(Aspect.LIGHT, 15).add(Aspect.MAGIC, 20).add(Aspect.CRYSTAL, 50));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cragRock"), getBMeta("cragRock"), (new AspectList()).add(Aspect.STONE, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("quicksand"), getBMeta("quicksand"), (new AspectList()).add(Aspect.EARTH, 2).add(Aspect.TRAP, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("smolderingGrass"), getBMeta("smolderingGrass"), (new AspectList()).add(Aspect.EARTH, 2).add(Aspect.FIRE, 1));
|
||||
//ThaumcraftApi.registerObjectTag(getBID("amethystBlock"), getBMeta("amethystBlock"), (new AspectList()).add(Aspect.VALUABLE, 58).add(Aspect.ORDER, 58).add(Aspect.CRYSTAL, 87));
|
||||
//ThaumcraftApi.registerObjectTag(getBID("amethystOre"), getBMeta("amethystOre"), (new AspectList()).add(Aspect.VALUABLE, 6).add(Aspect.ORDER, 6).add(Aspect.CRYSTAL, 14).add(Aspect.STONE, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("redRockCobble"), getBMeta("redRockCobble"), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.STONE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("giantFlowerRed"), getBMeta("giantFlowerRed"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("giantFlowerYellow"), getBMeta("giantFlowerYellow"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("smallBoneSegment"), getBMeta("smallBoneSegment"), (new AspectList()).add(Aspect.FLESH, 1).add(Aspect.DEATH, 3));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mediumBoneSegment"), getBMeta("mediumBoneSegment"), (new AspectList()).add(Aspect.FLESH, 2).add(Aspect.DEATH, 6));
|
||||
ThaumcraftApi.registerObjectTag(getBID("largeBoneSegment"), getBMeta("largeBoneSegment"), (new AspectList()).add(Aspect.FLESH, 4).add(Aspect.DEATH, 12));
|
||||
ThaumcraftApi.registerObjectTag(getBID("ivy"), getBMeta("ivy"), (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.FIRE, 1));
|
||||
|
||||
for (int i = 10; i < 15; i++)
|
||||
{
|
||||
ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, i, (new ObjectTags()).add(EnumTag.VALUABLE, 4).add(EnumTag.CRYSTAL, 8));
|
||||
//ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, i, (new AspectList()).add(Aspect.VALUABLE, 4).add(Aspect.CRYSTAL, 8));
|
||||
}
|
||||
|
||||
String[] oreTypes = BlockBOPAmethyst.types;
|
||||
|
||||
for (int i = 2; i < oreTypes.length; i+=2)
|
||||
{
|
||||
ThaumcraftApi.registerObjectTag(Blocks.amethystOre.get().blockID, i, (new ObjectTags()).add(EnumTag.VALUABLE, 3).add(EnumTag.CRYSTAL, 7).add(EnumTag.ROCK, 4));
|
||||
//ThaumcraftApi.registerObjectTag(Blocks.amethystOre.get().blockID, i, (new AspectList()).add(Aspect.VALUABLE, 3).add(Aspect.CRYSTAL, 7).add(Aspect.STONE, 4));
|
||||
}
|
||||
|
||||
//Items
|
||||
/*Amethyst*/ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 2, (new ObjectTags()).add(EnumTag.VALUABLE, 8).add(EnumTag.PURE, 8).add(EnumTag.CRYSTAL, 16));
|
||||
/*Ashes*/ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 1, (new ObjectTags()).add(EnumTag.DESTRUCTION, 1).add(EnumTag.EXCHANGE, 1));
|
||||
/*Mudbrick*/ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 0, (new ObjectTags()).add(EnumTag.EARTH, 2).add(EnumTag.FIRE, 1));
|
||||
/*Dart*/ThaumcraftApi.registerObjectTag(Items.dart.get().itemID, 0, (new ObjectTags()).add(EnumTag.WEAPON, 1));
|
||||
/*Poison Dart*/ThaumcraftApi.registerObjectTag(Items.dart.get().itemID, 1, (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.WEAPON, 2));
|
||||
/*Spring Water Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 0, (new ObjectTags()).add(EnumTag.METAL, 13).add(EnumTag.VOID, 1).add(EnumTag.WATER, 4).add(EnumTag.LIFE, 2).add(EnumTag.HEAL, 4));
|
||||
/*Liquid Poison Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 1, (new ObjectTags()).add(EnumTag.METAL, 13).add(EnumTag.VOID, 1).add(EnumTag.WATER, 2).add(EnumTag.WEAPON, 4).add(EnumTag.POISON, 4));
|
||||
ThaumcraftApi.registerObjectTag(Items.food.get().itemID, 0, (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1));
|
||||
//ThaumcraftApi.registerObjectTag(Items.sunflowerSeeds.get().itemID, 0, (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(Items.mudball.get().itemID, 0, (new ObjectTags()).add(EnumTag.WATER, 1).add(EnumTag.EARTH, 2));
|
||||
//ThaumcraftApi.registerObjectTag(Items.shroomPowder.get().itemID, -1, (new ObjectTags()).add(EnumTag.FUNGUS, 2).add(EnumTag.DESTRUCTION, 1));
|
||||
ThaumcraftApi.registerObjectTag(Items.bopDisc.get().itemID, -1, (new ObjectTags()).add(EnumTag.SOUND, 12).add(EnumTag.VALUABLE, 4).add(EnumTag.CROP, 4));
|
||||
ThaumcraftApi.registerObjectTag(Items.bopDiscMud.get().itemID, -1, (new ObjectTags()).add(EnumTag.SOUND, 12).add(EnumTag.VALUABLE, 4).add(EnumTag.EARTH, 2).add(EnumTag.WATER, 2));
|
||||
/*Amethyst*///ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 2, (new AspectList()).add(Aspect.VALUABLE, 8).add(Aspect.PURE, 8).add(Aspect.CRYSTAL, 16));
|
||||
/*Ashes*///ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 1, (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EXCHANGE, 1));
|
||||
/*Mudbrick*/ThaumcraftApi.registerObjectTag(Items.miscItems.get().itemID, 0, (new AspectList()).add(Aspect.EARTH, 2).add(Aspect.FIRE, 1));
|
||||
/*Dart*/ThaumcraftApi.registerObjectTag(Items.dart.get().itemID, 0, (new AspectList()).add(Aspect.WEAPON, 1));
|
||||
/*Poison Dart*/ThaumcraftApi.registerObjectTag(Items.dart.get().itemID, 1, (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.WEAPON, 2));
|
||||
/*Spring Water Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 0, (new AspectList()).add(Aspect.METAL, 13).add(Aspect.VOID, 1).add(Aspect.WATER, 4).add(Aspect.LIFE, 2).add(Aspect.HEAL, 4));
|
||||
/*Liquid Poison Bucket*/ThaumcraftApi.registerObjectTag(Fluids.bopBucket.get().itemID, 1, (new AspectList()).add(Aspect.METAL, 13).add(Aspect.VOID, 1).add(Aspect.WATER, 2).add(Aspect.WEAPON, 4).add(Aspect.POISON, 4));
|
||||
ThaumcraftApi.registerObjectTag(Items.food.get().itemID, 0, (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIFE, 1));
|
||||
//ThaumcraftApi.registerObjectTag(Items.sunflowerSeeds.get().itemID, 0, (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(Items.mudball.get().itemID, 0, (new AspectList()).add(Aspect.WATER, 1).add(Aspect.EARTH, 2));
|
||||
//ThaumcraftApi.registerObjectTag(Items.shroomPowder.get().itemID, -1, (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.ENTROPY, 1));
|
||||
//ThaumcraftApi.registerObjectTag(Items.bopDisc.get().itemID, -1, (new AspectList()).add(Aspect.SENSES, 12).add(Aspect.VALUABLE, 4).add(Aspect.CROP, 4));
|
||||
//ThaumcraftApi.registerObjectTag(Items.bopDiscMud.get().itemID, -1, (new AspectList()).add(Aspect.SENSES, 12).add(Aspect.VALUABLE, 4).add(Aspect.EARTH, 2).add(Aspect.WATER, 2));
|
||||
|
||||
//Placer Items
|
||||
ThaumcraftApi.registerObjectTag(getBID("barley"), getBMeta("barley"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cattail"), getBMeta("cattail"), (new ObjectTags()).add(EnumTag.WATER, 1).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("reed"), getBMeta("reed"), (new ObjectTags()).add(EnumTag.WOOD, 1).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bamboo"), getBMeta("bamboo"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("sproutItem"), getBMeta("sproutItem"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bushItem"), getBMeta("bushItem"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("poisonIvyItem"), getBMeta("poisonIvyItem"), (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mediumGrassItem"), getBMeta("mediumGrassItem"), (new ObjectTags()).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("shortGrassItem"), getBMeta("shortGrassItem"), (new ObjectTags()).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("highGrassItem"), getBMeta("highGrassItem"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bushItem"), getBMeta("bushItem"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("algae"), getBMeta("algae"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.WATER, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("barley"), getBMeta("barley"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("cattail"), getBMeta("cattail"), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("reed"), getBMeta("reed"), (new AspectList()).add(Aspect.TREE, 1).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bamboo"), getBMeta("bamboo"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.LIFE, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("sproutItem"), getBMeta("sproutItem"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bushItem"), getBMeta("bushItem"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("poisonIvyItem"), getBMeta("poisonIvyItem"), (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("mediumGrassItem"), getBMeta("mediumGrassItem"), (new AspectList()).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("shortGrassItem"), getBMeta("shortGrassItem"), (new AspectList()).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("highGrassItem"), getBMeta("highGrassItem"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bushItem"), getBMeta("bushItem"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("algae"), getBMeta("algae"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.WATER, 1));
|
||||
|
||||
//Plants
|
||||
ThaumcraftApi.registerObjectTag(getBID("toadstool"), getBMeta("toadstool"), (new ObjectTags()).add(EnumTag.FUNGUS, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("portobello"), getBMeta("portobello"), (new ObjectTags()).add(EnumTag.FUNGUS, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bluemilk"), getBMeta("bluemilk"), (new ObjectTags()).add(EnumTag.FUNGUS, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("glowshroom"), getBMeta("glowshroom"), (new ObjectTags()).add(EnumTag.FUNGUS, 4).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("tinyCactus"), getBMeta("tinyCactus"), (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyTallGrass"), getBMeta("holyTallGrass"), (new ObjectTags()).add(EnumTag.WIND, 1).add(EnumTag.PLANT, 1).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("desertSprouts"), getBMeta("desertSprouts"), (new ObjectTags()).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("duneGrass"), getBMeta("duneGrass"), (new ObjectTags()).add(EnumTag.PLANT, 1).add(EnumTag.WIND, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("thorn"), getBMeta("thorn"), (new ObjectTags()).add(EnumTag.PLANT, 2).add(EnumTag.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("desertGrass"), getBMeta("desertGrass"), (new ObjectTags()).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadGrass"), getBMeta("deadGrass"), (new ObjectTags()).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("treeMoss"), getBMeta("treeMoss"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("moss"), getBMeta("moss"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willow"), getBMeta("willow"), (new ObjectTags()).add(EnumTag.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("toadstool"), getBMeta("toadstool"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("portobello"), getBMeta("portobello"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("bluemilk"), getBMeta("bluemilk"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("glowshroom"), getBMeta("glowshroom"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("tinyCactus"), getBMeta("tinyCactus"), (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("holyTallGrass"), getBMeta("holyTallGrass"), (new AspectList()).add(Aspect.AIR, 1).add(Aspect.PLANT, 1).add(Aspect.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("desertSprouts"), getBMeta("desertSprouts"), (new AspectList()).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("duneGrass"), getBMeta("duneGrass"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.AIR, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("thorn"), getBMeta("thorn"), (new AspectList()).add(Aspect.PLANT, 2).add(Aspect.WEAPON, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("desertGrass"), getBMeta("desertGrass"), (new AspectList()).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deadGrass"), getBMeta("deadGrass"), (new AspectList()).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("treeMoss"), getBMeta("treeMoss"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("moss"), getBMeta("moss"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
ThaumcraftApi.registerObjectTag(getBID("willow"), getBMeta("willow"), (new AspectList()).add(Aspect.PLANT, 2));
|
||||
|
||||
//Flowers
|
||||
ThaumcraftApi.registerObjectTag(getBID("violet"), getBMeta("violet"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hydrangea"), getBMeta("hydrangea"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deathbloom"), getBMeta("deathbloom"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.DEATH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("glowFlower"), getBMeta("glowFlower"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("anenome"), getBMeta("anenome"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("swampFlower"), getBMeta("swampFlower"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("wildFlower"), getBMeta("wildFlower"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("daisy"), getBMeta("daisy"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("dandelion"), getBMeta("dandelion"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("tulip"), getBMeta("tulip"), (new ObjectTags()).add(EnumTag.FLOWER, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("aloe"), getBMeta("aloe"), (new ObjectTags()).add(EnumTag.FLOWER, 4).add(EnumTag.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("clover"), getBMeta("clover"), (new ObjectTags()).add(EnumTag.FLOWER, 1).add(EnumTag.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("lilyflower"), getBMeta("lilyflower"), (new ObjectTags()).add(EnumTag.FLOWER, 1).add(EnumTag.PLANT, 1).add(EnumTag.WATER, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("rainbowflower"), getBMeta("rainbowflower"), (new ObjectTags()).add(EnumTag.FLOWER, 1).add(EnumTag.PLANT, 1).add(EnumTag.LIGHT, 1).add(EnumTag.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("sunflower"), getBMeta("sunflower"), (new ObjectTags()).add(EnumTag.FLOWER, 1).add(EnumTag.PLANT, 1).add(EnumTag.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("violet"), getBMeta("violet"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("hydrangea"), getBMeta("hydrangea"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("deathbloom"), getBMeta("deathbloom"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.DEATH, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("glowFlower"), getBMeta("glowFlower"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.LIGHT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("anenome"), getBMeta("anenome"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("swampFlower"), getBMeta("swampFlower"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("wildFlower"), getBMeta("wildFlower"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("daisy"), getBMeta("daisy"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("dandelion"), getBMeta("dandelion"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("tulip"), getBMeta("tulip"), (new AspectList()).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("aloe"), getBMeta("aloe"), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.PLANT, 4));
|
||||
ThaumcraftApi.registerObjectTag(getBID("clover"), getBMeta("clover"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.PLANT, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("lilyflower"), getBMeta("lilyflower"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.PLANT, 1).add(Aspect.WATER, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("rainbowflower"), getBMeta("rainbowflower"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.PLANT, 1).add(Aspect.LIGHT, 1).add(Aspect.MAGIC, 1));
|
||||
ThaumcraftApi.registerObjectTag(getBID("sunflower"), getBMeta("sunflower"), (new AspectList()).add(Aspect.PLANT, 1).add(Aspect.PLANT, 1).add(Aspect.LIGHT, 1));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum EnumTag {
|
||||
UNKNOWN (63,"Obscurus","Unknown, Obscured",1,false,0x282828),
|
||||
|
||||
WIND (0,"Aura","Air, Wind, Breath, Movement",1,false,0xc0c0d7),
|
||||
FIRE (6,"Ignis","Fire, Heat, Burn, Light",2,true,0xff5a01),
|
||||
ROCK (11,"Saxum","Earth, Stone, Ground, Foundation",4,false,0x5c4842),
|
||||
WATER (21,"Aqua","Water, Fluid, Cold",3,false,0x3cd4fc),
|
||||
|
||||
PLANT (36,"Herba","Herb, Plant, Grass",4,false,0x01ac00),
|
||||
BEAST (53,"Bestia","Animal, Beast",3,true,0x9f6409),
|
||||
FLESH (54,"Corpus","Body, Flesh, Physique",3,false,0xee478d),
|
||||
METAL (12,"Metallum","Metal, Mine, Ore",4,false,0xd8d8d8),
|
||||
CRYSTAL (20,"Vitreus","Glass, Crystal, Gem, Transparent",1,false,0x80ffff),
|
||||
SOUND (24,"Sonus","Sound, Noise, Din",3,false,0x10c9c0),
|
||||
|
||||
EXCHANGE (14,"Permutatio","Exchange, Change, Barter",4,false,0x578357),
|
||||
LIFE (26,"Victus","Life force, Food, Sustenance",3,false,0xde0005),
|
||||
DEATH (27,"Mortuus","Death, Decay, Undead",6,true,0x404040),
|
||||
SPIRIT (30,"Animus","Soul, Spirit",1,false,0xe0e0e0),
|
||||
VOID (2,"Vacuos","Empty, Void, Insubstantial",1,true,0xc0c0d7),
|
||||
VISION (3,"Visum","Sight, Vision, Appearance",3,false,0xd5d4ec),
|
||||
KNOWLEDGE (4,"Cognitio","Learning, Knowledge, Inquiry",1,false,0x8080ee),
|
||||
DESTRUCTION (7,"Fractus","Destruction, Fragmented, Shattered",2,true,0x506050),
|
||||
POWER (9,"Potentia","Power, Energy, Strength",2,true,0xc0ffff),
|
||||
MECHANISM (10,"Machina","Mechanism, Machine, Device",2,false,0x8080a0),
|
||||
ARMOR (17,"Tutamen","Defense, Protection, Security",4,false,0x00c0c0),
|
||||
WEAPON (18,"Telum","Arrow, Sword, Weapon",2,true,0xc05050),
|
||||
TOOL (19,"Instrumentum","Instrument, Tool, Implement",4,false,0x4040ee),
|
||||
POISON (29,"Venenum","Poison, Drug, Impure",3,true,0x89f000),
|
||||
VALUABLE (31,"Carus","Expensive, Precious, Valuable",4,false,0xe6be44),
|
||||
PURE (37,"Purus","Pure, Clean, Stainless",3,false,0xa5fffd),
|
||||
MAGIC (40,"Praecantatio","Magic, Sorcery",5,false,0x9700c0),
|
||||
TIME (41,"Tempus","Time, Moment, Season",5,false,0x9070e0),
|
||||
CONTROL (48,"Imperito","Control, Command, Dominate",5,false,0x98994b),
|
||||
DARK (49,"Tenebris","Dark, Night, Blindness",5,true,0x252525),
|
||||
CRAFT (50,"Fabrico","Create, Construct, Work",2,false,0x809d80),
|
||||
EVIL (56,"Malum","Evil, The Nether, Malice",5,true,0x700000),
|
||||
FLUX (57,"Mutatio","Flux, Chaos",5,true,0xb80bb9),
|
||||
ELDRITCH (58,"Alienis","Eldritch, The End, Strange, Alien",5,true,0x805080),
|
||||
|
||||
|
||||
//TOREMOVE
|
||||
TRAP (28,"Vinculum","Bind, Imprison, Trap",4,true,0x9a8080),
|
||||
INSECT (55,"Bestiola","Spider, Web, Insects",3,false,0x808880),
|
||||
MOTION (1,"Motus","Motion, Movement, Speed",1,false,0xcdccf4),
|
||||
FLIGHT (5,"Volito","Flight, Leap",1,false,0xe7e7d7),
|
||||
LIGHT (8,"Lux","Light, Brightness, Day",2,false,0xfff663),
|
||||
CLOTH (15,"Pannus","Cloth, Fabric, Garment, Thread",3,false,0xeaeac2),
|
||||
EARTH (16,"Solum","Earth, Soil, Ground, Foundation",4,false,0x713f2d),
|
||||
WEATHER (22,"Aer","Weather, Mist, Climate",3,false,0xc0ffff),
|
||||
COLD (23,"Gelum","Cold, Ice, Frost",3,true,0xe1ffff),
|
||||
HEAL (25,"Sano","Heal, Repair, Make Sound",3,false, 0xff8184),
|
||||
WOOD (32,"Lignum","Wood, Forest, Tree",4,false,0x058105),
|
||||
FLOWER (33,"Flos","Flower, Bloom, Blossom",4,false,0xffff40),
|
||||
FUNGUS (34,"Fungus","Mushroom, Toadstool, Fungi",4,false,0xf7e5c7),
|
||||
CROP (35,"Messis","Crops, Harvest",4,false,0xe3ff80),
|
||||
;
|
||||
|
||||
// Attributes
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final String meaning;
|
||||
|
||||
/**
|
||||
* rough categories for the aspect types. Mostly just used to determine the common aspect type in certain biomes.
|
||||
*/
|
||||
public final int element; //1-air, 2-fire, 3-water, 4-earth, 5-mystical, 6-dead/aggressive, 999-deprecated
|
||||
|
||||
/**
|
||||
* will wisps spawned from this fluxtype be aggressive?
|
||||
*/
|
||||
public final boolean aggro;
|
||||
|
||||
public final int color;
|
||||
|
||||
private EnumTag(int id, String name, String meaning, int element,boolean aggro, int color ) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.meaning = meaning;
|
||||
this.element = element;
|
||||
this.color = color;
|
||||
this.aggro = aggro;
|
||||
|
||||
}
|
||||
|
||||
// Lookup
|
||||
private static final Map<Integer,EnumTag> lookup = new HashMap<Integer,EnumTag>();
|
||||
|
||||
static { for(EnumTag s : EnumSet.allOf(EnumTag.class)) lookup.put(s.getId(), s); }
|
||||
|
||||
public int getId() { return id; }
|
||||
|
||||
public static EnumTag get(int id) {
|
||||
if (lookup.get(id)==null||lookup.get(id).element==999)
|
||||
return EnumTag.FLUX;
|
||||
else
|
||||
return lookup.get(id);
|
||||
}
|
||||
|
||||
}
|
17
src/minecraft/thaumcraft/api/IAspectSource.java
Normal file → Executable file
17
src/minecraft/thaumcraft/api/IAspectSource.java
Normal file → Executable file
|
@ -1,5 +1,8 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
|
@ -16,7 +19,7 @@ public interface IAspectSource {
|
|||
* @param amount
|
||||
* @return the amount of aspect left over that could not be added.
|
||||
*/
|
||||
public int addToSource(EnumTag tag, int amount);
|
||||
public int addToSource(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* Removes a certain amount of a specific aspect from the tile entity
|
||||
|
@ -24,14 +27,14 @@ public interface IAspectSource {
|
|||
* @param amount
|
||||
* @return true if that amount of aspect was available and was removed
|
||||
*/
|
||||
public boolean takeFromSource(EnumTag tag, int amount);
|
||||
public boolean takeFromSource(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 takeFromSource(ObjectTags ot);
|
||||
public boolean takeFromSource(AspectList ot);
|
||||
|
||||
/**
|
||||
* Checks if the tile entity contains the listed amount (or more) of the aspect
|
||||
|
@ -39,25 +42,25 @@ public interface IAspectSource {
|
|||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean doesSourceContainAmount(EnumTag tag,int amount);
|
||||
public boolean doesSourceContainAmount(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 doesSourceContain(ObjectTags ot);
|
||||
public boolean doesSourceContain(AspectList ot);
|
||||
|
||||
/**
|
||||
* Returns how much of the aspect this tile entity contains
|
||||
* @param tag
|
||||
* @return the amount of that aspect found
|
||||
*/
|
||||
public int sourceContains(EnumTag tag);
|
||||
public int sourceContains(Aspect tag);
|
||||
|
||||
/**
|
||||
* Returns all the aspects and their amounts that this tile entity contains
|
||||
* @return
|
||||
*/
|
||||
public ObjectTags getSourceTags();
|
||||
public AspectList getSourceTags();
|
||||
}
|
||||
|
|
0
src/minecraft/thaumcraft/api/IVisDiscounter.java
Normal file → Executable file
0
src/minecraft/thaumcraft/api/IVisDiscounter.java
Normal file → Executable file
18
src/minecraft/thaumcraft/api/IVisRepairable.java
Normal file → Executable file
18
src/minecraft/thaumcraft/api/IVisRepairable.java
Normal file → Executable file
|
@ -1,27 +1,13 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
* Items and tools with this interface can receive the Repair enchantment.
|
||||
* Armor, weapons and tools are handled automatically.
|
||||
* Usually 1 vis equals 1 point of durability every 2 seconds (1 second for repair II)
|
||||
* Repair enchant values over II also grants a reduction in speed, but at a much
|
||||
* reduced rate (about 2 ticks per rating over II)
|
||||
* Some sample code:<p>
|
||||
* <i>
|
||||
* public void doRepair(ItemStack is, Entity e) {<br>
|
||||
* if (AuraManager.decreaseClosestAura(e.worldObj,e.posX, e.posY, e.posZ, 1)) {<br>
|
||||
* is.damageItem(-1,(EntityLiving) e);<br>
|
||||
* }<br>
|
||||
* }<br><br>
|
||||
*</i>
|
||||
* Items, armor and tools with this interface can receive the Repair enchantment.
|
||||
* Repairs 1 point of durability every 10 seconds (2 for repair II)
|
||||
*/
|
||||
public interface IVisRepairable {
|
||||
|
||||
void doRepair(ItemStack stack, Entity e);
|
||||
|
||||
}
|
||||
|
|
5
src/minecraft/thaumcraft/api/ItemApi.java
Normal file → Executable file
5
src/minecraft/thaumcraft/api/ItemApi.java
Normal file → Executable file
|
@ -40,10 +40,7 @@ public class ItemApi {
|
|||
* Some examples
|
||||
*
|
||||
* Casting Wands:
|
||||
* itemWandCastingApprentice, itemWandCastingAdept, itemWandCastingMage
|
||||
*
|
||||
* Elemental Wands:
|
||||
* itemWandFire, itemWandLightning, itemWandFrost, itemWandTrade, itemWandExcavation, itemHellrod
|
||||
* itemWandCasting
|
||||
*
|
||||
* Resources:
|
||||
* itemEssence, itemWispEssence, itemResource, itemShard, itemNugget,
|
||||
|
|
58
src/minecraft/thaumcraft/api/MaterialTaint.java
Executable file
58
src/minecraft/thaumcraft/api/MaterialTaint.java
Executable file
|
@ -0,0 +1,58 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class MaterialTaint extends Material
|
||||
{
|
||||
public MaterialTaint(MapColor par1MapColor)
|
||||
{
|
||||
super(par1MapColor);
|
||||
this.setNoPushMobility();
|
||||
this.setRequiresTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true
|
||||
*/
|
||||
@Override
|
||||
public boolean getCanBlockGrass()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
@Override
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material setRequiresTool() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.setRequiresTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialMobility() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getMaterialMobility();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ObjectTags implements Serializable {
|
||||
|
||||
public Map<EnumTag,Integer> tags = new HashMap<EnumTag,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 ObjectTags(int id, int meta) {
|
||||
ObjectTags temp = ThaumcraftApiHelper.getObjectTags(new ItemStack(id,1,meta));
|
||||
if (temp!=null)
|
||||
for (EnumTag tag:temp.getAspects()) {
|
||||
add(tag,temp.getAmount(tag));
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectTags() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of different aspects in this collection
|
||||
*/
|
||||
public int size() {
|
||||
return tags.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection
|
||||
*/
|
||||
public EnumTag[] getAspects() {
|
||||
EnumTag[] q = new EnumTag[1];
|
||||
return tags.keySet().toArray(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection sorted by name
|
||||
*/
|
||||
public EnumTag[] getAspectsSorted() {
|
||||
EnumTag[] out = tags.keySet().toArray(new EnumTag[1]);
|
||||
boolean change=false;
|
||||
do {
|
||||
change=false;
|
||||
for(int a=0;a<out.length-1;a++) {
|
||||
EnumTag e1 = out[a];
|
||||
EnumTag e2 = out[a+1];
|
||||
if (e1!=null && e2!=null && e1.name.compareTo(e2.name)>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 name
|
||||
*/
|
||||
public EnumTag[] getAspectsSortedAmount() {
|
||||
EnumTag[] out = tags.keySet().toArray(new EnumTag[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) {
|
||||
EnumTag ea = out[a];
|
||||
EnumTag 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(EnumTag key) {
|
||||
return tags.get(key)==null?0:tags.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
* If reduced below 0 the aspect will be removed completely.
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean reduceAmount(EnumTag key, int amount) {
|
||||
if (getAmount(key)>=amount) {
|
||||
int am = getAmount(key)-amount;
|
||||
if (am<=0) tags.remove(key); else
|
||||
tags.put(key, am);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
* If reduced below 0 the aspect will be removed completely.
|
||||
* If the aspect does not exist then a negative value will be added.
|
||||
* Only used by aura internals for flux management.
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public ObjectTags remove(EnumTag key, int amount) {
|
||||
if (getAmount(key)>=amount) {
|
||||
int am = getAmount(key)-amount;
|
||||
if (am<=0) tags.remove(key); else
|
||||
this.tags.put(key, am);
|
||||
} else if (getAmount(key)==0) {
|
||||
this.tags.put(key, -amount);
|
||||
}
|
||||
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 ObjectTags add(EnumTag aspect, int amount) {
|
||||
if (this.tags.containsKey(aspect)) {
|
||||
int oldamount = this.tags.get(aspect);
|
||||
amount+=oldamount;
|
||||
}
|
||||
this.tags.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 ObjectTags merge(EnumTag aspect, int amount) {
|
||||
if (this.tags.containsKey(aspect)) {
|
||||
int oldamount = this.tags.get(aspect);
|
||||
if (amount<oldamount) amount=oldamount;
|
||||
}
|
||||
this.tags.put( aspect, amount );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
746
src/minecraft/thaumcraft/api/ThaumcraftApi.java
Normal file → Executable file
746
src/minecraft/thaumcraft/api/ThaumcraftApi.java
Normal file → Executable file
|
@ -1,33 +1,31 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import thaumcraft.api.aura.AuraNode;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.api.crafting.IInfusionRecipe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.RecipeCrucible;
|
||||
import thaumcraft.api.crafting.ShapedArcaneCraftingRecipes;
|
||||
import thaumcraft.api.crafting.ShapedInfusionCraftingRecipes;
|
||||
import thaumcraft.api.crafting.ShapelessArcaneCraftingRecipes;
|
||||
import thaumcraft.api.crafting.ShapelessInfusionCraftingRecipes;
|
||||
import thaumcraft.api.crafting.ShapedArcaneRecipe;
|
||||
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
|
||||
import thaumcraft.api.research.IScanEventHandler;
|
||||
import thaumcraft.api.research.ResearchList;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchCategoryList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,8 +42,8 @@ public class ThaumcraftApi {
|
|||
public static EnumToolMaterial toolMatElemental = EnumHelper.addToolMaterial("THAUMIUM_ELEMENTAL", 3, 1500, 10F, 3, 18);
|
||||
public static EnumArmorMaterial armorMatThaumium = EnumHelper.addArmorMaterial("THAUMIUM", 25, new int[] { 2, 6, 5, 2 }, 25);
|
||||
public static EnumArmorMaterial armorMatSpecial = EnumHelper.addArmorMaterial("SPECIAL", 25, new int[] { 1, 3, 2, 1 }, 25);
|
||||
|
||||
|
||||
//public static final Material fluxGoomaterial = (new MaterialTaint(MapColor.grassColor)).setNoPushMobility();
|
||||
public static final Material taintMaterial = (new MaterialTaint(MapColor.grassColor));
|
||||
|
||||
//Miscellaneous
|
||||
/**
|
||||
|
@ -56,26 +54,45 @@ public class ThaumcraftApi {
|
|||
|
||||
|
||||
//RESEARCH/////////////////////////////////////////
|
||||
public static Document researchDoc = null;
|
||||
public static ArrayList<String> apiResearchFiles = new ArrayList<String>();
|
||||
// public static Document researchDoc = null;
|
||||
// public static ArrayList<String> apiResearchFiles = new ArrayList<String>();
|
||||
public static ArrayList<IScanEventHandler> scanEventhandlers = new ArrayList<IScanEventHandler>();
|
||||
|
||||
/**
|
||||
* Used to add your own xml files that the research system will check of recipes and descriptions of custom research
|
||||
* @param resourceLoc The xml file. For example The default file used by TC is
|
||||
* "/thaumcraft/resources/research.xml"
|
||||
*/
|
||||
public static void registerResearchXML(String resourceLoc) {
|
||||
if (!apiResearchFiles.contains(resourceLoc)) apiResearchFiles.add(resourceLoc);
|
||||
public static ArrayList<EntityTags> scanEntities = new ArrayList<EntityTags>();
|
||||
public static class EntityTags {
|
||||
public EntityTags(String entityName, NBTBase[] nbts, AspectList aspects) {
|
||||
this.entityName = entityName;
|
||||
this.nbts = nbts;
|
||||
this.aspects = aspects;
|
||||
}
|
||||
public String entityName;
|
||||
public NBTBase[] nbts;
|
||||
public AspectList aspects;
|
||||
}
|
||||
|
||||
/**
|
||||
* not really working atm, so ignore it for now
|
||||
* @param scanEventHandler
|
||||
*/
|
||||
public static void registerScanEventhandler(IScanEventHandler scanEventHandler) {
|
||||
scanEventhandlers.add(scanEventHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to add aspects to entities which you can then scan using a thaumometer.
|
||||
* Also used to calculate vis drops from mobs.
|
||||
* @param entityName
|
||||
* @param aspects
|
||||
* @param nbt you can specify certain nbt keys and their values
|
||||
* to differentiate between mobs. <br>For example the normal and wither skeleton:
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 5));
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 8), new NBTTagByte("SkeletonType",(byte) 1));
|
||||
*/
|
||||
public static void registerEntityTag(String entityName, AspectList aspects, NBTBase... nbt ) {
|
||||
scanEntities.add(new EntityTags(entityName,nbt,aspects));
|
||||
}
|
||||
|
||||
//RECIPES/////////////////////////////////////////
|
||||
private static ArrayList crucibleRecipes = new ArrayList();
|
||||
private static List craftingRecipes = new ArrayList();
|
||||
private static ArrayList craftingRecipes = new ArrayList();
|
||||
private static HashMap<List,ItemStack> smeltingBonus = new HashMap<List,ItemStack>();
|
||||
private static ArrayList<List> smeltingBonusExlusion = new ArrayList<List>();
|
||||
|
||||
|
@ -124,358 +141,51 @@ public class ThaumcraftApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* NOTE:
|
||||
* All arcane and infusion crafting recipes are NBT sensitive.
|
||||
* Simply add as much nbt data to the crafting ingredient itemstacks as you wish
|
||||
* to match with the actual input items. For example this recipe will turn a warded
|
||||
* jar filled with crystal essentia into a stack of diamonds:
|
||||
*
|
||||
* ItemStack is = new ItemStack(itemJarFilled);
|
||||
* is.setTagInfo("tag", new NBTTagByte("tag", (byte) EnumTag.CRYSTAL.id));
|
||||
* is.setTagInfo("amount", new NBTTagByte("amount", (byte) 64));
|
||||
* ThaumcraftApi.addShapelessArcaneCraftingRecipe("THEJARISNOWDIAMONDS", 50,
|
||||
* new ItemStack(Item.diamond,64,0), new Object[] { is });
|
||||
*
|
||||
* If no tag was added for "amount" then the jar would simply have had to contain any
|
||||
* amount of crystal essentia.
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect.
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param cost the vis cost
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla recipes
|
||||
*/
|
||||
public static void addArcaneCraftingRecipe(String key, int cost, ItemStack par1ItemStack, Object ... par2ArrayOfObj)
|
||||
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
{
|
||||
String var3 = "";
|
||||
int var4 = 0;
|
||||
int var5 = 0;
|
||||
int var6 = 0;
|
||||
int var9;
|
||||
|
||||
if (par2ArrayOfObj[var4] instanceof String[])
|
||||
{
|
||||
String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]);
|
||||
String[] var8 = var7;
|
||||
var9 = var7.length;
|
||||
|
||||
for (int var10 = 0; var10 < var9; ++var10)
|
||||
{
|
||||
String var11 = var8[var10];
|
||||
++var6;
|
||||
var5 = var11.length();
|
||||
var3 = var3 + var11;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (par2ArrayOfObj[var4] instanceof String)
|
||||
{
|
||||
String var13 = (String)par2ArrayOfObj[var4++];
|
||||
++var6;
|
||||
var5 = var13.length();
|
||||
var3 = var3 + var13;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap var14;
|
||||
|
||||
for (var14 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2)
|
||||
{
|
||||
Character var16 = (Character)par2ArrayOfObj[var4];
|
||||
ItemStack var17 = null;
|
||||
|
||||
if (par2ArrayOfObj[var4 + 1] instanceof Item)
|
||||
{
|
||||
var17 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]);
|
||||
}
|
||||
else if (par2ArrayOfObj[var4 + 1] instanceof Block)
|
||||
{
|
||||
var17 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1);
|
||||
}
|
||||
else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack)
|
||||
{
|
||||
var17 = (ItemStack)par2ArrayOfObj[var4 + 1];
|
||||
}
|
||||
|
||||
var14.put(var16, var17);
|
||||
}
|
||||
|
||||
ItemStack[] var15 = new ItemStack[var5 * var6];
|
||||
|
||||
for (var9 = 0; var9 < var5 * var6; ++var9)
|
||||
{
|
||||
char var18 = var3.charAt(var9);
|
||||
|
||||
if (var14.containsKey(Character.valueOf(var18)))
|
||||
{
|
||||
var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
var15[var9] = null;
|
||||
}
|
||||
}
|
||||
|
||||
craftingRecipes.add(new ShapedArcaneCraftingRecipes(key, var5, var6, var15, par1ItemStack,cost));
|
||||
ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param recipeKey a string value of the key used in your research.xml for this recipe to display in the thaumonomicon
|
||||
* @param cost the vis cost
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla recipes
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
public static void addArcaneCraftingRecipe(String key, String recipeKey, int cost, ItemStack par1ItemStack, Object ... par2ArrayOfObj) {
|
||||
addArcaneCraftingRecipe(key,cost,par1ItemStack,par2ArrayOfObj);
|
||||
ResearchList.craftingRecipesForResearch.put(recipeKey, Arrays.asList(getCraftingRecipes().size()-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param cost the vis cost
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla shapeless recipes
|
||||
*/
|
||||
public static void addShapelessArcaneCraftingRecipe(String key, int cost, ItemStack par1ItemStack, Object ... par2ArrayOfObj)
|
||||
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
{
|
||||
ArrayList var3 = new ArrayList();
|
||||
Object[] var4 = par2ArrayOfObj;
|
||||
int var5 = par2ArrayOfObj.length;
|
||||
|
||||
for (int var6 = 0; var6 < var5; ++var6)
|
||||
{
|
||||
Object var7 = var4[var6];
|
||||
|
||||
if (var7 instanceof ItemStack)
|
||||
{
|
||||
var3.add(((ItemStack)var7).copy());
|
||||
}
|
||||
else if (var7 instanceof Item)
|
||||
{
|
||||
var3.add(new ItemStack((Item)var7));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(var7 instanceof Block))
|
||||
{
|
||||
throw new RuntimeException("Invalid shapeless recipe!");
|
||||
ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
var3.add(new ItemStack((Block)var7));
|
||||
}
|
||||
}
|
||||
|
||||
craftingRecipes.add(new ShapelessArcaneCraftingRecipes(key, par1ItemStack, var3, cost));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param recipeKey a string value of the key used in your research.xml for this recipe to display in the thaumonomicon
|
||||
* @param cost the vis cost
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla shapeless recipes
|
||||
*/
|
||||
public static void addShapelessArcaneCraftingRecipe(String key, String recipeKey, int cost, ItemStack par1ItemStack, Object ... par2ArrayOfObj) {
|
||||
addShapelessArcaneCraftingRecipe(key,cost,par1ItemStack,par2ArrayOfObj);
|
||||
ResearchList.craftingRecipesForResearch.put(recipeKey, Arrays.asList(getCraftingRecipes().size()-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param cost the vis cost
|
||||
* @param tags ObjectTags list of required aspects and their amounts. No more than 5 aspects should be used in a recipe.
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla recipes
|
||||
*/
|
||||
public static void addInfusionCraftingRecipe(String key, int cost, ObjectTags tags, ItemStack par1ItemStack, Object ... par2ArrayOfObj)
|
||||
{
|
||||
String var3 = "";
|
||||
int var4 = 0;
|
||||
int var5 = 0;
|
||||
int var6 = 0;
|
||||
int var9;
|
||||
|
||||
if (par2ArrayOfObj[var4] instanceof String[])
|
||||
{
|
||||
String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]);
|
||||
String[] var8 = var7;
|
||||
var9 = var7.length;
|
||||
|
||||
for (int var10 = 0; var10 < var9; ++var10)
|
||||
{
|
||||
String var11 = var8[var10];
|
||||
++var6;
|
||||
var5 = var11.length();
|
||||
var3 = var3 + var11;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (par2ArrayOfObj[var4] instanceof String)
|
||||
{
|
||||
String var13 = (String)par2ArrayOfObj[var4++];
|
||||
++var6;
|
||||
var5 = var13.length();
|
||||
var3 = var3 + var13;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap var14;
|
||||
|
||||
for (var14 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2)
|
||||
{
|
||||
Character var16 = (Character)par2ArrayOfObj[var4];
|
||||
ItemStack var17 = null;
|
||||
|
||||
if (par2ArrayOfObj[var4 + 1] instanceof Item)
|
||||
{
|
||||
var17 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]);
|
||||
}
|
||||
else if (par2ArrayOfObj[var4 + 1] instanceof Block)
|
||||
{
|
||||
var17 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1);
|
||||
}
|
||||
else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack)
|
||||
{
|
||||
var17 = (ItemStack)par2ArrayOfObj[var4 + 1];
|
||||
}
|
||||
|
||||
var14.put(var16, var17);
|
||||
}
|
||||
|
||||
ItemStack[] var15 = new ItemStack[var5 * var6];
|
||||
|
||||
for (var9 = 0; var9 < var5 * var6; ++var9)
|
||||
{
|
||||
char var18 = var3.charAt(var9);
|
||||
|
||||
if (var14.containsKey(Character.valueOf(var18)))
|
||||
{
|
||||
var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
var15[var9] = null;
|
||||
}
|
||||
}
|
||||
|
||||
craftingRecipes.add(new ShapedInfusionCraftingRecipes(key, var5, var6, var15, par1ItemStack,cost,tags));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipe is NBT sensitive
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param recipeKey a string value of the key used in your research.xml for this recipe to display in the thaumonomicon
|
||||
* @param cost the vis cost
|
||||
* @param tags ObjectTags list of required aspects and their amounts. No more than 5 aspects should be used in a recipe.
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla recipes
|
||||
*/
|
||||
public static void addInfusionCraftingRecipe(String key, String recipeKey, int cost, ObjectTags tags, ItemStack par1ItemStack, Object ... par2ArrayOfObj) {
|
||||
addInfusionCraftingRecipe(key, cost, tags, par1ItemStack, par2ArrayOfObj);
|
||||
ResearchList.craftingRecipesForResearch.put(recipeKey, Arrays.asList(getCraftingRecipes().size()-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipe is NBT sensitive
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param cost the vis cost
|
||||
* @param tags ObjectTags list of required aspects and their amounts. No more than 5 aspects should be used in a recipe.
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla shapeless recipes
|
||||
*/
|
||||
public static void addShapelessInfusionCraftingRecipe(String key, int cost, ObjectTags tags, ItemStack par1ItemStack, Object ... par2ArrayOfObj)
|
||||
{
|
||||
ArrayList var3 = new ArrayList();
|
||||
Object[] var4 = par2ArrayOfObj;
|
||||
int var5 = par2ArrayOfObj.length;
|
||||
|
||||
for (int var6 = 0; var6 < var5; ++var6)
|
||||
{
|
||||
Object var7 = var4[var6];
|
||||
|
||||
if (var7 instanceof ItemStack)
|
||||
{
|
||||
var3.add(((ItemStack)var7).copy());
|
||||
}
|
||||
else if (var7 instanceof Item)
|
||||
{
|
||||
var3.add(new ItemStack((Item)var7));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(var7 instanceof Block))
|
||||
{
|
||||
throw new RuntimeException("Invalid shapeless recipe!");
|
||||
}
|
||||
|
||||
var3.add(new ItemStack((Block)var7));
|
||||
}
|
||||
}
|
||||
|
||||
craftingRecipes.add(new ShapelessInfusionCraftingRecipes(key, par1ItemStack, var3, cost,tags));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recipe is NBT sensitive
|
||||
* @param key the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param recipeKey a string value of the key used in your research.xml for this recipe to display in the thaumonomicon
|
||||
* @param cost the vis cost
|
||||
* @param tags ObjectTags list of required aspects and their amounts. No more than 5 aspects should be used in a recipe.
|
||||
* @param par1ItemStack the recipe output
|
||||
* @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla shapeless recipes
|
||||
*/
|
||||
public static void addShapelessInfusionCraftingRecipe(String key, String recipeKey, int cost, ObjectTags tags, ItemStack par1ItemStack, Object ... par2ArrayOfObj) {
|
||||
addShapelessInfusionCraftingRecipe(key, cost, tags, par1ItemStack, par2ArrayOfObj);
|
||||
ResearchList.craftingRecipesForResearch.put(recipeKey, Arrays.asList(getCraftingRecipes().size()-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work. Unlike the arcane crafting and infusion crafting
|
||||
* recipes a recipe key is automatically created using the same key.
|
||||
* See method below if the research and recipes keys do not match
|
||||
* @param result the output result
|
||||
* @param cost the vis cost
|
||||
* @param tags the aspects required to craft this
|
||||
*/
|
||||
public static void addCrucibleRecipe(String key, ItemStack result, int cost, ObjectTags tags) {
|
||||
getCrucibleRecipes().add(new RecipeCrucible(key, result, tags, cost));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work.
|
||||
* @param recipeKey a string value of the key used in your research.xml for this recipe to display in the thaumonomicon
|
||||
* @param result the output result
|
||||
* @param cost the vis cost
|
||||
* @param tags the aspects required to craft this
|
||||
*/
|
||||
public static void addCrucibleRecipe(String key, String recipeKey, ItemStack result, int cost, ObjectTags tags) {
|
||||
getCrucibleRecipes().add(new RecipeCrucible(key, recipeKey, result, tags, cost));
|
||||
public static RecipeCrucible addCrucibleRecipe(String key, ItemStack result, Object catalyst, AspectList tags) {
|
||||
RecipeCrucible rc = new RecipeCrucible(key, result, catalyst, tags);
|
||||
getCraftingRecipes().add(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the recipe key (NOT research key)
|
||||
* @return the recipe
|
||||
*/
|
||||
public static RecipeCrucible getCrucibleRecipe(String key) {
|
||||
for (Object r:getCrucibleRecipes()) {
|
||||
if (r instanceof RecipeCrucible) {
|
||||
if (((RecipeCrucible)r).key.equals(key))
|
||||
return (RecipeCrucible)r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stack the recipe result
|
||||
* @return the recipe
|
||||
*/
|
||||
public static RecipeCrucible getCrucibleRecipe(ItemStack stack) {
|
||||
for (Object r:getCrucibleRecipes()) {
|
||||
for (Object r:getCraftingRecipes()) {
|
||||
if (r instanceof RecipeCrucible) {
|
||||
if (((RecipeCrucible)r).recipeOutput.isItemEqual(stack))
|
||||
return (RecipeCrucible)r;
|
||||
|
@ -485,26 +195,41 @@ public class ThaumcraftApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used by the thaumonomicon drilldown feature.
|
||||
* @param stack the item
|
||||
* @return the thaumcraft recipe key that produces that item. Used by the thaumonomicon drilldown feature.
|
||||
* @return the thaumcraft recipe key that produces that item.
|
||||
*/
|
||||
public static String getCraftingRecipeKey(ItemStack stack) {
|
||||
for (Object r:getCraftingRecipes()) {
|
||||
if (r instanceof IArcaneRecipe) {
|
||||
if (ThaumcraftApiHelper.areItemsEqual(stack,((IArcaneRecipe)r).getRecipeOutput()))
|
||||
return ((IArcaneRecipe)r).getKey();
|
||||
private static HashMap<ItemStack,Object[]> keyCache = new HashMap<ItemStack,Object[]>();
|
||||
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) {
|
||||
if (keyCache.containsKey(stack)) {
|
||||
if (keyCache.get(stack)==null) return null;
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.username, (String)(keyCache.get(stack))[0]))
|
||||
return keyCache.get(stack);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
if (r instanceof IInfusionRecipe) {
|
||||
if (ThaumcraftApiHelper.areItemsEqual(stack,((IInfusionRecipe)r).getRecipeOutput()))
|
||||
return ((IInfusionRecipe)r).getKey();
|
||||
for (ResearchCategoryList rcl:ResearchCategories.researchCategories.values()) {
|
||||
for (ResearchItem ri:rcl.research.values()) {
|
||||
if (ri.getPages()==null) continue;
|
||||
for (int a=0;a<ri.getPages().length;a++) {
|
||||
ResearchPage page = ri.getPages()[a];
|
||||
if (ItemStack.areItemStacksEqual(page.recipeOutput,stack)) {
|
||||
keyCache.put(stack,new Object[] {ri.key,a});
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.username, ri.key))
|
||||
return new Object[] {ri.key,a};
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
keyCache.put(stack,null);
|
||||
return null;
|
||||
}
|
||||
|
||||
//TAGS////////////////////////////////////////
|
||||
|
||||
public static Map<List,ObjectTags> objectTags = new HashMap<List,ObjectTags>();
|
||||
public static Map<List,AspectList> objectTags = new HashMap<List,AspectList>();
|
||||
|
||||
/**
|
||||
* Checks to see if the passed item/block already has aspects associated with it.
|
||||
|
@ -513,7 +238,7 @@ public class ThaumcraftApi {
|
|||
* @return
|
||||
*/
|
||||
public static boolean exists(int id, int meta) {
|
||||
ObjectTags tmp = ThaumcraftApi.objectTags.get(Arrays.asList(id,meta));
|
||||
AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(id,meta));
|
||||
if (tmp==null) {
|
||||
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(id,-1));
|
||||
if (meta==-1 && tmp==null) {
|
||||
|
@ -536,11 +261,34 @@ public class ThaumcraftApi {
|
|||
* @param meta pass -1 if all damage values of this item/block should have the same aspects
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(int id, int meta, ObjectTags aspects) {
|
||||
aspects = ThaumcraftApiHelper.cullTags(aspects);
|
||||
public static void registerObjectTag(int id, int meta, AspectList aspects) {
|
||||
objectTags.put(Arrays.asList(id,meta), aspects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
||||
* <i>ThaumcraftApi.registerObjectTag(Block.cobblestone.blockID, new int[]{0,1}, (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.DESTRUCTION, 1));</i>
|
||||
* @param id
|
||||
* @param meta A range of meta values if you wish to lump several item meta's together as being the "same" item (i.e. stair orientations)
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(int id, int[] meta, AspectList aspects) {
|
||||
objectTags.put(Arrays.asList(id,meta), aspects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign apsects to the given ore dictionary item.
|
||||
* @param oreDict the ore dictionary name
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(String oreDict, AspectList aspects) {
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(oreDict);
|
||||
if (ores!=null && ores.size()>0) {
|
||||
for (ItemStack ore:ores)
|
||||
objectTags.put(Arrays.asList(ore.itemID, ore.getItemDamage()), aspects);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign aspects to the given item/block.
|
||||
* Attempts to automatically generate aspect tags by checking registered recipes.
|
||||
|
@ -550,228 +298,22 @@ public class ThaumcraftApi {
|
|||
* @param meta pass -1 if all damage values of this item/block should have the same aspects
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerComplexObjectTag(int id, int meta, ObjectTags aspects ) {
|
||||
if (!exists(id,meta)) {
|
||||
ObjectTags tmp = ThaumcraftApiHelper.generateTags(id, meta);
|
||||
if (tmp != null && tmp.size()>0) {
|
||||
for(EnumTag tag:tmp.getAspects()) {
|
||||
aspects.add(tag, tmp.getAmount(tag));
|
||||
}
|
||||
}
|
||||
registerObjectTag(id,meta,aspects);
|
||||
} else {
|
||||
ObjectTags tmp = ThaumcraftApiHelper.getObjectTags(new ItemStack(id,1,meta));
|
||||
for(EnumTag tag:aspects.getAspects()) {
|
||||
tmp.merge(tag, tmp.getAmount(tag));
|
||||
}
|
||||
registerObjectTag(id,meta,tmp);
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList getCrucibleRecipes() {
|
||||
return crucibleRecipes;
|
||||
}
|
||||
|
||||
|
||||
//AURAS//////////////////////////////////////////////////
|
||||
|
||||
private static Method addFluxToClosest;
|
||||
/**
|
||||
* Adds flux to the node closest to the given location
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param tags ObjectTags list of all the EnumTags and amounts of flux to add.
|
||||
*/
|
||||
public static void addFluxToClosest(World world, float x, float y, float z, ObjectTags tags) {
|
||||
try {
|
||||
if(addFluxToClosest == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
addFluxToClosest = fake.getMethod("addFluxToClosest", World.class, float.class, float.class, float.class, ObjectTags.class);
|
||||
}
|
||||
addFluxToClosest.invoke(null, world,x,y,z,tags);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method addFluxToClosest");
|
||||
}
|
||||
}
|
||||
|
||||
private static Method decreaseClosestAura;
|
||||
/**
|
||||
* Removes an amount of vis from the aura node closest to the given location
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param amount The amount of vis to remove
|
||||
* @param doit If set to false it will merely perform a check to see if there is enough vis to perform the operation.
|
||||
* If set to true it will actually decrease the vis as well.
|
||||
* @return It will return true if there was enough vis to perform this operation
|
||||
*/
|
||||
public static boolean decreaseClosestAura(World world, double x, double y, double z, int amount, boolean doit) {
|
||||
boolean ret=false;
|
||||
try {
|
||||
if(decreaseClosestAura == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
decreaseClosestAura = fake.getMethod("decreaseClosestAura", World.class, double.class, double.class, double.class, int.class, boolean.class);
|
||||
}
|
||||
ret = (Boolean) decreaseClosestAura.invoke(null, world,x,y,z,amount,doit);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method decreaseClosestAura");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Method increaseLowestAura;
|
||||
/**
|
||||
* Increases the lowest aura near the given location.
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param amount
|
||||
* @return it will return true if the operation was a success
|
||||
*/
|
||||
public static boolean increaseLowestAura(World world, double x, double y, double z, int amount) {
|
||||
boolean ret=false;
|
||||
try {
|
||||
if(increaseLowestAura == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
increaseLowestAura = fake.getMethod("increaseLowestAura", World.class, double.class, double.class, double.class, int.class);
|
||||
}
|
||||
ret = (Boolean) increaseLowestAura.invoke(null, world,x,y,z,amount);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method increaseLowestAura");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Method getClosestAuraWithinRange;
|
||||
/**
|
||||
* Gets the id of the closest aura node within range of the given coordinates. Only checks loaded chunks
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param range distance (in blocks) to check
|
||||
* @return returns -1 if no aura is found, otherwise returns the aura node id.
|
||||
*/
|
||||
public static int getClosestAuraWithinRange(World world, double x, double y, double z, double range) {
|
||||
int ret=-1;
|
||||
try {
|
||||
if(getClosestAuraWithinRange == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
getClosestAuraWithinRange = fake.getMethod("getClosestAuraWithinRange", World.class, double.class, double.class, double.class, double.class);
|
||||
}
|
||||
ret = (Integer) getClosestAuraWithinRange.invoke(null, world,x,y,z,range);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method getClosestAuraWithinRange");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Method getNodeCopy;
|
||||
/**
|
||||
* Gets an copy of the AuraNode object for the given node
|
||||
* @param nodeId the int key of the aura node
|
||||
* @return returns a COPY of the auranode object, not the object itself.
|
||||
* Auranode values should only be altered via queNodeChanges - NEVER directly
|
||||
*/
|
||||
public static AuraNode getNodeCopy(int nodeId) {
|
||||
AuraNode node = null;
|
||||
try {
|
||||
if(getNodeCopy == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
getNodeCopy = fake.getMethod("getNodeCopy", int.class);
|
||||
}
|
||||
node = (AuraNode) getNodeCopy.invoke(null, nodeId);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method getNodeCopy");
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private static Method queueNodeChanges;
|
||||
/**
|
||||
* This method is used to alter the values of aura nodes. The changes specified are placed in a queue for processing by
|
||||
* the aura thread.<br>
|
||||
*
|
||||
* For example:<br>
|
||||
* queNodeChanges(55,8,0,false,null,0,0,0); //will increase node 55's current vis by 8<br>
|
||||
* queNodeChanges(55,0,0,false,new ObjectTags().remove(EnumTag.FIRE,3),0,0,0); //will reduce node 55's FIRE flux levels by 3<br>
|
||||
* queNodeChanges(55,11,11,false,null,0,.5f,0); //will increase node 55's current and base level by 11 and increase its y pos by .5f<br>
|
||||
*
|
||||
* @param nodeId
|
||||
* @param levelMod the amount by which the auras vis level should be changed (positive or negative)
|
||||
* @param baseMod the amount by which the auras max vis level should be changed (positive or negative)
|
||||
* @param toggleLock if set to true the nodes lock state will toggle to its opposite value. Currently doesn't do much
|
||||
* @param flx a ObjectTags collection of the all the flux to add (if positive) or remove (if negative) to the node
|
||||
* @param x by how much the nodes x position should be altered. Should usually be less than 1
|
||||
* @param y by how much the nodes y position should be altered. Should usually be less than 1
|
||||
* @param z by how much the nodes z position should be altered. Should usually be less than 1
|
||||
*/
|
||||
public static void queueNodeChanges(int nodeId, int levelMod, int baseMod, boolean toggleLock, ObjectTags flux,
|
||||
float x,float y,float z) {
|
||||
try {
|
||||
if(queueNodeChanges == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.aura.AuraManager");
|
||||
queueNodeChanges = fake.getMethod("queueNodeChanges",
|
||||
int.class, int.class, int.class, boolean.class, ObjectTags.class, float.class, float.class, float.class);
|
||||
}
|
||||
queueNodeChanges.invoke(null, nodeId, levelMod, baseMod, toggleLock, flux, x, y, z);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.aura.AuraManager method queueNodeChanges");
|
||||
}
|
||||
}
|
||||
|
||||
//BIOMES//////////////////////////////////////////////////
|
||||
@Deprecated
|
||||
public static HashMap<Integer,List> biomeInfo = new HashMap<Integer,List>();
|
||||
|
||||
/**
|
||||
* Registers custom biomes with thaumcraft
|
||||
* @Deprecated I will be switching over the the forge BiomeDictionary system in the future so any mods that add biomes should just make sure they are tagged correctly
|
||||
* @param biomeID The id of the biome
|
||||
* @param visLevel The average vis level of nodes generated in this biome
|
||||
* @param tag The EnumTag associated with this biome (used to determine infused ore spawns among other things)
|
||||
* @param greatwood Does this biome support greatwood trees
|
||||
* @param silverwood Does this biome support silverwood trees
|
||||
*/
|
||||
@Deprecated
|
||||
public static void registerBiomeInfo(int biomeID, int visLevel, EnumTag tag, boolean greatwood, boolean silverwood) {
|
||||
biomeInfo.put(biomeID, Arrays.asList(visLevel, tag, greatwood, silverwood));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int getBiomeAura(int biomeId) {
|
||||
try {
|
||||
return (Integer) biomeInfo.get(biomeId).get(0);
|
||||
} catch (Exception e) {}
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static EnumTag getBiomeTag(int biomeId) {
|
||||
try {
|
||||
return (EnumTag) biomeInfo.get(biomeId).get(1);
|
||||
} catch (Exception e) {}
|
||||
return EnumTag.UNKNOWN;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean getBiomeSupportsGreatwood(int biomeId) {
|
||||
try {
|
||||
return (Boolean) biomeInfo.get(biomeId).get(2);
|
||||
} catch (Exception e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean getBiomeSupportsSilverwood(int biomeId) {
|
||||
try {
|
||||
return (Boolean) biomeInfo.get(biomeId).get(3);
|
||||
} catch (Exception e) {}
|
||||
return false;
|
||||
public static void registerComplexObjectTag(int id, int meta, AspectList aspects ) {
|
||||
// if (!exists(id,meta)) {
|
||||
// AspectList tmp = ThaumcraftApiHelper.generateTags(id, meta);
|
||||
// if (tmp != null && tmp.size()>0) {
|
||||
// for(EnumTag tag:tmp.getAspects()) {
|
||||
// aspects.add(tag, tmp.getAmount(tag));
|
||||
// }
|
||||
// }
|
||||
// registerObjectTag(id,meta,aspects);
|
||||
// } else {
|
||||
// AspectList tmp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id,1,meta));
|
||||
// for(EnumTag tag:aspects.getAspects()) {
|
||||
// tmp.merge(tag, tmp.getAmount(tag));
|
||||
// }
|
||||
// registerObjectTag(id,meta,tmp);
|
||||
// }
|
||||
}
|
||||
|
||||
//CROPS //////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -794,21 +336,5 @@ public class ThaumcraftApi {
|
|||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(Block.crops,1,7));
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public static HashMap<Integer,Integer> crops = new HashMap<Integer,Integer>();
|
||||
|
||||
/**
|
||||
* This is used to add mod crops to the list of crops harvested by golems
|
||||
* that do not use the standard crop growth pattern<br>
|
||||
* (i.e. being an instance of BlockCrops and being fully grown at meta 7).<br>
|
||||
* Only seeds implementing IPlantable will be replanted.
|
||||
* @param blockID the block id of the crop
|
||||
* @param grownMeta the metadata value when the crop is considered fully grown.
|
||||
* The block with this id and meta will be the one the golem breaks.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addHarvestableCrop(int blockID, int grownMeta) {
|
||||
crops.put(blockID, grownMeta);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
46
src/minecraft/thaumcraft/api/ThaumcraftApiHelper.java
Normal file → Executable file
46
src/minecraft/thaumcraft/api/ThaumcraftApiHelper.java
Normal file → Executable file
|
@ -3,21 +3,23 @@ package thaumcraft.api;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class ThaumcraftApiHelper {
|
||||
public static ObjectTags cullTags(ObjectTags temp) {
|
||||
while (temp!=null && temp.size()>5) {
|
||||
EnumTag lowest = null;
|
||||
int low = Integer.MAX_VALUE;
|
||||
for (EnumTag tag:temp.getAspects()) {
|
||||
if (temp.getAmount(tag)<low) {
|
||||
low = temp.getAmount(tag);
|
||||
lowest = tag;
|
||||
}
|
||||
}
|
||||
temp.tags.remove(lowest);
|
||||
}
|
||||
|
||||
public static AspectList cullTags(AspectList temp) {
|
||||
// while (temp!=null && temp.size()>5) {
|
||||
// EnumTag lowest = null;
|
||||
// int low = Integer.MAX_VALUE;
|
||||
// for (EnumTag tag:temp.getAspects()) {
|
||||
// if (temp.getAmount(tag)<low) {
|
||||
// low = temp.getAmount(tag);
|
||||
// lowest = tag;
|
||||
// }
|
||||
// }
|
||||
// temp.aspects.remove(lowest);
|
||||
// }
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -38,12 +40,12 @@ public class ThaumcraftApiHelper {
|
|||
boolean ot = false;
|
||||
try {
|
||||
if(isResearchComplete == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.research.ResearchManager");
|
||||
Class fake = Class.forName("thaumcraft.common.lib.research.ResearchManager");
|
||||
isResearchComplete = fake.getMethod("isResearchComplete", String.class, String.class);
|
||||
}
|
||||
ot = (Boolean) isResearchComplete.invoke(null, username, researchkey);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.research.ResearchManager method isResearchComplete");
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.research.ResearchManager method isResearchComplete");
|
||||
}
|
||||
return ot;
|
||||
}
|
||||
|
@ -60,41 +62,41 @@ public class ThaumcraftApiHelper {
|
|||
return ot;
|
||||
}
|
||||
|
||||
public static ObjectTags getObjectTags(ItemStack is) {
|
||||
ObjectTags ot = null;
|
||||
public static AspectList getObjectAspects(ItemStack is) {
|
||||
AspectList ot = null;
|
||||
try {
|
||||
if(getObjectTags == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.lib.ThaumcraftCraftingManager");
|
||||
getObjectTags = fake.getMethod("getObjectTags", ItemStack.class);
|
||||
}
|
||||
ot = (ObjectTags) getObjectTags.invoke(null, is);
|
||||
ot = (AspectList) getObjectTags.invoke(null, is);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method getObjectTags");
|
||||
}
|
||||
return ot;
|
||||
}
|
||||
|
||||
public static ObjectTags getBonusObjectTags(ItemStack is,ObjectTags ot) {
|
||||
public static AspectList getBonusObjectTags(ItemStack is,AspectList ot) {
|
||||
|
||||
try {
|
||||
if(getBonusTags == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.lib.ThaumcraftCraftingManager");
|
||||
getBonusTags = fake.getMethod("getBonusTags", ItemStack.class, ObjectTags.class);
|
||||
getBonusTags = fake.getMethod("getBonusTags", ItemStack.class, AspectList.class);
|
||||
}
|
||||
ot = (ObjectTags) getBonusTags.invoke(null, is, ot);
|
||||
ot = (AspectList) getBonusTags.invoke(null, is, ot);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method getBonusTags");
|
||||
}
|
||||
return ot;
|
||||
}
|
||||
|
||||
public static ObjectTags generateTags(int id, int meta) {
|
||||
public static AspectList generateTags(int id, int meta) {
|
||||
try {
|
||||
if(generateTags == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.lib.ThaumcraftCraftingManager");
|
||||
generateTags = fake.getMethod("generateTags", int.class, int.class);
|
||||
}
|
||||
return (ObjectTags) generateTags.invoke(null, id, meta);
|
||||
return (AspectList) generateTags.invoke(null, id, meta);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method generateTags");
|
||||
}
|
||||
|
|
63
src/minecraft/thaumcraft/api/TileThaumcraft.java
Executable file
63
src/minecraft/thaumcraft/api/TileThaumcraft.java
Executable file
|
@ -0,0 +1,63 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Custom tile entity class I use for most of my tile entities. Setup in such a way that only
|
||||
* the nbt data within readCustomNBT / writeCustomNBT will be sent to the client when the tile
|
||||
* updates. Apart from all the normal TE data that gets sent that is.
|
||||
*
|
||||
*/
|
||||
public class TileThaumcraft extends TileEntity {
|
||||
|
||||
//NBT stuff
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
readCustomNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.writeToNBT(nbttagcompound);
|
||||
writeCustomNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
//Client Packet stuff
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeCustomNBT(nbttagcompound);
|
||||
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
this.readCustomNBT(pkt.customParam1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
209
src/minecraft/thaumcraft/api/aspects/Aspect.java
Normal file → Executable file
209
src/minecraft/thaumcraft/api/aspects/Aspect.java
Normal file → Executable file
|
@ -1,22 +1,74 @@
|
|||
package thaumcraft.api.aspects;
|
||||
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
|
||||
public Aspect(String tag, Aspect[] components) {
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
public Aspect(String tag) {
|
||||
this.tag = tag;
|
||||
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() {
|
||||
|
@ -35,51 +87,118 @@ public class Aspect {
|
|||
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 HashMap<String,Aspect> aspects = new HashMap<String,Aspect>();
|
||||
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 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("Air");
|
||||
public static final Aspect EARTH = new Aspect("Earth");
|
||||
public static final Aspect FIRE = new Aspect("Fire");
|
||||
public static final Aspect WATER = new Aspect("Water");
|
||||
public static final Aspect POSITIVE = new Aspect("Positive");
|
||||
public static final Aspect NEGATIVE = new Aspect("Negative");
|
||||
public static final Aspect ORDER = new Aspect("Order");
|
||||
public static final Aspect CHAOS = new Aspect("Chaos");
|
||||
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("Void", new Aspect[] {NEGATIVE, POSITIVE});
|
||||
public static final Aspect LIGHT = new Aspect("Light", new Aspect[] {AIR, FIRE});
|
||||
public static final Aspect DARKNESS = new Aspect("Darkness", new Aspect[] {VOID, LIGHT});
|
||||
public static final Aspect ASTRAL = new Aspect("Astral", new Aspect[] {VOID, DARKNESS});
|
||||
public static final Aspect ENERGY = new Aspect("Energy", new Aspect[] {POSITIVE, FIRE});
|
||||
public static final Aspect LIFE = new Aspect("Life", new Aspect[] {POSITIVE, ENERGY});
|
||||
public static final Aspect DEATH = new Aspect("Death", new Aspect[] {NEGATIVE, ENERGY});
|
||||
public static final Aspect MOTION = new Aspect("Motion", new Aspect[] {AIR, ORDER});
|
||||
public static final Aspect WEATHER = new Aspect("Weather", new Aspect[] {AIR, CHAOS});
|
||||
public static final Aspect STONE = new Aspect("Stone", new Aspect[] {EARTH, ORDER});
|
||||
public static final Aspect METAL = new Aspect("Metal", new Aspect[] {STONE, FIRE});
|
||||
public static final Aspect SAND = new Aspect("Sand", new Aspect[] {AIR, STONE});
|
||||
public static final Aspect SOUL = new Aspect("Soul", new Aspect[] {DEATH, LIFE});
|
||||
public static final Aspect HEAL = new Aspect("Heal", new Aspect[] {POSITIVE, LIFE});
|
||||
public static final Aspect HARM = new Aspect("Harm", new Aspect[] {NEGATIVE, LIFE});
|
||||
public static final Aspect ANIMATE = new Aspect("Animate",new Aspect[] {MOTION, LIFE});
|
||||
public static final Aspect MAN = new Aspect("Man", new Aspect[] {LIFE, SOUL});
|
||||
public static final Aspect BEAST = new Aspect("Beast", new Aspect[] {LIFE, CHAOS});
|
||||
public static final Aspect BIRD = new Aspect("Bird", new Aspect[] {BEAST, AIR});
|
||||
public static final Aspect FISH = new Aspect("Fish", new Aspect[] {BEAST, WATER});
|
||||
public static final Aspect SEED = new Aspect("Seed", new Aspect[] {LIFE, EARTH});
|
||||
public static final Aspect TREE = new Aspect("Tree", new Aspect[] {SEED, EARTH});
|
||||
public static final Aspect TOOL = new Aspect("Tool", new Aspect[] {MAN, METAL});
|
||||
public static final Aspect MINE = new Aspect("Mine", new Aspect[] {MAN, STONE});
|
||||
public static final Aspect WOOD = new Aspect("Wood", new Aspect[] {TREE, TOOL});
|
||||
public static final Aspect MACHINE = new Aspect("Machine", new Aspect[] {TOOL, ORDER});
|
||||
public static final Aspect VOID = new Aspect("vacuos",0x888888, new Aspect[] {ORDER, 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});
|
||||
|
||||
//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 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 MAN = new Aspect("humanus",0xffd7c0, new Aspect[] {BEAST, MIND});
|
||||
public static final Aspect SENSES = new Aspect("sensus",0x0fd9ff, new Aspect[] {AIR, SOUL});
|
||||
|
||||
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",0xFFFFFF, new Aspect[] {MAN, STONE});
|
||||
public static final Aspect TOOL = new Aspect("instrumentum",0xFFFFFF, new Aspect[] {MAN, METAL});
|
||||
public static final Aspect WEAPON = new Aspect("telum",0xFFFFFF, new Aspect[] {TOOL, ENTROPY});
|
||||
public static final Aspect ARMOR = new Aspect("tutamen",0x00c0c0, new Aspect[] {TOOL, ORDER});
|
||||
|
||||
public static final Aspect CLOTH = new Aspect("pannus",0xeaeac2, new Aspect[] {TOOL, BEAST});
|
||||
|
||||
|
||||
// public static final Aspect TRAVEL = new Aspect("Travel", new Aspect[] {MOTION, EARTH});
|
||||
// public static final Aspect TELEPORT = new Aspect("Teleport", new Aspect[] {TRAVEL, VOID});
|
||||
// public static final Aspect GLASS = new Aspect("Glass", new Aspect[] {SAND, FIRE});
|
||||
// public static final Aspect CLAY = new Aspect("Clay", new Aspect[] {SAND, LIFE});
|
||||
|
||||
|
||||
// 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 HEAL = new Aspect("Heal",0xFFFFFF, new Aspect[] {ORDER, LIFE});
|
||||
// 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});
|
||||
// public static final Aspect TOOL = new Aspect("Tool",0xFFFFFF, new Aspect[] {MAN, METAL});
|
||||
// public static final Aspect WOOD = new Aspect("Wood",0xFFFFFF, new Aspect[] {TREE, TOOL});
|
||||
// public static final Aspect MACHINE = new Aspect("Machine",0xFFFFFF, new Aspect[] {TOOL, ORDER});
|
||||
// public static final Aspect TRAVEL = new Aspect("Travel",0xFFFFFF, new Aspect[] {MOTION, EARTH});
|
||||
// public static final Aspect TELEPORT = new Aspect("Teleport",0xFFFFFF, new Aspect[] {TRAVEL, VOID});
|
||||
// public static final Aspect CLAY = new Aspect("Clay",0xFFFFFF, new Aspect[] {SAND, LIFE});
|
||||
public static final Aspect HEAL = new Aspect("heal",0xFFFFFF, new Aspect[] {ORDER, LIFE});
|
||||
public static final Aspect POISON = new Aspect("poison",0xFFFFFF, new Aspect[] {WATER, DEATH});
|
||||
public static final Aspect TRAP = new Aspect("pannus",0xeaeac2, new Aspect[] {MOTION, ENTROPY});
|
||||
public static final Aspect ICE = new Aspect("ice",0xde0005, new Aspect[] {WATER, ORDER});
|
||||
|
||||
}
|
||||
|
|
240
src/minecraft/thaumcraft/api/aspects/AspectList.java
Executable file
240
src/minecraft/thaumcraft/api/aspects/AspectList.java
Executable file
|
@ -0,0 +1,240 @@
|
|||
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 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 below 0 the aspect will be removed completely.
|
||||
* If the aspect does not exist then a negative value will be added.
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList remove(Aspect key, int amount) {
|
||||
if (getAmount(key)>=amount) {
|
||||
int am = getAmount(key)-amount;
|
||||
if (am<=0) aspects.remove(key); else
|
||||
this.aspects.put(key, am);
|
||||
} else if (getAmount(key)==0) {
|
||||
this.aspects.put(key, -amount);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package thaumcraft.api.aura;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import thaumcraft.api.ObjectTags;
|
||||
|
||||
public class AuraNode implements Serializable {
|
||||
//key
|
||||
public int key;
|
||||
|
||||
//aura
|
||||
public short level;
|
||||
public short baseLevel;
|
||||
public ObjectTags flux = new ObjectTags();
|
||||
public EnumNodeType type;
|
||||
|
||||
//location
|
||||
public int dimension;
|
||||
public double xPos;
|
||||
public double yPos;
|
||||
public double zPos;
|
||||
public boolean locked;
|
||||
|
||||
public AuraNode(int key, short lvl, EnumNodeType type, int dim, int x, int y, int z) {
|
||||
this.key = key;
|
||||
this.level = lvl;
|
||||
this.baseLevel = lvl;
|
||||
this.type = type;
|
||||
this.dimension = dim;
|
||||
this.xPos = x+.5d;
|
||||
this.yPos = y+.5d;
|
||||
this.zPos = z+.5d;
|
||||
}
|
||||
|
||||
public AuraNode() {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package thaumcraft.api.aura;
|
||||
|
||||
|
||||
|
||||
public enum EnumNodeType {
|
||||
NORMAL,
|
||||
PURE,
|
||||
DARK,
|
||||
UNSTABLE;
|
||||
|
||||
public static final EnumNodeType[] VALID_TYPES = {NORMAL,PURE,DARK,UNSTABLE};
|
||||
|
||||
public static EnumNodeType getType(int id)
|
||||
{
|
||||
if (id >= 0 && id < VALID_TYPES.length)
|
||||
{
|
||||
return VALID_TYPES[id];
|
||||
}
|
||||
return NORMAL;
|
||||
}
|
||||
}
|
9
src/minecraft/thaumcraft/api/crafting/IArcaneRecipe.java
Normal file → Executable file
9
src/minecraft/thaumcraft/api/crafting/IArcaneRecipe.java
Normal file → Executable file
|
@ -3,6 +3,8 @@ package thaumcraft.api.crafting;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public interface IArcaneRecipe
|
||||
{
|
||||
|
@ -12,7 +14,7 @@ public interface IArcaneRecipe
|
|||
* Used to check if a recipe matches current crafting inventory
|
||||
* @param player
|
||||
*/
|
||||
boolean matches(IInventory var1, EntityPlayer player);
|
||||
boolean matches(IInventory var1, World world, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
|
@ -25,6 +27,7 @@ public interface IArcaneRecipe
|
|||
int getRecipeSize();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
int getCost();
|
||||
String getKey();
|
||||
AspectList getAspects();
|
||||
String getResearch();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
|
||||
public interface IInfusionRecipe
|
||||
{
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
* @param player
|
||||
*/
|
||||
boolean matches(IInventory var1, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
ItemStack getCraftingResult(IInventory var1);
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
int getRecipeSize();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
int getCost();
|
||||
ObjectTags getTags();
|
||||
String getKey();
|
||||
}
|
53
src/minecraft/thaumcraft/api/crafting/RecipeCrucible.java
Normal file → Executable file
53
src/minecraft/thaumcraft/api/crafting/RecipeCrucible.java
Normal file → Executable file
|
@ -1,47 +1,50 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class RecipeCrucible {
|
||||
|
||||
public ItemStack recipeOutput;
|
||||
public ObjectTags tags;
|
||||
public Object catalyst;
|
||||
public AspectList aspects;
|
||||
public String key;
|
||||
public String researchKey;
|
||||
public int cost;
|
||||
|
||||
public RecipeCrucible(String researchKey, String key, ItemStack result, ObjectTags tags, int cost) {
|
||||
public RecipeCrucible(String researchKey, ItemStack result, Object catalyst, AspectList tags) {
|
||||
recipeOutput = result;
|
||||
this.tags = tags;
|
||||
this.key = key;
|
||||
this.researchKey = researchKey;
|
||||
this.cost = cost;
|
||||
this.aspects = tags;
|
||||
this.key = researchKey;
|
||||
this.catalyst = catalyst;
|
||||
if (catalyst instanceof String) {
|
||||
catalyst = OreDictionary.getOres((String) catalyst);
|
||||
}
|
||||
}
|
||||
|
||||
public RecipeCrucible(String key, ItemStack result, ObjectTags tags, int cost) {
|
||||
recipeOutput = result;
|
||||
this.tags = tags;
|
||||
this.key = key;
|
||||
this.researchKey = key;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public boolean matches(ObjectTags itags) {
|
||||
public boolean matches(AspectList itags, ItemStack cat) {
|
||||
if (catalyst instanceof ItemStack && !cat.isItemEqual((ItemStack) catalyst)) {
|
||||
return false;
|
||||
} else if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
||||
//if (!OreDictionary.containsMatch(true, ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{}), cat)) return false;
|
||||
}
|
||||
if (itags==null) return false;
|
||||
for (EnumTag tag:tags.getAspects()) {
|
||||
if (itags.getAmount(tag)<tags.getAmount(tag)) return false;
|
||||
for (Aspect tag:aspects.getAspects()) {
|
||||
if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ObjectTags removeMatching(ObjectTags itags) {
|
||||
ObjectTags temptags = new ObjectTags();
|
||||
temptags.tags.putAll(itags.tags);
|
||||
public AspectList removeMatching(AspectList itags) {
|
||||
AspectList temptags = new AspectList();
|
||||
temptags.aspects.putAll(itags.aspects);
|
||||
|
||||
for (EnumTag tag:tags.getAspects()) {
|
||||
if (!temptags.reduceAmount(tag, tags.getAmount(tag))) return null;
|
||||
for (Aspect tag:aspects.getAspects()) {
|
||||
temptags.remove(tag, aspects.getAmount(tag));
|
||||
// if (!temptags.remove(tag, aspects.getAmount(tag))) return null;
|
||||
}
|
||||
|
||||
itags = temptags;
|
||||
|
|
|
@ -1,171 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class ShapedArcaneCraftingRecipes implements IArcaneRecipe
|
||||
{
|
||||
/** How many horizontal slots this recipe is wide. */
|
||||
public int recipeWidth;
|
||||
|
||||
/** How many vertical slots this recipe uses. */
|
||||
public int recipeHeight;
|
||||
|
||||
public String key;
|
||||
|
||||
public int cost;
|
||||
|
||||
/** Is a array of ItemStack that composes the recipe. */
|
||||
public ItemStack[] recipeItems;
|
||||
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private ItemStack recipeOutput;
|
||||
|
||||
/** Is the itemID of the output item that you get when craft the recipe. */
|
||||
public final int recipeOutputItemID;
|
||||
|
||||
public ShapedArcaneCraftingRecipes(String key, int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack, int cost)
|
||||
{
|
||||
this.recipeOutputItemID = par4ItemStack.itemID;
|
||||
this.recipeWidth = par1;
|
||||
this.recipeHeight = par2;
|
||||
this.recipeItems = par3ArrayOfItemStack;
|
||||
this.recipeOutput = par4ItemStack;
|
||||
this.key = key;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
|
||||
{
|
||||
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
|
||||
return false;
|
||||
}
|
||||
for (int var2 = 0; var2 <= 3 - this.recipeWidth; ++var2)
|
||||
{
|
||||
for (int var3 = 0; var3 <= 3 - this.recipeHeight; ++var3)
|
||||
{
|
||||
if (this.checkMatch(par1InventoryCrafting, var2, var3, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.checkMatch(par1InventoryCrafting, var2, var3, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the region of a crafting inventory is match for the recipe.
|
||||
*/
|
||||
private boolean checkMatch(IInventory par1InventoryCrafting, int par2, int par3, boolean par4)
|
||||
{
|
||||
for (int var5 = 0; var5 < 3; ++var5)
|
||||
{
|
||||
for (int var6 = 0; var6 < 3; ++var6)
|
||||
{
|
||||
int var7 = var5 - par2;
|
||||
int var8 = var6 - par3;
|
||||
ItemStack var9 = null;
|
||||
|
||||
if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight)
|
||||
{
|
||||
if (par4)
|
||||
{
|
||||
var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth];
|
||||
}
|
||||
else
|
||||
{
|
||||
var9 = this.recipeItems[var7 + var8 * this.recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack var10 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var5, var6);
|
||||
|
||||
if (var10 != null || var9 != null)
|
||||
{
|
||||
if (var10 == null && var9 != null || var10 != null && var9 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.itemID != var10.itemID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.getItemDamage() != OreDictionary.WILDCARD_VALUE && var9.getItemDamage() != var10.getItemDamage())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.hasTagCompound()) {
|
||||
NBTTagCompound tc = var9.getTagCompound();
|
||||
for (Object tag:tc.getTags().toArray()) {
|
||||
NBTBase base = (NBTBase)tag;
|
||||
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
|
||||
if (!(var10.hasTagCompound() &&
|
||||
nc.cast(var10.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory par1InventoryCrafting)
|
||||
{
|
||||
return new ItemStack(this.recipeOutput.itemID, this.recipeOutput.stackSize, this.recipeOutput.getItemDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeWidth * this.recipeHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
257
src/minecraft/thaumcraft/api/crafting/ShapedArcaneRecipe.java
Executable file
257
src/minecraft/thaumcraft/api/crafting/ShapedArcaneRecipe.java
Executable file
|
@ -0,0 +1,257 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapedArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
//Added in for future ease of change, but hard coded for now.
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||
|
||||
public ItemStack output = null;
|
||||
public Object[] input = null;
|
||||
public AspectList aspects = null;
|
||||
public String research;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
||||
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
||||
public ShapedArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
this.research = research;
|
||||
this.aspects = aspects;
|
||||
String shape = "";
|
||||
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean)recipe[idx];
|
||||
if (recipe[idx+1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[])recipe[idx+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[])recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String)recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character)recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
itemMap.put(chr, ((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
{
|
||||
itemMap.put(chr, OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
||||
|
||||
@Override
|
||||
public int getRecipeSize(){ return input.length; }
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput(){ return output; }
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory inv, World world, EntityPlayer player)
|
||||
{
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, research)) {
|
||||
return false;
|
||||
}
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||
{
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||
{
|
||||
if (checkMatch(inv, x, y, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mirrored && checkMatch(inv, x, y, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
|
||||
{
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||
{
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||
{
|
||||
int subX = x - startX;
|
||||
int subY = y - startY;
|
||||
Object target = null;
|
||||
|
||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
||||
{
|
||||
if (mirror)
|
||||
{
|
||||
target = input[width - subX - 1 + subY * width];
|
||||
}
|
||||
else
|
||||
{
|
||||
target = input[subX + subY * width];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
|
||||
|
||||
if (target instanceof ItemStack)
|
||||
{
|
||||
if (!checkItemEquals((ItemStack)target, slot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target instanceof ArrayList)
|
||||
{
|
||||
boolean matched = false;
|
||||
|
||||
for (ItemStack item : (ArrayList<ItemStack>)target)
|
||||
{
|
||||
matched = matched || checkItemEquals(item, slot);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target == null && slot != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
||||
{
|
||||
if (input == null && target != null || input != null && target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.itemID == input.itemID &&
|
||||
ItemStack.areItemStackTagsEqual(target, input) &&
|
||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
public ShapedArcaneRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public Object[] getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return research;
|
||||
}
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class ShapedInfusionCraftingRecipes implements IInfusionRecipe
|
||||
{
|
||||
/** How many horizontal slots this recipe is wide. */
|
||||
public int recipeWidth;
|
||||
|
||||
/** How many vertical slots this recipe uses. */
|
||||
public int recipeHeight;
|
||||
|
||||
public String key;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public int cost;
|
||||
|
||||
public ObjectTags tags;
|
||||
|
||||
/** Is a array of ItemStack that composes the recipe. */
|
||||
public ItemStack[] recipeItems;
|
||||
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private ItemStack recipeOutput;
|
||||
|
||||
/** Is the itemID of the output item that you get when craft the recipe. */
|
||||
public final int recipeOutputItemID;
|
||||
|
||||
public ShapedInfusionCraftingRecipes(String key, int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack, int cost, ObjectTags tags)
|
||||
{
|
||||
this.recipeOutputItemID = par4ItemStack.itemID;
|
||||
this.recipeWidth = par1;
|
||||
this.recipeHeight = par2;
|
||||
this.recipeItems = par3ArrayOfItemStack;
|
||||
this.recipeOutput = par4ItemStack;
|
||||
this.key = key;
|
||||
this.cost = cost;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
|
||||
{
|
||||
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
|
||||
return false;
|
||||
}
|
||||
for (int var2 = 0; var2 <= 3 - this.recipeWidth; ++var2)
|
||||
{
|
||||
for (int var3 = 0; var3 <= 3 - this.recipeHeight; ++var3)
|
||||
{
|
||||
if (this.checkMatch(par1InventoryCrafting, var2, var3, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.checkMatch(par1InventoryCrafting, var2, var3, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the region of a crafting inventory is match for the recipe.
|
||||
*/
|
||||
private boolean checkMatch(IInventory par1InventoryCrafting, int par2, int par3, boolean par4)
|
||||
{
|
||||
for (int var5 = 0; var5 < 3; ++var5)
|
||||
{
|
||||
for (int var6 = 0; var6 < 3; ++var6)
|
||||
{
|
||||
int var7 = var5 - par2;
|
||||
int var8 = var6 - par3;
|
||||
ItemStack var9 = null;
|
||||
|
||||
if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight)
|
||||
{
|
||||
if (par4)
|
||||
{
|
||||
var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth];
|
||||
}
|
||||
else
|
||||
{
|
||||
var9 = this.recipeItems[var7 + var8 * this.recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack var10 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var5, var6);
|
||||
|
||||
if (var10 != null || var9 != null)
|
||||
{
|
||||
if (var10 == null && var9 != null || var10 != null && var9 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.itemID != var10.itemID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.getItemDamage() != OreDictionary.WILDCARD_VALUE && var9.getItemDamage() != var10.getItemDamage())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (var9.hasTagCompound()) {
|
||||
NBTTagCompound tc = var9.getTagCompound();
|
||||
for (Object tag:tc.getTags().toArray()) {
|
||||
NBTBase base = (NBTBase)tag;
|
||||
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
|
||||
if (!(var10.hasTagCompound() &&
|
||||
nc.cast(var10.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory par1InventoryCrafting)
|
||||
{
|
||||
return new ItemStack(this.recipeOutput.itemID, this.recipeOutput.stackSize, this.recipeOutput.getItemDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeWidth * this.recipeHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectTags getTags() {
|
||||
return tags;
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class ShapelessArcaneCraftingRecipes implements IArcaneRecipe
|
||||
{
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private final ItemStack recipeOutput;
|
||||
|
||||
/** Is a List of ItemStack that composes the recipe. */
|
||||
public final List recipeItems;
|
||||
|
||||
public String key;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public int cost;
|
||||
|
||||
public ShapelessArcaneCraftingRecipes(String key, ItemStack par1ItemStack, List par2List, int cost)
|
||||
{
|
||||
this.recipeOutput = par1ItemStack;
|
||||
this.recipeItems = par2List;
|
||||
this.key = key;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
|
||||
{
|
||||
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList var2 = new ArrayList(this.recipeItems);
|
||||
|
||||
for (int var3 = 0; var3 < 3; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < 3; ++var4)
|
||||
{
|
||||
ItemStack var5 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var4, var3);
|
||||
|
||||
if (var5 != null)
|
||||
{
|
||||
boolean var6 = false;
|
||||
Iterator var7 = var2.iterator();
|
||||
|
||||
while (var7.hasNext())
|
||||
{
|
||||
ItemStack var8 = (ItemStack)var7.next();
|
||||
|
||||
if (var5.itemID == var8.itemID && (var8.getItemDamage() == OreDictionary.WILDCARD_VALUE || var5.getItemDamage() == var8.getItemDamage()))
|
||||
{
|
||||
boolean matches=true;
|
||||
if (var8.hasTagCompound()) {
|
||||
NBTTagCompound tc = var8.getTagCompound();
|
||||
for (Object tag:tc.getTags().toArray()) {
|
||||
NBTBase base = (NBTBase)tag;
|
||||
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
|
||||
if (!(var5.hasTagCompound() &&
|
||||
nc.cast(var5.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
|
||||
matches=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matches) {
|
||||
var6 = true;
|
||||
var2.remove(var8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!var6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var2.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory par1InventoryCrafting)
|
||||
{
|
||||
return this.recipeOutput.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeItems.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
}
|
152
src/minecraft/thaumcraft/api/crafting/ShapelessArcaneRecipe.java
Executable file
152
src/minecraft/thaumcraft/api/crafting/ShapelessArcaneRecipe.java
Executable file
|
@ -0,0 +1,152 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapelessArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
private ItemStack output = null;
|
||||
private ArrayList input = new ArrayList();
|
||||
|
||||
public AspectList aspects = null;
|
||||
public String research;
|
||||
|
||||
public ShapelessArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
||||
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
||||
|
||||
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
this.research = research;
|
||||
this.aspects = aspects;
|
||||
for (Object in : recipe)
|
||||
{
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
input.add(((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
{
|
||||
input.add(new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
{
|
||||
input.add(new ItemStack((Block)in));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
{
|
||||
input.add(OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
{
|
||||
String ret = "Invalid shapeless ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize(){ return input.size(); }
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput(){ return output; }
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory var1, World world, EntityPlayer player)
|
||||
{
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, research)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList required = new ArrayList(input);
|
||||
|
||||
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
|
||||
if (next instanceof ItemStack)
|
||||
{
|
||||
match = checkItemEquals((ItemStack)next, slot);
|
||||
}
|
||||
else if (next instanceof ArrayList)
|
||||
{
|
||||
for (ItemStack item : (ArrayList<ItemStack>)next)
|
||||
{
|
||||
match = match || checkItemEquals(item, slot);
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
{
|
||||
inRecipe = true;
|
||||
required.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inRecipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return required.isEmpty();
|
||||
}
|
||||
|
||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
||||
{
|
||||
return (target.itemID == input.itemID &&
|
||||
ItemStack.areItemStackTagsEqual(target, input) &&
|
||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return research;
|
||||
}
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class ShapelessInfusionCraftingRecipes implements IInfusionRecipe
|
||||
{
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private final ItemStack recipeOutput;
|
||||
|
||||
/** Is a List of ItemStack that composes the recipe. */
|
||||
public final List recipeItems;
|
||||
|
||||
public String key;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public int cost;
|
||||
|
||||
public ObjectTags tags;
|
||||
|
||||
public ShapelessInfusionCraftingRecipes(String key, ItemStack par1ItemStack, List par2List, int cost, ObjectTags tags)
|
||||
{
|
||||
this.recipeOutput = par1ItemStack;
|
||||
this.recipeItems = par2List;
|
||||
this.key = key;
|
||||
this.cost = cost;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
|
||||
{
|
||||
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList var2 = new ArrayList(this.recipeItems);
|
||||
|
||||
for (int var3 = 0; var3 < 3; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < 3; ++var4)
|
||||
{
|
||||
ItemStack var5 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var4, var3);
|
||||
|
||||
if (var5 != null)
|
||||
{
|
||||
boolean var6 = false;
|
||||
Iterator var7 = var2.iterator();
|
||||
|
||||
while (var7.hasNext())
|
||||
{
|
||||
ItemStack var8 = (ItemStack)var7.next();
|
||||
|
||||
if (var5.itemID == var8.itemID && (var8.getItemDamage() == OreDictionary.WILDCARD_VALUE || var5.getItemDamage() == var8.getItemDamage()))
|
||||
{
|
||||
boolean matches=true;
|
||||
if (var8.hasTagCompound()) {
|
||||
NBTTagCompound tc = var8.getTagCompound();
|
||||
for (Object tag:tc.getTags().toArray()) {
|
||||
NBTBase base = (NBTBase)tag;
|
||||
Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass();
|
||||
if (!(var5.hasTagCompound() &&
|
||||
nc.cast(var5.getTagCompound().getTag(base.getName())).equals(nc.cast(base)))) {
|
||||
matches=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matches) {
|
||||
var6 = true;
|
||||
var2.remove(var8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!var6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var2.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory par1InventoryCrafting)
|
||||
{
|
||||
return this.recipeOutput.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeItems.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectTags getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class ShapelessInfusionCraftingWithNBTRecipes implements IInfusionRecipe
|
||||
{
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private final ItemStack recipeOutput;
|
||||
|
||||
/** Is a List of ItemStack that composes the recipe. */
|
||||
public final List recipeItems;
|
||||
|
||||
/** Is a List of nbt key/value pairs. */
|
||||
public final List<NBTBase> nbtList;
|
||||
|
||||
public String key;
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public int cost;
|
||||
|
||||
public ObjectTags tags;
|
||||
|
||||
public ShapelessInfusionCraftingWithNBTRecipes(String key,
|
||||
ItemStack par1ItemStack,
|
||||
List par2List, int cost, ObjectTags tags,
|
||||
List<NBTBase> nbtList)
|
||||
{
|
||||
this.recipeOutput = par1ItemStack;
|
||||
this.recipeItems = par2List;
|
||||
this.key = key;
|
||||
this.cost = cost;
|
||||
this.tags = tags;
|
||||
this.nbtList = nbtList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, EntityPlayer player)
|
||||
{
|
||||
if (key.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.username, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList var2 = new ArrayList(this.recipeItems);
|
||||
|
||||
for (int var3 = 0; var3 < 3; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < 3; ++var4)
|
||||
{
|
||||
ItemStack var5 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var4, var3);
|
||||
|
||||
if (var5 != null)
|
||||
{
|
||||
boolean var6 = false;
|
||||
Iterator var7 = var2.iterator();
|
||||
b1:
|
||||
while (var7.hasNext())
|
||||
{
|
||||
ItemStack var8 = (ItemStack)var7.next();
|
||||
|
||||
if (var5.itemID == var8.itemID && (var8.getItemDamage() == OreDictionary.WILDCARD_VALUE || var5.getItemDamage() == var8.getItemDamage()))
|
||||
{
|
||||
for (NBTBase nbt:nbtList) {
|
||||
try {
|
||||
Class nc = NBTBase.newTag(nbt.getId(), nbt.getName()).getClass();
|
||||
if (var5.hasTagCompound() &&
|
||||
nc.cast(var5.getTagCompound().getTag(nbt.getName())).equals(nc.cast(nbt))) {
|
||||
var6 = true;
|
||||
var2.remove(var8);
|
||||
break b1;
|
||||
}
|
||||
} catch (Exception e) {/*probably classcast*/}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!var6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var2.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory par1InventoryCrafting)
|
||||
{
|
||||
return this.recipeOutput.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeItems.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectTags getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
}
|
218
src/minecraft/thaumcraft/api/nodes/TileNodeBase.java
Executable file
218
src/minecraft/thaumcraft/api/nodes/TileNodeBase.java
Executable file
|
@ -0,0 +1,218 @@
|
|||
package thaumcraft.api.nodes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import thaumcraft.api.TileThaumcraft;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Used as a base for all node tile entities. All the work actually gets done in a non-api TE
|
||||
* that extends this class.
|
||||
*
|
||||
*/
|
||||
public class TileNodeBase extends TileThaumcraft {
|
||||
|
||||
public static enum NodeType
|
||||
{
|
||||
NORMAL, UNSTABLE, DARK, TAINTED, HUNGRY, PURE
|
||||
}
|
||||
|
||||
public static enum NodeModifier
|
||||
{
|
||||
BRIGHT, PALE, FADING
|
||||
}
|
||||
|
||||
short nodeVisBase = 0;
|
||||
|
||||
AspectList aspects = new AspectList();
|
||||
|
||||
public static HashMap<String,ArrayList<Integer>> locations = new HashMap<String,ArrayList<Integer>>();
|
||||
|
||||
private NodeType nodeType=NodeType.NORMAL;
|
||||
private NodeModifier nodeModifier=null;
|
||||
|
||||
|
||||
|
||||
protected String id;
|
||||
|
||||
public String getId() {
|
||||
if (id==null) {
|
||||
id = generateIdentifier();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public String generateIdentifier() {
|
||||
id = worldObj.provider.dimensionId + ":" + xCoord + ":" + yCoord+ ":" + zCoord;
|
||||
|
||||
if (worldObj!=null && locations!=null) {
|
||||
ArrayList<Integer> t = new ArrayList<Integer>();
|
||||
t.add(worldObj.provider.dimensionId);
|
||||
t.add(xCoord);
|
||||
t.add(yCoord);
|
||||
t.add(zCoord);
|
||||
locations.put(id, t);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
if (locations!=null) locations.remove(id);
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
if (id==null) generateIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the aspects and their amounts that this node contains
|
||||
* @return
|
||||
*/
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the aspects contained within this node
|
||||
* @return
|
||||
*/
|
||||
public void setAspects(AspectList aspects) {
|
||||
this.aspects = aspects;
|
||||
short highest=0;
|
||||
for (Aspect aspect:aspects.getAspects()) {
|
||||
if (aspects.getAmount(aspect)>highest)
|
||||
highest=(short) aspects.getAmount(aspect);
|
||||
}
|
||||
nodeVisBase = highest;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to add a certain amount of an aspect to the node.
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return the amount of aspect left over that could not be added.
|
||||
*/
|
||||
public int addToSource(Aspect aspect, int amount) {
|
||||
int left = (amount+aspects.getAmount(aspect))-nodeVisBase;
|
||||
left = left>0?left:0;
|
||||
aspects.add(aspect, amount-left);
|
||||
return left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a certain amount of a specific aspect from the node
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return true if that amount of aspect was available and was removed
|
||||
*/
|
||||
public boolean takeFromSource(Aspect aspect, int amount) {
|
||||
return aspects.reduce(aspect, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a single random aspect from the source
|
||||
* @return the aspect that was retrieved (it is assumed that only 1 of that aspect has been removed).
|
||||
* Should return null if there are not enough aspects.
|
||||
*/
|
||||
public Aspect takeRandomPrimalFromSource() {
|
||||
Aspect[] primals = aspects.getPrimalAspects();
|
||||
Aspect asp = primals[worldObj.rand.nextInt(primals.length)];
|
||||
if (asp !=null && aspects.reduce(asp,1)) {
|
||||
return asp;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Aspect chooseRandomFilteredFromSource(AspectList filter) {
|
||||
ArrayList<Aspect> validaspects = new ArrayList<Aspect>();
|
||||
for (Aspect prim:aspects.getAspects()) {
|
||||
if (filter.getAmount(prim)>0 && aspects.getAmount(prim)>0) validaspects.add(prim);
|
||||
}
|
||||
if (validaspects.size()==0) return null;
|
||||
Aspect asp = validaspects.get(worldObj.rand.nextInt(validaspects.size()));
|
||||
if (asp !=null && aspects.getAmount(asp)>0) {
|
||||
return asp;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
this.id = nbttagcompound.getString("nodeId");
|
||||
this.nodeVisBase = nbttagcompound.getShort("nodeVisBase");
|
||||
|
||||
if (worldObj!=null && locations!=null) {
|
||||
ArrayList<Integer> t = new ArrayList<Integer>();
|
||||
t.add(worldObj.provider.dimensionId);
|
||||
t.add(xCoord);
|
||||
t.add(yCoord);
|
||||
t.add(zCoord);
|
||||
locations.put(id, t);
|
||||
}
|
||||
|
||||
this.setNodeType(NodeType.values()[nbttagcompound.getByte("type")]);
|
||||
byte mod = nbttagcompound.getByte("modifier");
|
||||
if (mod>=0)
|
||||
this.setNodeModifier(NodeModifier.values()[mod]);
|
||||
else
|
||||
this.setNodeModifier(null);
|
||||
|
||||
aspects.readFromNBT(nbttagcompound);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
if (id==null) id = generateIdentifier();
|
||||
nbttagcompound.setString("nodeId", id);
|
||||
nbttagcompound.setShort("nodeVisBase", nodeVisBase);
|
||||
nbttagcompound.setByte("type", (byte) this.getNodeType().ordinal());
|
||||
nbttagcompound.setByte("modifier", getNodeModifier()==null?-1:(byte) this.getNodeModifier().ordinal());
|
||||
aspects.writeToNBT(nbttagcompound);
|
||||
|
||||
}
|
||||
|
||||
public NodeType getNodeType() {
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
public void setNodeType(NodeType nodeType) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
public void setNodeModifier(NodeModifier nodeModifier) {
|
||||
this.nodeModifier = nodeModifier;
|
||||
}
|
||||
|
||||
public NodeModifier getNodeModifier() {
|
||||
return nodeModifier;
|
||||
}
|
||||
|
||||
public int getNodeVisBase() {
|
||||
return nodeVisBase;
|
||||
}
|
||||
|
||||
public void setNodeVisBase(short nodeVisBase) {
|
||||
this.nodeVisBase = nodeVisBase;
|
||||
}
|
||||
|
||||
public void nodeChange() {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
}
|
0
src/minecraft/thaumcraft/api/research/IScanEventHandler.java
Normal file → Executable file
0
src/minecraft/thaumcraft/api/research/IScanEventHandler.java
Normal file → Executable file
85
src/minecraft/thaumcraft/api/research/ResearchCategories.java
Executable file
85
src/minecraft/thaumcraft/api/research/ResearchCategories.java
Executable file
|
@ -0,0 +1,85 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ResearchCategories {
|
||||
|
||||
//Research
|
||||
public static LinkedHashMap <String, ResearchCategoryList> researchCategories = new LinkedHashMap <String,ResearchCategoryList>();
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the research item linked to this key
|
||||
*/
|
||||
public static ResearchCategoryList getResearchList(String key) {
|
||||
return researchCategories.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the name of the research category linked to this key.
|
||||
* Must be stored as localization information in the LanguageRegistry.
|
||||
*/
|
||||
public static String getCategoryName(String key) {
|
||||
return StatCollector.translateToLocal("tc.research_category."+key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key
|
||||
* @return the ResearchItem object.
|
||||
*/
|
||||
public static ResearchItem getResearch(String key) {
|
||||
Collection rc = researchCategories.values();
|
||||
for (Object cat:rc) {
|
||||
Collection rl = ((ResearchCategoryList)cat).research.values();
|
||||
for (Object ri:rl) {
|
||||
if ((((ResearchItem)ri).key).equals(key)) return (ResearchItem)ri;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the key used for this category
|
||||
* @param icon the icon to be used for the research category tab
|
||||
* @param background the resource location of the background image to use for this category
|
||||
* @return the name of the research linked to this key
|
||||
*/
|
||||
public static void registerCategory(String key, ResourceLocation icon, ResourceLocation background) {
|
||||
if (getResearchList(key)==null) {
|
||||
ResearchCategoryList rl = new ResearchCategoryList(icon, background);
|
||||
researchCategories.put(key, rl);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addResearch(ResearchItem ri) {
|
||||
ResearchCategoryList rl = getResearchList(ri.category);
|
||||
if (rl!=null && !rl.research.containsKey(ri.key)) {
|
||||
rl.research.put(ri.key, ri);
|
||||
|
||||
if (ri.displayColumn < rl.minDisplayColumn)
|
||||
{
|
||||
rl.minDisplayColumn = ri.displayColumn;
|
||||
}
|
||||
|
||||
if (ri.displayRow < rl.minDisplayRow)
|
||||
{
|
||||
rl.minDisplayRow = ri.displayRow;
|
||||
}
|
||||
|
||||
if (ri.displayColumn > rl.maxDisplayColumn)
|
||||
{
|
||||
rl.maxDisplayColumn = ri.displayColumn;
|
||||
}
|
||||
|
||||
if (ri.displayRow > rl.maxDisplayRow)
|
||||
{
|
||||
rl.maxDisplayRow = ri.displayRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
src/minecraft/thaumcraft/api/research/ResearchCategoryList.java
Executable file
37
src/minecraft/thaumcraft/api/research/ResearchCategoryList.java
Executable file
|
@ -0,0 +1,37 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ResearchCategoryList {
|
||||
|
||||
/** Is the smallest column used on the GUI. */
|
||||
public int minDisplayColumn;
|
||||
|
||||
/** Is the smallest row used on the GUI. */
|
||||
public int minDisplayRow;
|
||||
|
||||
/** Is the biggest column used on the GUI. */
|
||||
public int maxDisplayColumn;
|
||||
|
||||
/** Is the biggest row used on the GUI. */
|
||||
public int maxDisplayRow;
|
||||
|
||||
/** display variables **/
|
||||
public ResourceLocation icon;
|
||||
public ResourceLocation background;
|
||||
|
||||
public ResearchCategoryList(ResourceLocation icon, ResourceLocation background) {
|
||||
this.icon = icon;
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
//Research
|
||||
public Map<String, ResearchItem> research = new HashMap<String,ResearchItem>();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
262
src/minecraft/thaumcraft/api/research/ResearchItem.java
Normal file → Executable file
262
src/minecraft/thaumcraft/api/research/ResearchItem.java
Normal file → Executable file
|
@ -1,14 +1,10 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -20,38 +16,28 @@ public class ResearchItem
|
|||
public final String key;
|
||||
|
||||
/**
|
||||
* The name of the research shown in the thaumonomicon
|
||||
* A short string used as a reference to the research category to which this must be added.
|
||||
*/
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* The blurb text shown below the research name in the thaumonomicon
|
||||
*/
|
||||
public String popupText;
|
||||
|
||||
/**
|
||||
* A longer description of the research. This is the text shown in the handheld research scroll and the research table.
|
||||
*/
|
||||
public String longText;
|
||||
public final String category;
|
||||
|
||||
/**
|
||||
* The aspect tags and their values required to complete this research
|
||||
*/
|
||||
public final ObjectTags tags;
|
||||
public final AspectList tags;
|
||||
|
||||
/**
|
||||
* This links to any research that needs to be completed before this research can be discovered or learnt.
|
||||
*/
|
||||
public ResearchItem[] parents = null;
|
||||
public String[] parents = null;
|
||||
|
||||
/**
|
||||
* Like parent above, but a line will not be displayed in the thaumonomicon linking them. Just used to prevent clutter.
|
||||
*/
|
||||
public ResearchItem[] parentsHidden = null;
|
||||
public String[] parentsHidden = null;
|
||||
/**
|
||||
* any research linked to this that will be unlocked automatically when this research is complete
|
||||
*/
|
||||
public ResearchItem[] siblings = null;
|
||||
public String[] siblings = null;
|
||||
|
||||
/**
|
||||
* the horizontal position of the research icon
|
||||
|
@ -64,116 +50,100 @@ public class ResearchItem
|
|||
public final int displayRow;
|
||||
|
||||
/**
|
||||
* the itemstack of an item or block that will be used as the icon for this research
|
||||
* the icon to be used for this research
|
||||
*/
|
||||
public final ItemStack itemStack;
|
||||
public final ItemStack icon_item;
|
||||
|
||||
/**
|
||||
* the index within the research.png file used for this research if it does not use an item icon
|
||||
* the icon to be used for this research
|
||||
*/
|
||||
public final int iconIndex;
|
||||
public final ResourceLocation icon_resource;
|
||||
|
||||
/**
|
||||
* How large the research grid is. Valid values are 1 to 5.
|
||||
*/
|
||||
private int complexity;
|
||||
|
||||
/**
|
||||
* Special research has a spiky border. Used for important research milestones.
|
||||
*/
|
||||
private boolean isSpecial;
|
||||
|
||||
/**
|
||||
* This indicates if the research should use a circular icon border. Usually used for research that doesn't
|
||||
* have recipes or that unlocks automatically via the sibling system
|
||||
* This indicates if the research should use a circular icon border. Usually used for "passive" research
|
||||
* that doesn't have recipes and grants passive effects, or that unlock automatically.
|
||||
*/
|
||||
private boolean isRound;
|
||||
|
||||
/**
|
||||
* Stub research cannot be discovered by normal means, but can be unlocked via the sibling system.
|
||||
*/
|
||||
private boolean isStub;
|
||||
|
||||
/**
|
||||
* Indicates research that cannot be gained by normal means (either via normal or lost research),
|
||||
* but still uses a normal icon. Works much like isStub but is handy for mods that wish to add research
|
||||
* through their own means and keep a normal icon.
|
||||
* This indicated that the research is completely hidden and cannot be discovered by any
|
||||
* player-controlled means. The recipes will never show up in the thaumonomicon.
|
||||
* Usually used to unlock "hidden" recipes via sibling unlocking, like
|
||||
* the various cap and rod combos for wands.
|
||||
*/
|
||||
private boolean isAlternate;
|
||||
private boolean isVirtual;
|
||||
|
||||
/**
|
||||
* Hidden research does not display in the thaumonomicon until discovered
|
||||
*/
|
||||
private boolean isHidden;
|
||||
|
||||
/**
|
||||
* Lost research can only be discovered via knowledge fragments
|
||||
*/
|
||||
private boolean isLost;
|
||||
|
||||
/**
|
||||
* These research items will automatically unlock for all players on game start
|
||||
*/
|
||||
private boolean isAutoUnlock;
|
||||
|
||||
private ResearchPage[] pages = null;
|
||||
|
||||
|
||||
public ResearchItem(String par1, ObjectTags tags, int par3, int par4, int icon)
|
||||
{
|
||||
this(par1, tags, par3, par4, (ItemStack)null, icon);
|
||||
}
|
||||
|
||||
public ResearchItem(String par1, ObjectTags tags, int par3, int par4, ItemStack par5Item)
|
||||
{
|
||||
this(par1, tags, par3, par4, par5Item, -1);
|
||||
}
|
||||
|
||||
public ResearchItem(String par1, ObjectTags tags, int par3, int par4, Item par5Item)
|
||||
{
|
||||
this(par1, tags, par3, par4, new ItemStack(par5Item), -1);
|
||||
}
|
||||
|
||||
public ResearchItem(String par1, ObjectTags tags, int par3, int par4, Block par5Block)
|
||||
{
|
||||
this(par1, tags, par3, par4, new ItemStack(par5Block), -1);
|
||||
}
|
||||
|
||||
public ResearchItem(String par1, ObjectTags tags, int par3, int par4, ItemStack par5ItemStack, int icon)
|
||||
public ResearchItem(String par1, String par2)
|
||||
{
|
||||
this.key = par1;
|
||||
this.category = par2;
|
||||
this.tags = new AspectList();
|
||||
this.icon_resource = null;
|
||||
this.icon_item = null;
|
||||
this.displayColumn = 0;
|
||||
this.displayRow = 0;
|
||||
this.setVirtual();
|
||||
|
||||
}
|
||||
|
||||
public ResearchItem(String par1, String par2, AspectList tags, int par3, int par4, int par5, ResourceLocation icon)
|
||||
{
|
||||
this.key = par1;
|
||||
this.category = par2;
|
||||
this.tags = tags;
|
||||
this.name = "";
|
||||
this.longText = "";
|
||||
this.popupText = "";
|
||||
|
||||
Element el = ThaumcraftApi.researchDoc.getElementById(key);
|
||||
if (el!=null) {
|
||||
NodeList children = el.getChildNodes();
|
||||
for (int a=0;a<children.getLength();a++) {
|
||||
if (children.item(a).getNodeName().equals("name")) {
|
||||
this.name = children.item(a).getTextContent();
|
||||
} else
|
||||
if (children.item(a).getNodeName().equals("longText")) {
|
||||
this.longText = children.item(a).getTextContent();
|
||||
} else
|
||||
if (children.item(a).getNodeName().equals("popupText") ) {
|
||||
this.popupText = children.item(a).getTextContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.itemStack = par5ItemStack;
|
||||
this.iconIndex = icon;
|
||||
this.icon_resource = icon;
|
||||
this.icon_item = null;
|
||||
this.displayColumn = par3;
|
||||
this.displayRow = par4;
|
||||
|
||||
|
||||
if (par3 < ResearchList.minDisplayColumn)
|
||||
{
|
||||
ResearchList.minDisplayColumn = par3;
|
||||
this.complexity = par5;
|
||||
if (complexity < 1) this.complexity = 1;
|
||||
if (complexity > 5) this.complexity = 5;
|
||||
}
|
||||
|
||||
if (par4 < ResearchList.minDisplayRow)
|
||||
public ResearchItem(String par1, String par2, AspectList tags, int par3, int par4, int par5, ItemStack icon)
|
||||
{
|
||||
ResearchList.minDisplayRow = par4;
|
||||
}
|
||||
|
||||
if (par3 > ResearchList.maxDisplayColumn)
|
||||
{
|
||||
ResearchList.maxDisplayColumn = par3;
|
||||
}
|
||||
|
||||
if (par4 > ResearchList.maxDisplayRow)
|
||||
{
|
||||
ResearchList.maxDisplayRow = par4;
|
||||
}
|
||||
|
||||
|
||||
this.key = par1;
|
||||
this.category = par2;
|
||||
this.tags = tags;
|
||||
this.icon_item = icon;
|
||||
this.icon_resource = null;
|
||||
this.displayColumn = par3;
|
||||
this.displayRow = par4;
|
||||
this.complexity = par5;
|
||||
if (complexity <0) this.complexity = 0;
|
||||
if (complexity > 5) this.complexity = 5;
|
||||
}
|
||||
|
||||
public ResearchItem setSpecial()
|
||||
|
@ -188,11 +158,6 @@ public class ResearchItem
|
|||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setAlternate()
|
||||
{
|
||||
this.isAlternate = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setHidden()
|
||||
{
|
||||
|
@ -206,63 +171,87 @@ public class ResearchItem
|
|||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setParents(ResearchItem... par)
|
||||
public ResearchItem setVirtual()
|
||||
{
|
||||
this.isVirtual = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setParents(String... par)
|
||||
{
|
||||
this.parents = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setParentsHidden(ResearchItem... par)
|
||||
|
||||
|
||||
public ResearchItem setParentsHidden(String... par)
|
||||
{
|
||||
this.parentsHidden = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setSiblings(ResearchItem... sib)
|
||||
public ResearchItem setSiblings(String... sib)
|
||||
{
|
||||
this.siblings = sib;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setPages(ResearchPage... par)
|
||||
{
|
||||
this.pages = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchPage[] getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public ResearchItem registerResearchItem()
|
||||
{
|
||||
ResearchList.research.put(key, this);
|
||||
ResearchCategories.addResearch(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
return StatCollector.translateToLocal("tc.research_name."+key);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean getSpecial()
|
||||
public String getText()
|
||||
{
|
||||
return StatCollector.translateToLocal("tc.research_text."+key);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isSpecial()
|
||||
{
|
||||
return this.isSpecial;
|
||||
}
|
||||
|
||||
public boolean getStub()
|
||||
public boolean isStub()
|
||||
{
|
||||
return this.isStub;
|
||||
}
|
||||
|
||||
public boolean getAlternate()
|
||||
{
|
||||
return this.isAlternate;
|
||||
}
|
||||
|
||||
public boolean getHidden()
|
||||
public boolean isHidden()
|
||||
{
|
||||
return this.isHidden;
|
||||
}
|
||||
|
||||
public boolean getLost()
|
||||
public boolean isLost()
|
||||
{
|
||||
return this.isLost;
|
||||
}
|
||||
|
||||
public boolean getAutoUnlock() {
|
||||
public boolean isVirtual()
|
||||
{
|
||||
return this.isVirtual;
|
||||
}
|
||||
|
||||
public boolean isAutoUnlock() {
|
||||
return isAutoUnlock;
|
||||
}
|
||||
|
||||
|
@ -271,4 +260,41 @@ public class ResearchItem
|
|||
this.isAutoUnlock = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRound() {
|
||||
return isRound;
|
||||
}
|
||||
|
||||
public ResearchItem setRound() {
|
||||
this.isRound = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getComplexity() {
|
||||
return complexity;
|
||||
}
|
||||
|
||||
public ResearchItem setComplexity(int complexity) {
|
||||
this.complexity = complexity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
|
||||
*/
|
||||
public Aspect getResearchPrimaryTag() {
|
||||
Aspect aspect=null;
|
||||
int highest=0;
|
||||
if (tags!=null)
|
||||
for (Aspect tag:tags.getAspects()) {
|
||||
if (tags.getAmount(tag)>highest) {
|
||||
aspect=tag;
|
||||
highest=tags.getAmount(tag);
|
||||
};
|
||||
}
|
||||
return aspect;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import thaumcraft.api.EnumTag;
|
||||
|
||||
public class ResearchList {
|
||||
|
||||
/** Is the smallest column used on the GUI. */
|
||||
public static int minDisplayColumn;
|
||||
|
||||
/** Is the smallest row used on the GUI. */
|
||||
public static int minDisplayRow;
|
||||
|
||||
/** Is the biggest column used on the GUI. */
|
||||
public static int maxDisplayColumn;
|
||||
|
||||
/** Is the biggest row used on the GUI. */
|
||||
public static int maxDisplayRow;
|
||||
|
||||
//Research
|
||||
public static Map<String, ResearchItem> research = new HashMap<String,ResearchItem>();
|
||||
|
||||
|
||||
public static Map<String, List> craftingRecipesForResearch = new HashMap<String, List>();
|
||||
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the research item linked to this key
|
||||
*/
|
||||
public static ResearchItem getResearch(String key) {
|
||||
return research.get(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the name of the research linked to this key
|
||||
*/
|
||||
public static String getResearchName(String key) {
|
||||
ResearchItem rr = research.get(key);
|
||||
if (rr==null) return "";
|
||||
return rr.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return a list of the enumtags used in this research. returns the numeric values and not the actual enum
|
||||
*/
|
||||
public static byte[] getResearchTags(String key) {
|
||||
ResearchItem rr = research.get(key);
|
||||
if (rr==null) return null;
|
||||
byte[] output = new byte[rr.tags.size()];
|
||||
EnumTag[] et = rr.tags.getAspects();
|
||||
for (int a=0;a<rr.tags.size();a++) {
|
||||
output[a] = (byte) et[a].id;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the aspect enumtag ordinal with the highest value. Used to determine scroll color and similar things
|
||||
*/
|
||||
public static int getResearchPrimaryTag(String key) {
|
||||
int t=0;
|
||||
int amt=0;
|
||||
ResearchItem rr = research.get(key);
|
||||
if (rr==null) return 0;
|
||||
for (EnumTag tag:rr.tags.getAspects()) {
|
||||
if (rr.tags.getAmount(tag)>amt) {
|
||||
t=tag.id;
|
||||
amt=rr.tags.getAmount(tag);
|
||||
};
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public static int getResearchAmount(String key, EnumTag tag) {
|
||||
ResearchItem rr = research.get(key);
|
||||
if (rr==null) return 0;
|
||||
return rr.tags.getAmount(tag);
|
||||
}
|
||||
|
||||
}
|
108
src/minecraft/thaumcraft/api/research/ResearchPage.java
Executable file
108
src/minecraft/thaumcraft/api/research/ResearchPage.java
Executable file
|
@ -0,0 +1,108 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.api.crafting.RecipeCrucible;
|
||||
|
||||
public class ResearchPage {
|
||||
public static enum PageType
|
||||
{
|
||||
TEXT,
|
||||
IMAGE,
|
||||
CRUCIBLE_CRAFTING,
|
||||
ARCANE_CRAFTING,
|
||||
ASPECTS,
|
||||
NORMAL_CRAFTING,
|
||||
COMPOUND_CRAFTING
|
||||
}
|
||||
|
||||
public PageType type = PageType.TEXT;
|
||||
|
||||
public String text=null;
|
||||
public ResourceLocation image=null;
|
||||
public AspectList aspects=null;
|
||||
public Object recipe=null;
|
||||
public ItemStack recipeOutput=null;
|
||||
|
||||
/**
|
||||
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
|
||||
*/
|
||||
public ResearchPage(String text) {
|
||||
this.type = PageType.TEXT;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a vanilla crafting recipe.
|
||||
*/
|
||||
public ResearchPage(IRecipe recipe) {
|
||||
this.type = PageType.NORMAL_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a compound crafting recipe.
|
||||
*/
|
||||
public ResearchPage(List recipe) {
|
||||
this.type = PageType.COMPOUND_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an arcane worktable crafting recipe.
|
||||
*/
|
||||
public ResearchPage(IArcaneRecipe recipe) {
|
||||
this.type = PageType.ARCANE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an alchemy crafting recipe.
|
||||
*/
|
||||
public ResearchPage(RecipeCrucible recipe) {
|
||||
this.type = PageType.CRUCIBLE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param image
|
||||
* @param caption this can (but does not have to) be a reference to a localization variable, not the actual text.
|
||||
*/
|
||||
public ResearchPage(ResourceLocation image, String caption) {
|
||||
this.type = PageType.IMAGE;
|
||||
this.image = image;
|
||||
this.text = caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should really not be called directly - used internally
|
||||
*/
|
||||
public ResearchPage(AspectList as) {
|
||||
this.type = PageType.ASPECTS;
|
||||
this.aspects = as;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a localized text of the text field (if one exists). Returns the text field itself otherwise.
|
||||
* @return
|
||||
*/
|
||||
public String getTranslatedText() {
|
||||
String ret="";
|
||||
if (text != null) {
|
||||
ret = StatCollector.translateToLocal(text);
|
||||
if (ret.isEmpty()) ret = text;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ResearchPlayer {
|
||||
public Map<String,List<String>> researchCompleted = new HashMap<String,List<String>>();
|
||||
|
||||
public Map<String,List<Short[]>> objectsScanned = new HashMap<String,List<Short[]>>();
|
||||
public Map<String,List<String>> entitiesScanned = new HashMap<String,List<String>>();
|
||||
public Map<String,List<String>> phenomenaScanned = new HashMap<String,List<String>>();
|
||||
|
||||
}
|
0
src/minecraft/thaumcraft/api/research/ScanResult.java
Normal file → Executable file
0
src/minecraft/thaumcraft/api/research/ScanResult.java
Normal file → Executable file
52
src/minecraft/thaumcraft/api/wands/IWandFocus.java
Executable file
52
src/minecraft/thaumcraft/api/wands/IWandFocus.java
Executable file
|
@ -0,0 +1,52 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
|
||||
public interface IWandFocus {
|
||||
|
||||
public enum WandFocusAnimation {
|
||||
WAVE, CHARGE;
|
||||
}
|
||||
|
||||
public int getFocusColor();
|
||||
|
||||
public Icon getOrnament();
|
||||
|
||||
public WandFocusAnimation getAnimation();
|
||||
|
||||
/**
|
||||
* Gets the amount of vis used per aspect per click or tick. This cost is actually listed as
|
||||
* a hundredth of a single point of vis, so a cost of 100 will equal one vis per tick/click.
|
||||
* It is returned as an AspectList to allow for multiple vis types in different ratios.
|
||||
*/
|
||||
public AspectList getVisCost();
|
||||
|
||||
public boolean isVisCostPerTick();
|
||||
|
||||
public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition);
|
||||
|
||||
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count);
|
||||
|
||||
public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count);
|
||||
|
||||
/**
|
||||
* Helper method to determine in what order foci should be iterated through when
|
||||
* the user presses the 'change focus' keybinding.
|
||||
* @return a string of characters that foci will be sorted against.
|
||||
* For example AA00 will be placed before FG12
|
||||
* <br>As a guide build the sort string from two alphanumeric characters followed by
|
||||
* two numeric characters based on... whatever.
|
||||
*/
|
||||
public String getSortingHelper(ItemStack itemstack);
|
||||
|
||||
boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player);
|
||||
|
||||
|
||||
|
||||
}
|
16
src/minecraft/thaumcraft/api/wands/IWandRodOnUpdate.java
Executable file
16
src/minecraft/thaumcraft/api/wands/IWandRodOnUpdate.java
Executable file
|
@ -0,0 +1,16 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Implemented by a class that you wish to be called whenever a wand with this rod performs its
|
||||
* update tick.
|
||||
*
|
||||
*/
|
||||
public interface IWandRodOnUpdate {
|
||||
void onUpdate(ItemStack itemstack, EntityPlayer player);
|
||||
}
|
12
src/minecraft/thaumcraft/api/wands/IWandTriggerManager.java
Executable file
12
src/minecraft/thaumcraft/api/wands/IWandTriggerManager.java
Executable file
|
@ -0,0 +1,12 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IWandTriggerManager {
|
||||
|
||||
public boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
||||
int x, int y, int z, int side, int event);
|
||||
|
||||
}
|
25
src/minecraft/thaumcraft/api/wands/IWandable.java
Executable file
25
src/minecraft/thaumcraft/api/wands/IWandable.java
Executable file
|
@ -0,0 +1,25 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Add this to a tile entity that you wish wands to interact with in some way.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWandable {
|
||||
|
||||
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md);
|
||||
|
||||
public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player);
|
||||
|
||||
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count);
|
||||
|
||||
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count);
|
||||
|
||||
}
|
129
src/minecraft/thaumcraft/api/wands/ItemFocusBasic.java
Executable file
129
src/minecraft/thaumcraft/api/wands/ItemFocusBasic.java
Executable file
|
@ -0,0 +1,129 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFocusBasic extends Item implements IWandFocus {
|
||||
|
||||
public ItemFocusBasic (int i)
|
||||
{
|
||||
super(i);
|
||||
maxStackSize = 1;
|
||||
canRepair=false;
|
||||
}
|
||||
|
||||
public Icon icon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) {
|
||||
AspectList al = this.getVisCost();
|
||||
if (al!=null && al.size()>0) {
|
||||
list.add(StatCollector.translateToLocal(isVisCostPerTick()?"item.Focus.cost2":"item.Focus.cost1"));
|
||||
for (Aspect aspect:al.getAspectsSorted()) {
|
||||
DecimalFormat myFormatter = new DecimalFormat("#####.##");
|
||||
String amount = myFormatter.format(al.getAmount(aspect)/100f);
|
||||
list.add(" \u00A7"+aspect.getChatcolor()+aspect.getName()+"\u00A7r x "+ amount);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getFocusColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getVisCost() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onFocusRightClick(ItemStack itemstack, World world,
|
||||
EntityPlayer player, MovingObjectPosition movingobjectposition) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player,
|
||||
int count) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world,
|
||||
EntityPlayer player, int count) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Just insert two alphanumeric characters before this string in your focus item class
|
||||
*/
|
||||
@Override
|
||||
public String getSortingHelper(ItemStack itemstack) {
|
||||
return "00";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisCostPerTick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getOrnament() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y,
|
||||
int z, EntityPlayer player) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WandFocusAnimation getAnimation() {
|
||||
return WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
122
src/minecraft/thaumcraft/api/wands/WandCap.java
Executable file
122
src/minecraft/thaumcraft/api/wands/WandCap.java
Executable file
|
@ -0,0 +1,122 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
/**
|
||||
* This class is used to keep the material information for the various caps.
|
||||
* It is also used to generate the wand recipes ingame.
|
||||
* @author Azanor
|
||||
*
|
||||
*/
|
||||
public class WandCap {
|
||||
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* Cost to craft this wand. Combined with the rod cost.
|
||||
*/
|
||||
private int craftCost;
|
||||
|
||||
/**
|
||||
* the amount by which all aspect costs are multiplied
|
||||
*/
|
||||
float baseCostModifier;
|
||||
|
||||
/**
|
||||
* specifies a list of primal aspects that use the special discount figure instead of the normal discount.
|
||||
*/
|
||||
List<Aspect> specialCostModifierAspects;
|
||||
|
||||
/**
|
||||
* the amount by which the specified aspect costs are multiplied
|
||||
*/
|
||||
float specialCostModifier;
|
||||
|
||||
/**
|
||||
* The texture that will be used for the ingame wand cap
|
||||
*/
|
||||
ResourceLocation texture;
|
||||
|
||||
/**
|
||||
* the actual item that makes up this cap and will be used to generate the wand recipes
|
||||
*/
|
||||
ItemStack item;
|
||||
|
||||
public static LinkedHashMap<String,WandCap> caps = new LinkedHashMap<String,WandCap>();
|
||||
|
||||
public WandCap (String tag, float discount, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.baseCostModifier = discount;
|
||||
this.specialCostModifierAspects = null;
|
||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
caps.put(tag, this);
|
||||
}
|
||||
|
||||
public WandCap (String tag, float discount, List<Aspect> specialAspects, float discountSpecial, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.baseCostModifier = discount;
|
||||
this.specialCostModifierAspects = specialAspects;
|
||||
this.specialCostModifier = discountSpecial;
|
||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
caps.put(tag, this);
|
||||
}
|
||||
|
||||
public float getBaseCostModifier() {
|
||||
return baseCostModifier;
|
||||
}
|
||||
|
||||
public List<Aspect> getSpecialCostModifierAspects() {
|
||||
return specialCostModifierAspects;
|
||||
}
|
||||
|
||||
public float getSpecialCostModifier() {
|
||||
return specialCostModifier;
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(ResourceLocation texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getCraftCost() {
|
||||
return craftCost;
|
||||
}
|
||||
|
||||
public void setCraftCost(int craftCost) {
|
||||
this.craftCost = craftCost;
|
||||
}
|
||||
|
||||
// Some examples:
|
||||
// WandCap WAND_CAP_IRON = new WandCap("iron", 1.1f, Arrays.asList(Aspect.ORDER),1, new ItemStack(ConfigItems.itemWandCap,1,0),1);
|
||||
// WandCap WAND_CAP_GOLD = new WandCap("gold", 1f, new ItemStack(ConfigItems.itemWandCap,1,1),3);
|
||||
|
||||
}
|
151
src/minecraft/thaumcraft/api/wands/WandRod.java
Executable file
151
src/minecraft/thaumcraft/api/wands/WandRod.java
Executable file
|
@ -0,0 +1,151 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* This class is used to keep the material information for the various rods.
|
||||
* It is also used to generate the wand recipes ingame.
|
||||
*
|
||||
*/
|
||||
public class WandRod {
|
||||
|
||||
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* Cost to craft this wand. Combined with the rod cost.
|
||||
*/
|
||||
private int craftCost;
|
||||
|
||||
/**
|
||||
* The amount of vis that can be stored - this number is actually multiplied
|
||||
* by 100 for use by the wands internals
|
||||
*/
|
||||
int capacity;
|
||||
|
||||
/**
|
||||
* The texture that will be used for the ingame wand rod
|
||||
*/
|
||||
ResourceLocation texture;
|
||||
|
||||
/**
|
||||
* the actual item that makes up this rod and will be used to generate the wand recipes
|
||||
*/
|
||||
ItemStack item;
|
||||
|
||||
/**
|
||||
* A class that will be called whenever the wand onUpdate tick is run
|
||||
*/
|
||||
IWandRodOnUpdate onUpdate;
|
||||
|
||||
/**
|
||||
* Does the rod glow in the dark?
|
||||
*/
|
||||
boolean glow;
|
||||
|
||||
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = texture;
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate, ResourceLocation texture) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = texture;
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(ResourceLocation texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getCraftCost() {
|
||||
return craftCost;
|
||||
}
|
||||
|
||||
public void setCraftCost(int craftCost) {
|
||||
this.craftCost = craftCost;
|
||||
}
|
||||
|
||||
public IWandRodOnUpdate getOnUpdate() {
|
||||
return onUpdate;
|
||||
}
|
||||
|
||||
public void setOnUpdate(IWandRodOnUpdate onUpdate) {
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public boolean isGlowing() {
|
||||
return glow;
|
||||
}
|
||||
|
||||
public void setGlowing(boolean hasGlow) {
|
||||
this.glow = hasGlow;
|
||||
}
|
||||
|
||||
// Some examples:
|
||||
// WandRod WAND_ROD_WOOD = new WandRod("wood",25,new ItemStack(Item.stick),1);
|
||||
// WandRod WAND_ROD_BLAZE = new WandRod("blaze",100,new ItemStack(Item.blazeRod),7,new WandRodBlazeOnUpdate());
|
||||
}
|
71
src/minecraft/thaumcraft/api/wands/WandTriggerRegistry.java
Executable file
71
src/minecraft/thaumcraft/api/wands/WandTriggerRegistry.java
Executable file
|
@ -0,0 +1,71 @@
|
|||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class serves a similar function to IWandable in that it allows wands to interact
|
||||
* with object in the world. In this case it is most useful for adding interaction with non-mod
|
||||
* blocks where you can't control what happens in their code.
|
||||
* Example where it is used is in crafting the thaumonomicon from a bookshelf and the
|
||||
* crucible from a cauldron
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
*/
|
||||
public class WandTriggerRegistry {
|
||||
|
||||
/**
|
||||
* Registers an action to perform when a casting wand right clicks on a specific block.
|
||||
* A manager class needs to be created that implements IWandTriggerManager.
|
||||
* @param manager
|
||||
* @param event a logical number that you can use to differentiate different events or actions
|
||||
* @param blockid
|
||||
* @param meta send -1 as a wildcard value for all possible meta values
|
||||
*/
|
||||
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, int blockid, int meta) {
|
||||
triggers.put(Arrays.asList(blockid,meta),
|
||||
Arrays.asList(manager,event));
|
||||
|
||||
}
|
||||
|
||||
private static HashMap<List<Integer>,List> triggers = new HashMap<List<Integer>,List>();
|
||||
|
||||
public static boolean hasTrigger(int blockid, int meta) {
|
||||
if (triggers.containsKey(Arrays.asList(blockid,meta)) ||
|
||||
triggers.containsKey(Arrays.asList(blockid,-1))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called by the onItemUseFirst function in wands.
|
||||
* Parameters and return value functions like you would expect for that function.
|
||||
* @param world
|
||||
* @param wand
|
||||
* @param player
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param side
|
||||
* @param blockid
|
||||
* @param meta
|
||||
* @return
|
||||
*/
|
||||
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
||||
int x, int y, int z, int side, int blockid, int meta) {
|
||||
if (!triggers.containsKey(Arrays.asList(blockid,meta))) return false;
|
||||
|
||||
List l = triggers.get(Arrays.asList(blockid,meta));
|
||||
if (l==null) l = triggers.get(Arrays.asList(blockid,-1));
|
||||
|
||||
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
|
||||
int event = (Integer) l.get(1);
|
||||
return manager.performTrigger(world, wand, player, x, y, z, side, event);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue