mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-12 00:07:57 +00:00
Return of Hidden Research and Item in Entries
These changes were taken from the old repo. I have no idea if those actually work yet if the mod even builds with them :) **Changes:** -Botania Lexicon Entries now take an ItemStack to display the ItemStack on the side when looking into the Lexica -Hidden Research with triggers for Items, Entitities and Aspects
This commit is contained in:
1 parent
3316f0b90d
commit
6fd85cbd10
3 files changed
+55
-35
No files matched your search
@@ -7,6 +7,8 @@ import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.init.Blocks;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
@@ -359,7 +361,7 @@ public class Lexicon {
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addEntry(String entry, String catagory) {
|
||||
public static void addEntry(String entry, String catagory, IItemStack stack) {
|
||||
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(catagory);
|
||||
if(lexiconCategory==null)
|
||||
{
|
||||
@@ -367,6 +369,7 @@ public class Lexicon {
|
||||
return;
|
||||
}
|
||||
LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCategory);
|
||||
lexiconEntry.setIcon(toStack(stack));
|
||||
MineTweakerAPI.apply(new AddEntry(lexiconEntry));
|
||||
}
|
||||
@ZenMethod
|
||||
|
||||
@@ -4,6 +4,7 @@ import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import modtweaker2.helpers.InputHelper;
|
||||
import modtweaker2.mods.thaumcraft.ThaumcraftHelper;
|
||||
import modtweaker2.mods.thaumcraft.research.AddPage;
|
||||
import modtweaker2.mods.thaumcraft.research.AddPrereq;
|
||||
@@ -77,14 +78,20 @@ public class Research {
|
||||
@ZenMethod
|
||||
public static void addResearch(String key, String tab, @Optional String aspects, int x, int y, int difficulty, String domain, String path) {
|
||||
|
||||
MineTweakerAPI.apply(new AddResearch(new ResearchItem(key, tab, ThaumcraftHelper.parseAspects(aspects), x, y, difficulty, new ResourceLocation(domain, path))));
|
||||
MineTweakerAPI.apply(new AddResearch(new ResearchItem(key, tab, ThaumcraftHelper.parseAspects(aspects), x, y, difficulty, new ResourceLocation(domain, path)), null, null));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addResearch(String key, String tab, @Optional String aspects, int x, int y, int difficulty, IItemStack item) {
|
||||
|
||||
MineTweakerAPI.apply(new AddResearch(new ResearchItem(key, tab, ThaumcraftHelper.parseAspects(aspects), x, y, difficulty, toStack(item))));
|
||||
MineTweakerAPI.apply(new AddResearch(new ResearchItem(key, tab, ThaumcraftHelper.parseAspects(aspects), x, y, difficulty, toStack(item)),null, null));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addResearch(String key, String tab, @Optional String aspects, int x, int y, int difficulty, IItemStack item, IItemStack[] triggers, String[] entTriggers) {
|
||||
|
||||
MineTweakerAPI.apply(new AddResearch(new ResearchItem(key, tab, ThaumcraftHelper.parseAspects(aspects), x, y, difficulty, toStack(item)), InputHelper.toStacks(triggers), entTriggers));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addPage(String key, String unlocalized) {
|
||||
|
||||
@@ -5,44 +5,54 @@ import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
|
||||
public class AddResearch implements IUndoableAction {
|
||||
String key;
|
||||
String tab;
|
||||
ResearchItem research;
|
||||
String key;
|
||||
String tab;
|
||||
ResearchItem research;
|
||||
ItemStack[] itemTriggers;
|
||||
String[] entityTriggers;
|
||||
|
||||
public AddResearch(ResearchItem res) {
|
||||
research = res;
|
||||
tab = research.category;
|
||||
key = research.key;
|
||||
}
|
||||
public AddResearch(ResearchItem res, ItemStack[] triggers, String[] entTriggers) {
|
||||
research = res;
|
||||
tab = research.category;
|
||||
key = research.key;
|
||||
itemTriggers = triggers;
|
||||
entityTriggers = entTriggers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
research.registerResearchItem();
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
if (itemTriggers != null) {
|
||||
research = research.setItemTriggers(itemTriggers);
|
||||
}
|
||||
if (entityTriggers != null) {
|
||||
research = research.setEntityTriggers(entityTriggers);
|
||||
}
|
||||
research.registerResearchItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Registering Research: " + key;
|
||||
}
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Registering Research: " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return tab != null && key != null;
|
||||
}
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return tab != null && key != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
ResearchCategories.researchCategories.get(tab).research.remove(key);
|
||||
}
|
||||
@Override
|
||||
public void undo() {
|
||||
ResearchCategories.researchCategories.get(tab).research.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Research: " + key;
|
||||
}
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Research: " + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user