-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43ea9d9
commit bf19101
Showing
23 changed files
with
554 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
minecraft.version=1.12.2 | ||
forge.version=14.23.5.2768 | ||
jei.version=4.13.1.222 | ||
crafttweaker.version=1.12-4.1.8.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Work under Copyright. Licensed under the EUPL. | ||
* See the project README.md and LICENSE.txt for more information. | ||
*/ | ||
|
||
package net.dries007.tfc.jei; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.NonNullList; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import net.dries007.tfc.objects.inventory.ingredient.IIngredient; | ||
|
||
/** | ||
* Wraps recipe ingredients and outputs for JEI | ||
*/ | ||
public interface IJEIRecipeWrapper | ||
{ | ||
/** | ||
* Returns a list of Item Ingredients for JEI | ||
* | ||
* @return NonNullList with ItemStack IIngredients | ||
*/ | ||
default NonNullList<IIngredient<ItemStack>> getItemIngredients() | ||
{ | ||
return NonNullList.create(); | ||
} | ||
|
||
/** | ||
* Returns a list of Fluid Ingredients for JEI | ||
* | ||
* @return NonNullList with FluidStack IIngredients | ||
*/ | ||
default NonNullList<IIngredient<FluidStack>> getFluidIngredients() | ||
{ | ||
return NonNullList.create(); | ||
} | ||
|
||
/** | ||
* Returns a list of Item Outputs | ||
* | ||
* @return NonNullList with ItemStacks | ||
*/ | ||
default NonNullList<ItemStack> getItemOutputs() | ||
{ | ||
return NonNullList.create(); | ||
} | ||
|
||
/** | ||
* Returns a list of Fluid Outputs | ||
* | ||
* @return NonNullList with FluidStacks | ||
*/ | ||
default NonNullList<FluidStack> getFluidOutputs() | ||
{ | ||
return NonNullList.create(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Work under Copyright. Licensed under the EUPL. | ||
* See the project README.md and LICENSE.txt for more information. | ||
*/ | ||
|
||
package net.dries007.tfc.jei; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.IModRegistry; | ||
import mezz.jei.api.JEIPlugin; | ||
import mezz.jei.api.recipe.IRecipeCategoryRegistration; | ||
import net.dries007.tfc.api.registries.TFCRegistries; | ||
import net.dries007.tfc.api.types.Metal; | ||
import net.dries007.tfc.api.util.TFCConstants; | ||
import net.dries007.tfc.jei.categories.AnvilCategory; | ||
import net.dries007.tfc.jei.categories.QuernCategory; | ||
import net.dries007.tfc.jei.wrappers.AnvilWrapper; | ||
import net.dries007.tfc.jei.wrappers.QuernWrapper; | ||
import net.dries007.tfc.objects.blocks.BlocksTFC; | ||
import net.dries007.tfc.objects.blocks.metal.BlockAnvilTFC; | ||
|
||
@JEIPlugin | ||
public final class TFCJEIPlugin implements IModPlugin | ||
{ | ||
public static final String QUERN_UID = TFCConstants.MOD_ID + ".quern"; | ||
public static final String ANVIL_UID = TFCConstants.MOD_ID + ".anvil"; | ||
|
||
@Override | ||
public void registerCategories(IRecipeCategoryRegistration registry) | ||
{ | ||
//Add new JEI recipe categories | ||
registry.addRecipeCategories(new QuernCategory(registry.getJeiHelpers().getGuiHelper())); //Quern | ||
registry.addRecipeCategories(new AnvilCategory(registry.getJeiHelpers().getGuiHelper())); //Anvil | ||
} | ||
|
||
@Override | ||
public void register(IModRegistry registry) | ||
{ | ||
//Wraps all quern recipes | ||
List<QuernWrapper> quernList = TFCRegistries.QUERN.getValuesCollection() | ||
.stream() | ||
.map(QuernWrapper::new) | ||
.collect(Collectors.toList()); | ||
|
||
registry.addRecipes(quernList, QUERN_UID); //Register recipes to quern category | ||
registry.addRecipeCatalyst(new ItemStack(BlocksTFC.QUERN), QUERN_UID); //Register BlockQuern as the device that do quern recipes | ||
|
||
//Wraps all anvil recipes | ||
List<AnvilWrapper> anvilList = TFCRegistries.ANVIL.getValuesCollection() | ||
.stream() | ||
.map(AnvilWrapper::new) | ||
.collect(Collectors.toList()); | ||
|
||
registry.addRecipes(anvilList, ANVIL_UID); | ||
registry.addRecipeCatalyst(BlockAnvilTFC.get(Metal.WROUGHT_IRON, 1), ANVIL_UID); //This is returning air :/ | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/net/dries007/tfc/jei/categories/AnvilCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package net.dries007.tfc.jei.categories; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
import mcp.MethodsReturnNonnullByDefault; | ||
import mezz.jei.api.IGuiHelper; | ||
import mezz.jei.api.gui.IDrawableAnimated; | ||
import mezz.jei.api.gui.IDrawableStatic; | ||
import mezz.jei.api.gui.IGuiItemStackGroup; | ||
import mezz.jei.api.gui.IRecipeLayout; | ||
import mezz.jei.api.ingredients.IIngredients; | ||
import mezz.jei.api.ingredients.VanillaTypes; | ||
import net.dries007.tfc.api.util.TFCConstants; | ||
import net.dries007.tfc.jei.TFCJEIPlugin; | ||
import net.dries007.tfc.jei.wrappers.AnvilWrapper; | ||
import net.dries007.tfc.objects.items.ItemsTFC; | ||
|
||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
public class AnvilCategory extends TFCRecipeCategory<AnvilWrapper> | ||
{ | ||
private final IDrawableStatic slot; | ||
private final IDrawableStatic arrow; | ||
private final IDrawableAnimated arrowAnimated; | ||
|
||
public AnvilCategory(IGuiHelper helper) | ||
{ | ||
super(helper.createBlankDrawable(120, 38), "anvil"); | ||
ResourceLocation resourceLocation = new ResourceLocation(TFCConstants.MOD_ID, "textures/gui/jei/recipes.png"); | ||
arrow = helper.createDrawable(resourceLocation, 0, 14, 22, 16); | ||
IDrawableStatic arrowAnimated = helper.createDrawable(resourceLocation, 22, 14, 22, 16); | ||
this.arrowAnimated = helper.createAnimatedDrawable(arrowAnimated, 160, IDrawableAnimated.StartDirection.LEFT, false); | ||
this.slot = helper.getSlotDrawable(); | ||
} | ||
|
||
@Override | ||
public String getUid() | ||
{ | ||
return TFCJEIPlugin.ANVIL_UID; | ||
} | ||
|
||
@Override | ||
public void drawExtras(Minecraft minecraft) | ||
{ | ||
arrow.draw(minecraft, 50, 16); | ||
arrowAnimated.draw(minecraft, 50, 16); | ||
slot.draw(minecraft, 0, 16); | ||
slot.draw(minecraft, 20, 16); | ||
slot.draw(minecraft, 84, 16); | ||
} | ||
|
||
@Override | ||
public void setRecipe(IRecipeLayout recipeLayout, AnvilWrapper recipeWrapper, IIngredients ingredients) | ||
{ | ||
IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); | ||
itemStackGroup.init(0, true, 0, 16); | ||
itemStackGroup.init(1, true, 20, 16); | ||
itemStackGroup.init(2, false, 84, 16); | ||
|
||
itemStackGroup.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0)); | ||
itemStackGroup.set(1, new ItemStack(ItemsTFC.HANDSTONE)); //TODO change to hammer | ||
itemStackGroup.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0)); | ||
} | ||
} |
Oops, something went wrong.