some more documentation work

This commit is contained in:
Ellpeck 2018-10-22 00:14:52 +02:00
parent 90c8cd19d4
commit 20be145768
24 changed files with 211 additions and 49 deletions

View file

@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@ -244,7 +245,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
if (!syncing) {
if (this.currentRecipe != null) {
compound.setTag("recipe_input", this.currentRecipe.input.serializeNBT());
compound.setString("recipe", this.currentRecipe.name.toString());
compound.setInteger("timer", this.timer);
}
}
@ -259,7 +260,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
if (!syncing) {
if (compound.hasKey("recipe_input")) {
this.currentRecipe = AltarRecipe.forInput(new ItemStack(compound.getCompoundTag("recipe_input")));
this.currentRecipe = AltarRecipe.RECIPES.get(new ResourceLocation(compound.getString("recipe")));
this.timer = compound.getInteger("timer");
}
}

View file

@ -1,10 +1,12 @@
package de.ellpeck.naturesaura.compat;
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
public final class Compat {
public static boolean patchouli;
public static boolean baubles;
public static void init() {
@ -12,5 +14,10 @@ public final class Compat {
if (baubles) {
MinecraftForge.EVENT_BUS.register(new BaublesCompat());
}
patchouli = Loader.isModLoaded("patchouli");
if (patchouli) {
PatchouliCompat.init();
}
}
}

View file

@ -1,11 +1,11 @@
package de.ellpeck.naturesaura.jei;
package de.ellpeck.naturesaura.compat.jei;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.jei.altar.AltarCategory;
import de.ellpeck.naturesaura.jei.altar.AltarWrapper;
import de.ellpeck.naturesaura.jei.treeritual.TreeRitualCategory;
import de.ellpeck.naturesaura.jei.treeritual.TreeRitualWrapper;
import de.ellpeck.naturesaura.compat.jei.altar.AltarCategory;
import de.ellpeck.naturesaura.compat.jei.altar.AltarWrapper;
import de.ellpeck.naturesaura.compat.jei.treeritual.TreeRitualCategory;
import de.ellpeck.naturesaura.compat.jei.treeritual.TreeRitualWrapper;
import de.ellpeck.naturesaura.recipes.AltarRecipe;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.IGuiHelper;
@ -35,8 +35,8 @@ public class JEINaturesAuraPlugin implements IModPlugin {
registry.handleRecipes(TreeRitualRecipe.class, TreeRitualWrapper::new, TREE_RITUAL);
registry.handleRecipes(AltarRecipe.class, AltarWrapper::new, ALTAR);
registry.addRecipes(TreeRitualRecipe.RECIPES, TREE_RITUAL);
registry.addRecipes(AltarRecipe.RECIPES, ALTAR);
registry.addRecipes(TreeRitualRecipe.RECIPES.values(), TREE_RITUAL);
registry.addRecipes(AltarRecipe.RECIPES.values(), ALTAR);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.GOLD_POWDER), TREE_RITUAL);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL);

View file

