Some recipes displaying in lexicon again

This commit is contained in:
Vincent Lee committed 2017-07-09 12:18:20 -05:00
1 parent adfa6c92c0
commit 833324e150
6 files changed
+65 -54

No files matched your search

@@ -433,9 +433,12 @@ public class GuiLexicon extends GuiScreen {
mc.displayGuiScreen(new GuiBotaniaConfig(this));
break;
case -2 :
// todo 1.12 switch to botania tab
if(mc.player != null)
this.mc.displayGuiScreen(new GuiScreenAdvancements(this.mc.player.connection.getAdvancementManager()));
if(mc.player != null) {
GuiScreenAdvancements gui = new GuiScreenAdvancements(this.mc.player.connection.getAdvancementManager());
this.mc.displayGuiScreen(gui);
ResourceLocation tab = new ResourceLocation(LibMisc.MOD_ID, "main/root");
gui.setSelectedTab(mc.player.connection.getAdvancementManager().getAdvancementList().getAdvancement(tab));
}
break;
case -3 :
mc.displayGuiScreen(new GuiLexiconChallengesList());
@@ -37,7 +37,7 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
drawTexturedModalRect(x, y, k == 2 ? 109 : 98, 191, 11, 11);
List<String> tooltip = new ArrayList<>();
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.achievements"));
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.advancements"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
@@ -65,6 +65,7 @@ import vazkii.botania.common.core.handler.SheddingHandler;
import vazkii.botania.common.core.loot.LootHandler;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.crafting.ModBrewRecipes;
import vazkii.botania.common.crafting.ModCraftingRecipes;
import vazkii.botania.common.crafting.ModElvenTradeRecipes;
import vazkii.botania.common.crafting.ModManaAlchemyRecipes;
import vazkii.botania.common.crafting.ModManaConjurationRecipes;
@@ -147,6 +148,7 @@ public class Botania {
ModManaInfusionRecipes.init();
ModElvenTradeRecipes.init();
ModBrewRecipes.init();
ModCraftingRecipes.init();
LexiconData.init();
NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler());
@@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.registries.IForgeRegistry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.crafting.recipe.AesirRingRecipe;
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
@@ -44,9 +45,9 @@ import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibOreDict;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Mod.EventBusSubscriber
public final class ModCraftingRecipes {
@@ -64,7 +65,7 @@ public final class ModCraftingRecipes {
public static ResourceLocation recipePool;
public static ResourceLocation recipePoolDiluted;
public static ResourceLocation recipePoolFabulous;
public static List<ResourceLocation> recipesRuneAltar;
public static ResourceLocation recipeRuneAltar;
public static ResourceLocation recipeLensVelocity;
public static ResourceLocation recipeLensPotency;
public static ResourceLocation recipeLensResistance;
@@ -449,28 +450,52 @@ public final class ModCraftingRecipes {
addShapelessRecipe(new ItemStack(ModItems.elementiumHelmRevealing), new ItemStack(ModItems.elementiumHelm), goggles);
}
*/
recipeLexicon = path("lexicon");
}
public static void init() {
// Can't do this in RegistryEvent.Register event handler since it seems JSON recipes aren't loaded yet
recipesPetals = allOfGroup("petal");
recipePestleAndMortar = path("pestleandmortar");
recipesDyes = allOfGroup("dye");
recipeFertilizerPowder = gogPath("fertilizer_powder");
recipeFerilizerDye = path("fertilizer_dye");
recipesPetalsDouble = allOfGroup("petal_double");
recipesPetalBlocks = allOfGroup("petalblock");
recipesReversePetalBlocks = allOfGroup("petal_block_deconstruct");
recipesApothecary = allOfGroup("petal_apothecary");
recipeLexicon = path("lexicon");
// todo 1.12 wands
recipeLivingwoodTwig = path("manaresource_3");
recipeRuneAltar = path("runealtar");
recipeTerraPlate = path("terraplate");
recipeFlowerBag = path("flowerbag");
}
private static ResourceLocation gogPath(String path) {
if(Botania.gardenOfGlassLoaded) {
return new ResourceLocation(LibMisc.MOD_ID, "garden_of_glass/" + path);
} else {
return path(path);
}
}
private static ResourceLocation path(String path) {
return new ResourceLocation(LibMisc.MOD_ID, path);
}
private static List<ResourceLocation> allOfGroup(String group) {
String jsonGroup = LibMisc.MOD_ID + ":" + group;
List<ResourceLocation> result = new ArrayList<>();
for (Map.Entry<ResourceLocation, IRecipe> e : ForgeRegistries.RECIPES.getEntries()) {
if (jsonGroup.equals(e.getValue().getGroup())) {
result.add(e.getKey());
}
}
return result;
return ForgeRegistries.RECIPES.getEntries().stream()
.filter(e -> jsonGroup.equals(e.getValue().getGroup()))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}
}
@@ -344,9 +344,9 @@ public final class LexiconData {
lexicon.setPriority().setLexiconPages(new PageText("0"), new PageText("3"),
new PageCraftingRecipe("1", ModCraftingRecipes.recipeLexicon), new PageText("2"));
wand = new BasicLexiconEntry(LibLexicon.BASICS_WAND, categoryBasics);
/*wand = new BasicLexiconEntry(LibLexicon.BASICS_WAND, categoryBasics);
wand.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"),
new PageCraftingRecipe("3", ModCraftingRecipes.recipesTwigWand));
new PageCraftingRecipe("3", ModCraftingRecipes.recipesTwigWand));*/
pureDaisy = new BasicLexiconEntry(LibLexicon.BASICS_PURE_DAISY, categoryBasics);
pureDaisy.setPriority()
@@ -361,7 +361,7 @@ public final class LexiconData {
runicAltar = new BasicLexiconEntry(LibLexicon.BASICS_RUNE_ALTAR, categoryBasics);
runicAltar.setPriority().setLexiconPages(new PageText("21"), new PageText("0"), new PageText("1"),
new PageCraftingRecipe("2", ModCraftingRecipes.recipesRuneAltar), new PageText("3"), new PageText("20"),
new PageCraftingRecipe("2", ModCraftingRecipes.recipeRuneAltar), new PageText("3"), new PageText("20"),
new PageText("22"), new PageRuneRecipe("4", ModRuneRecipes.recipeWaterRune),
new PageRuneRecipe("5", ModRuneRecipes.recipesEarthRune),
new PageRuneRecipe("6", ModRuneRecipes.recipesAirRune),
@@ -392,6 +392,8 @@ public final class LexiconData {
flowerBag.setLexiconPages(new PageText("0"), new PageText("2"),
new PageCraftingRecipe("1", ModCraftingRecipes.recipeFlowerBag));
if(true) return;
if (Botania.gardenOfGlassLoaded) {
gardenOfGlass = new BasicLexiconEntry(LibLexicon.BASICS_GARDEN_OF_GLASS, categoryBasics);
gardenOfGlass.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"),
@@ -128,60 +128,39 @@ public class PageCraftingRecipe extends PageRecipe {
@SideOnly(Side.CLIENT)
public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) {
if(recipe instanceof ShapedRecipes) {
ShapedRecipes shaped = (ShapedRecipes)recipe;
if(recipe instanceof ShapedRecipes || recipe instanceof ShapedOreRecipe) {
oreDictRecipe = recipe instanceof ShapedOreRecipe;
for(int y = 0; y < shaped.recipeHeight; y++)
for(int x = 0; x < shaped.recipeWidth; x++)
renderItemAtGridPos(gui, 1 + x, 1 + y, shaped.recipeItems.get(y * shaped.recipeWidth + x).getMatchingStacks()[0], true);
} else if(recipe instanceof ShapedOreRecipe) {
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
int width = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
int height = ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
int width = oreDictRecipe
? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "width")
: ((ShapedRecipes) recipe).getWidth();
int height = oreDictRecipe
? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "height")
: ((ShapedRecipes) recipe).getHeight();
for(int y = 0; y < height; y++)
for(int x = 0; x < width; x++) {
Ingredient input = shaped.getIngredients().get(y * width + x);
Ingredient input = recipe.getIngredients().get(y * width + x);
if(input != Ingredient.EMPTY)
renderItemAtGridPos(gui, 1 + x, 1 + y, input.getMatchingStacks()[0], true);
}
oreDictRecipe = true;
} else if(recipe instanceof ShapelessRecipes) {
ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
drawGrid : {
for(int y = 0; y < 3; y++)
for(int x = 0; x < 3; x++) {
int index = y * 3 + x;
if(index >= shapeless.recipeItems.size())
break drawGrid;
renderItemAtGridPos(gui, 1 + x, 1 + y, shapeless.recipeItems.get(index).getMatchingStacks()[0], true);
}
}
} else if(recipe instanceof ShapelessRecipes || recipe instanceof ShapelessOreRecipe) {
shapelessRecipe = true;
} else if(recipe instanceof ShapelessOreRecipe) {
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
oreDictRecipe = recipe instanceof ShapelessOreRecipe;
drawGrid : {
for(int y = 0; y < 3; y++)
for(int x = 0; x < 3; x++) {
int index = y * 3 + x;
if(index >= shapeless.getIngredients().size())
if(index >= recipe.getIngredients().size())
break drawGrid;
Ingredient input = shapeless.getIngredients().get(index);
Ingredient input = recipe.getIngredients().get(index);
if(input != Ingredient.EMPTY)
renderItemAtGridPos(gui, 1 + x, 1 + y, input.getMatchingStacks()[0], true);
}
}
shapelessRecipe = true;
oreDictRecipe = true;
}
renderItemAtGridPos(gui, 2, 0, recipe.getRecipeOutput(), false);