Skip to content

Crafttweaker support Research

mcenderdragon edited this page Oct 6, 2022 · 9 revisions

Since 32.1.x / 1.17 (maybe I will do a backport to 1.16 then also there)


mods.futurepack.research.getResearch("name") This gets you a registered research
@param name (String) - The research name, eg futurepack:techtable .
@return The Research Object.
mods.futurepack.research.createResearch("name", x, y, icon, page) Creates a new research
@param name (String) - The research name, eg "futurepack:techtable".
@param x (int) - the X position of the research on the page.
@param y (int) - the Y positiob of the research on the page.
@param icon (IItemStack) - the ItemStack used as an icon to display.
@param page (ResearchPage) - The Page this research is on the in the e-Scanner.
@return The Research Object
mods.futurepack.research.getOrCreateResearchPage("name") Gets or creates a new Researchpage object
@param name (String) - The research page name, eg "futurepack:story".
@return The ResearchPage Object

Research Object

setParents(String[] p)
public void setGrandparents(String[] p) //advancements
public void setEnabled(IItemStack[] it) //the items this research unlocks
public void setNeeded(IIngredient[] it) //the items needed to research this in the researcher
public String[] getParents() //returns the needed researches to unlock this
public String[] getGrandparents() //returns the needed advancements to unlock this
public String getTranslationKey() 
public String getName()
public int getX()
public int getY()
public IItemStack[] getEnables() //returns the items this research unlocks

public int getExpLvl() //the amount of XP needed for this research
public int getSupport() //amount of SP needed for this research
public int getNeonenergie()//amount of NE needed for this research
public int getTime()//amount of time in ticks needed for this research
public int getTecLevel()//the tec level this research is 
public void setExpLvl(int xp)
public void setSupport(int sp)
public void setNeonenergie(int ne)
public void setTime(int ticks)
public void setTecLevel(int lvl)

public String getBackground()//the baground icon
public boolean isVisible(boolean hasRes, boolean canRes)
public String getDomain()
public String toString()
public String toFullString()
public void setRewards(IItemStack[] it) //set teh reward players will get when researching this
public ItemStack[] getRewards()//get teh reward players will get when researching this
public String[] getAspects()
public void setAspects(String[] aspects) //accepted aspects are: "geologie","chemie","tierhaltung","logistik","metallurgie","biologie","morphologie","neonenergie","energieverbindung","thermodynamic","maschinenbau","hydraulic"

ResearchPage Object

public void setIcon(ItemStack it) //sets the icon displayed for this page
public void setHidden(boolean v) //weather or not this page should be hidden when no researchers are unlocked
public boolean isHidden() //returns if this page is hidden
public String getTranslationKey() 
public String getLocalizedName()
public String getBackground()//the resoarceLocation to the background image
public ResearchWrapper[] getEntries()//all researches on this page
public int getWidth()
public int getHeight()
public String toString()

Example

mods.futurepack.crushing.add(<item:minecraft:beef>, <item:minecraft:diamond>);

//for mroe info see https://github.com/mcenderdragon/Futurepack-API/wiki/Crafttweaker-support-Research

var page = mods.futurepack.research.getOrCreateResearchPage("page2");
page.setIcon(<item:minecraft:diamond>);


var res = mods.futurepack.research.createResearch("test:test_a", 1, 1, <item:minecraft:nether_star>, page);

var resB = mods.futurepack.research.createResearch("test:test_b", 1, 3, <item:minecraft:redstone>, page);

resB.setParents([res.getName()]);

res.setEnabled([<item:minecraft:diamond>, <item:minecraft:diamond_sword>]);
res.setNeeded([<item:minecraft:redstone>, <item:minecraft:stick>]);

res.setTime(1000);
res.setNeonenergie(400);

res.setGrandparents(["futurepack:tyros"]);

Result: