mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 00:37:57 +00:00
Some intital work in displaying recipes on the Lexicon.
This commit is contained in:
1 parent
fc3a6b3299
commit
9bfd8ff93f
6 files changed
+94
-3
No files matched your search
@@ -14,6 +14,8 @@ package vazkii.botania.api;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
|
||||
@@ -49,4 +51,20 @@ public final class BotaniaAPI {
|
||||
allEntries.add(entry);
|
||||
category.entries.add(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last recipe to have been added to the recipe list.
|
||||
*/
|
||||
public static IRecipe getLatestAddedRecipe() {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last x recipes added to the recipe list.
|
||||
*/
|
||||
public static List<IRecipe> getLatestAddedRecipes(int x) {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
return list.subList(list.size() - 1 - x, list.size() - 1);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import vazkii.botania.api.page.LexiconPage;
|
||||
import vazkii.botania.api.page.PageDummy;
|
||||
|
||||
@@ -23,11 +26,23 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@Override
|
||||
public LexiconPage imagePage(String key, String resource) {
|
||||
return dummyPage(resource);
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage recipesPage(String key, List<IRecipe> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage recipePage(String key, IRecipe recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
|
||||
private LexiconPage dummyPage(String key) {
|
||||
return new PageDummy(key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import vazkii.botania.api.page.LexiconPage;
|
||||
|
||||
/**
|
||||
@@ -26,4 +29,8 @@ public interface IInternalMethodHandler {
|
||||
|
||||
public LexiconPage imagePage(String key, String resource);
|
||||
|
||||
public LexiconPage recipesPage(String key, List<IRecipe> recipes);
|
||||
|
||||
public LexiconPage recipePage(String key, IRecipe recipe);
|
||||
|
||||
}
|
||||
@@ -11,8 +11,12 @@
|
||||
*/
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
import vazkii.botania.api.page.LexiconPage;
|
||||
import vazkii.botania.common.lexicon.page.PageCraftingRecipes;
|
||||
import vazkii.botania.common.lexicon.page.PageImage;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
|
||||
@@ -28,4 +32,14 @@ public class InternalMethodHandler implements IInternalMethodHandler {
|
||||
return new PageImage(key, resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage recipesPage(String key, List<IRecipe> recipes) {
|
||||
return new PageCraftingRecipes(key, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage recipePage(String key, IRecipe recipe) {
|
||||
return new PageCraftingRecipes(key, recipe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 19, 2014, 4:58:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.lexicon.page;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.page.LexiconPage;
|
||||
|
||||
public class PageCraftingRecipes extends LexiconPage {
|
||||
|
||||
List<IRecipe> recipes;
|
||||
|
||||
public PageCraftingRecipes(String unlocalizedName, List<IRecipe> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public PageCraftingRecipes(String unlocalizedName, IRecipe recipe) {
|
||||
this(unlocalizedName, Arrays.asList(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public final class LibOreDict {
|
||||
|
||||
public static final String[] FLOWER = new String[] {
|
||||
|
||||
Reference in new issue
Block a user