@ -1,9 +1,9 @@
package de.ellpeck.naturesaura.jei.altar;
package de.ellpeck.naturesaura.compat.jei.altar;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.jei.JEINaturesAuraPlugin;
import de.ellpeck.naturesaura.compat.jei.JEINaturesAuraPlugin;
import de.ellpeck.naturesaura.recipes.AltarRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@ -22,7 +22,7 @@ public class AltarCategory implements IRecipeCategory<AltarWrapper> {
private final ItemStack altar = new ItemStack(ModBlocks.NATURE_ALTAR);
public AltarCategory(IGuiHelper helper) {
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/altar.png"), 0, 0, 78, 57);
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/altar.png"), 0, 0, 78, 57);
}
@Override

View file

@ -1,4 +1,4 @@
package de.ellpeck.naturesaura.jei.altar;
package de.ellpeck.naturesaura.compat.jei.altar;
import de.ellpeck.naturesaura.recipes.AltarRecipe;
import mezz.jei.api.ingredients.IIngredients;

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.jei.treeritual;
package de.ellpeck.naturesaura.compat.jei.treeritual;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.jei.JEINaturesAuraPlugin;
import de.ellpeck.naturesaura.compat.jei.JEINaturesAuraPlugin;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
@ -17,7 +17,7 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualWrapper> {
private final IDrawable background;
public TreeRitualCategory(IGuiHelper helper) {
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/tree_ritual.png"), 0, 0, 146, 86);
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/tree_ritual.png"), 0, 0, 146, 86);
}
@Override

View file

@ -1,4 +1,4 @@
package de.ellpeck.naturesaura.jei.treeritual;
package de.ellpeck.naturesaura.compat.jei.treeritual;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.ingredients.IIngredients;

View file

@ -0,0 +1,47 @@
package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.recipes.AltarRecipe;
import net.minecraft.client.gui.Gui;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.client.book.BookEntry;
import vazkii.patchouli.client.book.gui.GuiBook;
import vazkii.patchouli.client.book.page.abstr.PageDoubleRecipe;
public class PageAltar extends PageDoubleRecipe<AltarRecipe> {
private static final ItemStack ALTAR = new ItemStack(ModBlocks.NATURE_ALTAR);
@Override
protected void drawRecipe(AltarRecipe recipe, int recipeX, int recipeY, int mouseX, int mouseY, boolean second) {
this.mc.getTextureManager().bindTexture(PatchouliCompat.GUI_ELEMENTS);
Gui.drawModalRectWithCustomSizedTexture(recipeX + 12, recipeY, 0, 0, 75, 44, 256, 256);
this.parent.drawCenteredStringNoShadow(this.getTitle(second), GuiBook.PAGE_WIDTH / 2, recipeY - 10, 0x333333);
this.renderItem(recipeX + 12 + 30, recipeY + 13, mouseX, mouseY, ALTAR);
this.renderItem(recipeX + 12 + 4, recipeY + 13, mouseX, mouseY, recipe.input);
this.renderItem(recipeX + 12 + 56, recipeY + 13, mouseX, mouseY, recipe.output);
}
@Override
protected AltarRecipe loadRecipe(BookEntry entry, String loc) {
if (loc != null) {
AltarRecipe recipe = AltarRecipe.RECIPES.get(new ResourceLocation(loc));
entry.addRelevantStack(recipe.output, this.pageNum);
return recipe;
}
return null;
}
@Override
protected ItemStack getRecipeOutput(AltarRecipe recipe) {
return recipe.output;
}
@Override
protected int getRecipeHeight() {
return 60;
}
}

View file

@ -0,0 +1,49 @@
package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import net.minecraft.client.gui.Gui;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.client.book.BookEntry;
import vazkii.patchouli.client.book.gui.GuiBook;
import vazkii.patchouli.client.book.page.abstr.PageDoubleRecipe;
public class PageTreeRitual extends PageDoubleRecipe<TreeRitualRecipe> {
@Override
protected void drawRecipe(TreeRitualRecipe recipe, int recipeX, int recipeY, int mouseX, int mouseY, boolean second) {
this.mc.getTextureManager().bindTexture(PatchouliCompat.GUI_ELEMENTS);
Gui.drawModalRectWithCustomSizedTexture(recipeX - 13, recipeY, 0, 44, 122, 88, 256, 256);
this.parent.drawCenteredStringNoShadow(this.getTitle(second), GuiBook.PAGE_WIDTH / 2, recipeY - 10, 0x333333);
int[][] positions = new int[][]{{38, 4}, {38, 68}, {6, 36}, {70, 36}, {13, 11}, {63, 61}, {63, 11}, {13, 61}};
for (int i = 0; i < recipe.items.length; i++) {
ItemStack input = recipe.items[i];
this.renderItem(recipeX - 13 + positions[i][0], recipeY + positions[i][1], mouseX, mouseY, input);
}
this.renderItem(recipeX - 13 + 38, recipeY + 36, mouseX, mouseY, recipe.saplingType);
this.renderItem(recipeX - 13 + 102, recipeY + 36, mouseX, mouseY, recipe.result);
}
@Override
protected TreeRitualRecipe loadRecipe(BookEntry entry, String loc) {
if (loc != null) {
TreeRitualRecipe recipe = TreeRitualRecipe.RECIPES.get(new ResourceLocation(loc));
entry.addRelevantStack(recipe.result, this.pageNum);
return recipe;
}
return null;
}
@Override
protected ItemStack getRecipeOutput(TreeRitualRecipe recipe) {
return recipe.result;
}
@Override
protected int getRecipeHeight() {
return 105;
}
}

View file

@ -0,0 +1,20 @@
package de.ellpeck.naturesaura.compat.patchouli;
import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.client.book.BookPage;
import vazkii.patchouli.client.book.BookRegistry;
public final class PatchouliCompat {
public static final ResourceLocation GUI_ELEMENTS = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/patchouli/elements.png");
public static void init() {
addPatchouliPage("altar", PageAltar.class);
addPatchouliPage("tree_ritual", PageTreeRitual.class);
}
private static void addPatchouliPage(String name, Class<? extends BookPage> page) {
BookRegistry.INSTANCE.pageTypes.put(NaturesAura.MOD_ID + ":" + name, page);
}
}

View file

@ -37,7 +37,7 @@ public class TerrainGenEvents {
IBlockState sapling = world.getBlockState(pos);
ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling);
if (!saplingStack.isEmpty()) {
for (TreeRitualRecipe recipe : TreeRitualRecipe.RECIPES) {
for (TreeRitualRecipe recipe : TreeRitualRecipe.RECIPES.values()) {
if (recipe.matchesItems(saplingStack, usableItems)) {
Map<BlockPos, ItemStack> actuallyInvolved = new HashMap<>();
List<ItemStack> stillRequired = new ArrayList<>(Arrays.asList(recipe.items));

View file

@ -1,20 +1,23 @@
package de.ellpeck.naturesaura.recipes;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
public class AltarRecipe {
public static final List<AltarRecipe> RECIPES = new ArrayList<>();
public static final Map<ResourceLocation, AltarRecipe> RECIPES = new HashMap<>();
public final ResourceLocation name;
public final ItemStack input;
public final ItemStack output;
public final int aura;
public final int time;
public AltarRecipe(ItemStack input, ItemStack output, int aura, int time) {
public AltarRecipe(ResourceLocation name, ItemStack input, ItemStack output, int aura, int time) {
this.name = name;
this.input = input;
this.output = output;
this.aura = aura;
@ -22,7 +25,7 @@ public class AltarRecipe {
}
public static AltarRecipe forInput(ItemStack input) {
for (AltarRecipe recipe : RECIPES) {
for (AltarRecipe recipe : RECIPES.values()) {
if (recipe.input.isItemEqual(input)) {
return recipe;
}
@ -31,7 +34,7 @@ public class AltarRecipe {
}
public AltarRecipe add() {
RECIPES.add(this);
RECIPES.put(this.name, this);
return this;
}
}

View file

@ -1,26 +1,31 @@
package de.ellpeck.naturesaura.recipes;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public final class ModRecipes {
public static void init() {
new TreeRitualRecipe(new ItemStack(Blocks.SAPLING), new ItemStack(ModItems.EYE), 250,
new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "eye"),
new ItemStack(Blocks.SAPLING), new ItemStack(ModItems.EYE), 250,
new ItemStack(Items.SPIDER_EYE),
new ItemStack(Items.GOLD_INGOT),
new ItemStack(ModItems.GOLD_LEAF),
new ItemStack(ModItems.GOLD_LEAF)).add();
new TreeRitualRecipe(new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.NATURE_ALTAR), 500,
new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "nature_altar"),
new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.NATURE_ALTAR), 500,
new ItemStack(Blocks.STONE),
new ItemStack(Blocks.STONE),
new ItemStack(Blocks.STONE),
new ItemStack(ModItems.GOLD_LEAF),
new ItemStack(Items.DIAMOND)).add();
new TreeRitualRecipe(new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.ANCIENT_SAPLING), 200,
new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "ancient_sapling"),
new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.ANCIENT_SAPLING), 200,
new ItemStack(Blocks.SAPLING),
new ItemStack(Blocks.YELLOW_FLOWER),
new ItemStack(Blocks.RED_FLOWER),
@ -28,7 +33,9 @@ public final class ModRecipes {
new ItemStack(Items.REEDS),
new ItemStack(ModItems.GOLD_LEAF)).add();
new AltarRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(ModItems.INFUSED_IRON), 300, 80).add();
new AltarRecipe(new ItemStack(Blocks.STONE), new ItemStack(ModBlocks.INFUSED_STONE), 150, 40).add();
new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "infused_iron"),
new ItemStack(Items.IRON_INGOT), new ItemStack(ModItems.INFUSED_IRON), 300, 80).add();
new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "infused_stone"),
new ItemStack(Blocks.STONE), new ItemStack(ModBlocks.INFUSED_STONE), 150, 40).add();
}
}

View file

@ -2,20 +2,24 @@ package de.ellpeck.naturesaura.recipes;
import de.ellpeck.naturesaura.Helper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TreeRitualRecipe {
public static final List<TreeRitualRecipe> RECIPES = new ArrayList<>();
public static final Map<ResourceLocation, TreeRitualRecipe> RECIPES = new HashMap<>();
public final ResourceLocation name;
public final ItemStack saplingType;
public final ItemStack[] items;
public final ItemStack result;
public final int time;
public TreeRitualRecipe(ItemStack saplingType, ItemStack result, int time, ItemStack... items) {
public TreeRitualRecipe(ResourceLocation name, ItemStack saplingType, ItemStack result, int time, ItemStack... items) {
this.name = name;
this.saplingType = saplingType;
this.items = items;
this.result = result;
@ -36,7 +40,7 @@ public class TreeRitualRecipe {
}
public TreeRitualRecipe add() {
RECIPES.add(this);
RECIPES.put(this.name, this);
return this;
}
}

View file

@ -24,7 +24,7 @@ item.naturesaura.infused_iron_hoe.name=Botanist's Hoe
item.naturesaura.ancient_stick.name=Ancient Wood Rod
item.naturesaura.aura_cache.name=Aura Cache
container.naturesaura.tree_ritual.name=Tree Infusion
container.naturesaura.altar.name=Natural Altar
container.naturesaura.tree_ritual.name=Ritual of the Forest
container.naturesaura.altar.name=Natural Altar Infusion
info.naturesaura.aura_in_area=Aura Around

View file

@ -2,5 +2,5 @@
"name": "Collecting Aura",
"description": "To be able to make use of the $(thing)Aura$() in the world, one must first find a way to handle it reasonably. Converting it into a storable form $(italics)(no, not liquids)$() might prove somewhat difficult, but this category will provide guidance.",
"icon": "naturesaura:eye",
"sortnum": 5
"sortnum": 10
}

View file

@ -2,5 +2,5 @@
"name": "Natural Practices",
"description": "Related to $(thing)Aura$(), but not necessarily to its collection and storage, can be other practices that might prove beneficial in the long run. This category provides information on what practices exist and how to execute them.",
"icon": "naturesaura:gold_powder",
"sortnum": 15
"sortnum": 5
}

View file

@ -2,5 +2,5 @@
"name": "Harnessing Aura",
"description": "When collecting $(thing)Aura$() from the world, an instinctive question for any human to ask would be $(italic)\"How can one make use of this?\"$() This category houses entries that will explain just that.",
"icon": "naturesaura:aura_cache",
"sortnum": 10
"sortnum": 15
}

View file

@ -0,0 +1,17 @@
{
"name": "The Natural Altar",
"icon": "naturesaura:nature_altar",
"category": "naturesaura:collecting",
"priority": true,
"pages": [
{
"type": "text",
"text": "A rudimentary, yet effective way of collecting $(thing)Aura$() early on is the $(item)Natural Altar$(). After creating the setup shown on the following page, the altar will start slowly draining $(thing)Aura$() in the vicinity.$(br)The collected $(thing)Aura$() can then be used in several ways, $(l:naturesaura:using/altar)infusing items$() for instance."
},
{
"type": "naturesaura:tree_ritual",
"text": "Creating the $(item)Natural Altar$() using the $(l:naturesaura:using/tree_ritual)Ritual of the Forest$().",
"recipe": "naturesaura:nature_altar"
}
]
}

View file

@ -1,11 +0,0 @@
{
"name": "Infused Iron",
"icon": "naturesaura:infused_iron",
"category": "naturesaura:items",
"pages": [
{
"type": "text",
"text": "Hi"
}
]
}

View file

@ -0,0 +1,18 @@
{
"name": "Natural Altar Infusion",
"icon": "naturesaura:nature_altar",
"category": "naturesaura:using",
"priority": true,
"pages": [
{
"type": "text",
"text": "When the $(l:naturesaura:collecting/altar)Natural Altar$() has collected a sufficient amount of $(thing)Aura$(), it will be able to infuse items of certain materials, converting them into different, more powerful materials. To do this, simply place any material onto the altar and wait for the infusion to be completed.$(br2)The following pages list some useful materials that a botanist might frequently need."
},
{
"type": "naturesaura:altar",
"text": "Creating $(item)Infused Iron$() and $(item)Infused Rock$(), important ingredients in the creation of several $(l:naturesaura:items)Natural Items$().",
"recipe": "naturesaura:infused_iron",
"recipe2": "naturesaura:infused_stone"
}
]
}

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB