jay ee eye

This commit is contained in:
Ellpeck 2018-10-16 21:10:38 +02:00
parent 0b7b43fd7f
commit 631ec96b5e
6 changed files with 131 additions and 2 deletions

View file

@ -118,7 +118,9 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
}
private void recurseTreeDestruction(BlockPos pos, BlockPos start) {
if (pos.distanceSq(start) >= 15 * 15) {
if (Math.abs(pos.getX() - start.getX()) >= 6
|| Math.abs(pos.getZ() - start.getZ()) >= 6
|| Math.abs(pos.getY() - start.getY()) >= 16) {
return;
}

View file

@ -0,0 +1,37 @@
package de.ellpeck.naturesaura.jei;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.jei.treeritual.TreeRitualCategory;
import de.ellpeck.naturesaura.jei.treeritual.TreeRitualWrapper;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import net.minecraft.item.ItemStack;
@JEIPlugin
public class JEINaturesAuraPlugin implements IModPlugin {
public static final String TREE_RITUAL = NaturesAura.MOD_ID + ".tree_ritual";
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
IGuiHelper helper = registry.getJeiHelpers().getGuiHelper();
registry.addRecipeCategories(
new TreeRitualCategory(helper)
);
}
@Override
public void register(IModRegistry registry) {
registry.handleRecipes(TreeRitualRecipe.class, TreeRitualWrapper::new, TREE_RITUAL);
registry.addRecipes(TreeRitualRecipe.RECIPES, TREE_RITUAL);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.GOLD_POWDER), TREE_RITUAL);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL);
}
}

View file

@ -0,0 +1,60 @@
package de.ellpeck.naturesaura.jei.treeritual;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.jei.JEINaturesAuraPlugin;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
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);
}
@Override
public String getUid() {
return JEINaturesAuraPlugin.TREE_RITUAL;
}
@Override
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
}
@Override
public String getModName() {
return NaturesAura.MOD_NAME;
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, TreeRitualWrapper recipeWrapper, IIngredients ingredients) {
IGuiItemStackGroup group = recipeLayout.getItemStacks();
TreeRitualRecipe recipe = recipeWrapper.recipe;
group.init(0, true, 34, 34);
group.set(0, recipe.saplingType);
group.init(1, true, 124, 34);
group.set(1, recipe.result);
int[][] positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
for (int i = 0; i < recipe.items.length; i++) {
group.init(i + 2, true, positions[i][0] - 1, positions[i][1] - 1);
group.set(i + 2, recipe.items[i]);
}
}
}

View file

@ -0,0 +1,28 @@
package de.ellpeck.naturesaura.jei.treeritual;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TreeRitualWrapper implements IRecipeWrapper {
public final TreeRitualRecipe recipe;
public TreeRitualWrapper(TreeRitualRecipe recipe) {
this.recipe = recipe;
}
@Override
public void getIngredients(IIngredients ingredients) {
List<ItemStack> inputs = new ArrayList<>(Arrays.asList(this.recipe.items));
inputs.add(this.recipe.saplingType);
ingredients.setInputs(VanillaTypes.ITEM, inputs);
ingredients.setOutput(VanillaTypes.ITEM, this.recipe.result);
}
}

View file

@ -12,4 +12,6 @@ tile.naturesaura.wood_stand.name=Wooden Stand
item.naturesaura.eye.name=Environmental Eye
item.naturesaura.gold_fiber.name=Brilliant Fiber
item.naturesaura.gold_leaf.name=Gold Leaf
item.naturesaura.gold_leaf.name=Gold Leaf
container.naturesaura.tree_ritual.name=Tree Infusion

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB