mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Move JEI integration temporarily cause I'm too lazy to comment this all out
This commit is contained in:
1 parent
6dc4c1d851
commit
62d6654c9a
21 files changed
No files matched your search
@@ -1,208 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei;
|
||||
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.IRecipesGui;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.client.core.handler.CorporeaInputHandler;
|
||||
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.AncientWillRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.CompositeLensRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.SpecialFloatingFlowerWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.TerraPickTippingRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.puredaisy.PureDaisyRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.puredaisy.PureDaisyRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeWrapper;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID;
|
||||
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID_IGNEM;
|
||||
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_PUREDAISY;
|
||||
|
||||
@JEIPlugin
|
||||
public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) {
|
||||
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
|
||||
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewVial, ItemBrewBase::getSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewFlask, ItemBrewBase::getSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.incenseStick, ItemBrewBase::getSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.bloodPendant, ItemBrewBase::getSubtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCategories(IRecipeCategoryRegistration registry) {
|
||||
registry.addRecipeCategories(
|
||||
new BreweryRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new PureDaisyRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new RunicAltarRecipeCategory(registry.getJeiHelpers().getGuiHelper()), // Runic must come before petals. See williewillus/Botania#172
|
||||
new PetalApothecaryRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new ElvenTradeRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new ManaPoolRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new OrechidRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
|
||||
new OrechidIgnemRecipeCategory(registry.getJeiHelpers().getGuiHelper())
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean doesOreExist(String key) {
|
||||
return OreDictionary.doesOreNameExist(key)
|
||||
&& OreDictionary.getOres(key).stream()
|
||||
.anyMatch(s -> s.getItem() instanceof ItemBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
registry.handleRecipes(RecipeBrew.class, BreweryRecipeWrapper::new, BreweryRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipePureDaisy.class, PureDaisyRecipeWrapper::new, PureDaisyRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipeRuneAltar.class, RunicAltarRecipeWrapper::new, RunicAltarRecipeCategory.UID); // Runic must come before petals. See williewillus/Botania#172
|
||||
registry.handleRecipes(RecipePetals.class, PetalApothecaryRecipeWrapper::new, PetalApothecaryRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipeElvenTrade.class, ElvenTradeRecipeWrapper::new, ElvenTradeRecipeCategory.UID);
|
||||
registry.handleRecipes(RecipeManaInfusion.class, ManaPoolRecipeWrapper::new, ManaPoolRecipeCategory.UID);
|
||||
|
||||
registry.handleRecipes(SpecialFloatingFlowerRecipe.class, SpecialFloatingFlowerWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.handleRecipes(AncientWillRecipe.class, AncientWillRecipeWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.handleRecipes(TerraPickTippingRecipe.class, TerraPickTippingRecipeWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.handleRecipes(CompositeLensRecipe.class, r -> new CompositeLensRecipeWrapper(), VanillaRecipeCategoryUid.CRAFTING);
|
||||
|
||||
registry.addRecipes(BotaniaAPI.brewRecipes, BreweryRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.pureDaisyRecipes, PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.petalRecipes, PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.elvenTradeRecipes, ElvenTradeRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.runeAltarRecipes, RunicAltarRecipeCategory.UID);
|
||||
registry.addRecipes(BotaniaAPI.manaInfusionRecipes, ManaPoolRecipeCategory.UID);
|
||||
|
||||
registry.addRecipes(
|
||||
BotaniaAPI.oreWeights.entrySet().stream()
|
||||
.filter(e -> doesOreExist(e.getKey()))
|
||||
.map(OrechidRecipeWrapper::new)
|
||||
.sorted()
|
||||
.collect(Collectors.toList()),
|
||||
OrechidRecipeCategory.UID);
|
||||
|
||||
registry.addRecipes(
|
||||
BotaniaAPI.oreWeightsNether.entrySet().stream()
|
||||
.filter(e -> doesOreExist(e.getKey()))
|
||||
.map(OrechidIgnemRecipeWrapper::new)
|
||||
.sorted()
|
||||
.collect(Collectors.toList()),
|
||||
OrechidIgnemRecipeCategory.UID);
|
||||
|
||||
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.brewery), BreweryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.alfPortal), ElvenTradeRecipeCategory.UID);
|
||||
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.manaPool), ManaPoolRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.creativePool), ManaPoolRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.dilutedPool), ManaPoolRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.fabulousPool), ManaPoolRecipeCategory.UID);
|
||||
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.defaultAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.forestAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.plainsAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mountainAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.fungalAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.swampAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.desertAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.taigaAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mesaAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mossyAltar), PetalApothecaryRecipeCategory.UID);
|
||||
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID), OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID), OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
|
||||
|
||||
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.runeAltar), RunicAltarRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModItems.autocraftingHalo), VanillaRecipeCategoryUid.CRAFTING);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModItems.craftingHalo), VanillaRecipeCategoryUid.CRAFTING);
|
||||
|
||||
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerCraftingHalo.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
|
||||
IRecipeRegistry recipeRegistry = jeiRuntime.getRecipeRegistry();
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
List<Object> inputs = recipe.getInputs();
|
||||
List<ItemStack> outputs = recipe.getOutputs();
|
||||
if(inputs.size() == 1 && outputs.size() == 1 && inputs.get(0) instanceof ItemStack
|
||||
&& ItemStack.areItemStacksEqual((ItemStack) inputs.get(0), outputs.get(0))) {
|
||||
IRecipeWrapper wrapper = recipeRegistry.getRecipeWrapper(recipe, ElvenTradeRecipeCategory.UID);
|
||||
if(wrapper != null) {
|
||||
recipeRegistry.hideRecipe(wrapper, ElvenTradeRecipeCategory.UID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CorporeaInputHandler.jeiPanelSupplier = () -> {
|
||||
Object o = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse();
|
||||
|
||||
if(o == null && Minecraft.getInstance().currentScreen == jeiRuntime.getRecipesGui())
|
||||
o = jeiRuntime.getRecipesGui().getIngredientUnderMouse();
|
||||
|
||||
if(o instanceof ItemStack)
|
||||
return (ItemStack) o;
|
||||
return ItemStack.EMPTY;
|
||||
};
|
||||
|
||||
CorporeaInputHandler.supportedGuiFilter = gui -> gui instanceof GuiContainer || gui instanceof IRecipesGui;
|
||||
}
|
||||
|
||||
}
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.brewery;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BreweryRecipeCategory implements IRecipeCategory<BreweryRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.brewery";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
|
||||
public BreweryRecipeCategory(IGuiHelper guiHelper) {
|
||||
ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
|
||||
background = guiHelper.createDrawable(location, 0, 0, 166, 65);
|
||||
localizedName = I18n.format("botania.nei.brewery");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BreweryRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(VanillaTypes.ITEM);
|
||||
List<List<ItemStack>> outputs = ingredients.getOutputs(VanillaTypes.ITEM);
|
||||
IFocus<?> focus = recipeLayout.getFocus();
|
||||
|
||||
recipeLayout.getItemStacks().init(0, true, 39, 41);
|
||||
recipeLayout.getItemStacks().set(0, getItemMatchingFocus(focus, IFocus.Mode.OUTPUT, outputs.get(0), inputs.get(0)));
|
||||
|
||||
int index = 1, posX = 60;
|
||||
for(int i = 1; i < inputs.size(); i++) {
|
||||
List<ItemStack> o = inputs.get(i);
|
||||
recipeLayout.getItemStacks().init(index, true, posX, 6);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index++;
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(7, false, 87, 41);
|
||||
recipeLayout.getItemStacks().set(7, getItemMatchingFocus(focus, IFocus.Mode.INPUT, inputs.get(0), outputs.get(0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* If an item in this recipe is focused, returns the corresponding item instead of all the containers/results.
|
||||
*/
|
||||
private List<ItemStack> getItemMatchingFocus(IFocus<?> focus, IFocus.Mode mode, List<ItemStack> focused, List<ItemStack> other) {
|
||||
if(focus != null && focus.getMode() == mode) {
|
||||
ItemStack focusStack = (ItemStack) focus.getValue();
|
||||
for(int i = 0; i < focused.size(); i++)
|
||||
if(focusStack.isItemEqual(focused.get(i)))
|
||||
return Collections.singletonList(other.get(i));
|
||||
}
|
||||
return other;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.brewery;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BreweryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> output;
|
||||
|
||||
private static final List<ItemStack> inputs = Arrays.asList(new ItemStack(ModItems.vial),
|
||||
new ItemStack(ModItems.flask), new ItemStack(ModItems.incenseStick), new ItemStack(ModItems.bloodPendant));
|
||||
|
||||
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
|
||||
ImmutableList.Builder<List<ItemStack>> inputBuilder = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> outputBuilder = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> containers = ImmutableList.builder();
|
||||
|
||||
for(ItemStack stack : inputs) {
|
||||
ItemStack brewed = recipeBrew.getOutput(stack);
|
||||
if(!brewed.isEmpty()) {
|
||||
containers.add(stack);
|
||||
outputBuilder.add(brewed);
|
||||
}
|
||||
}
|
||||
inputBuilder.add(containers.build());
|
||||
|
||||
for(Object o : recipeBrew.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
inputBuilder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
inputBuilder.add(OreDictionary.getOres((String) o));
|
||||
}
|
||||
}
|
||||
|
||||
input = inputBuilder.build();
|
||||
output = outputBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, ImmutableList.of(output));
|
||||
}
|
||||
}
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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 mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.item.IAncientWillContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class AncientWillRecipeWrapper implements ICustomCraftingRecipeWrapper {
|
||||
private final ResourceLocation name;
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private final List<ItemStack> output;
|
||||
|
||||
public AncientWillRecipeWrapper(AncientWillRecipe recipe) {
|
||||
this.name = recipe.getRegistryName();
|
||||
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> helmets = ImmutableList.builder();
|
||||
ImmutableList.Builder<ItemStack> wills = ImmutableList.builder();
|
||||
helmets.add(new ItemStack(ModItems.terrasteelHelm));
|
||||
if(Botania.thaumcraftLoaded) {
|
||||
helmets.add(new ItemStack(ModItems.terrasteelHelmRevealing));
|
||||
}
|
||||
for(int i = 0; i < 6; i++) {
|
||||
wills.add(new ItemStack(ModItems.ancientWill, 1, i));
|
||||
}
|
||||
|
||||
output = helmets.build();
|
||||
builder.add(output);
|
||||
builder.add(wills.build());
|
||||
inputs = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, ImmutableList.of(output));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients) {
|
||||
IFocus<?> focus = recipeLayout.getFocus();
|
||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
||||
group.set(ingredients);
|
||||
|
||||
if(focus != null) {
|
||||
ItemStack focused = (ItemStack) focus.getValue();
|
||||
|
||||
if(focus.getMode() == IFocus.Mode.INPUT && focused.getItem() == ModItems.ancientWill) {
|
||||
group.set(2, new ItemStack(ModItems.ancientWill, 1, focused.getMetadata()));
|
||||
group.set(0, getHelmetsWithWill(focused.getMetadata()));
|
||||
} else if(focused.getItem() instanceof IAncientWillContainer) { //helmet
|
||||
group.set(1, new ItemStack(focused.getItem()));
|
||||
group.set(0, getWillsOnHelmet(focused.getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<ItemStack> getHelmetsWithWill(int meta) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for(ItemStack itemStack : output) {
|
||||
ItemStack toAdd = itemStack.copy();
|
||||
((IAncientWillContainer) toAdd.getItem()).addAncientWill(toAdd, meta);
|
||||
builder.add(toAdd);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private List<ItemStack> getWillsOnHelmet(Item item) {
|
||||
if(item instanceof IAncientWillContainer) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for(int i = 0; i < 6; i++) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
((IAncientWillContainer) item).addAncientWill(stack, i);
|
||||
builder.add(stack);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.lens.ItemLens;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CompositeLensRecipeWrapper implements ICustomCraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private static final List<ItemStack> lenses;
|
||||
|
||||
static {
|
||||
NonNullList<ItemStack> allLenses = NonNullList.create();
|
||||
ItemLens lens = (ItemLens) ModItems.lens;
|
||||
lens.getSubItems(CreativeTabs.SEARCH, allLenses);
|
||||
lenses = ImmutableList.copyOf(allLenses.stream().filter(stack -> !lens.isControlLens(stack)).filter(lens::isCombinable).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public CompositeLensRecipeWrapper() {
|
||||
inputs = ImmutableList.of(lenses, ImmutableList.of(new ItemStack(Items.SLIME_BALL)), lenses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().set(ingredients);
|
||||
recipeLayout.setShapeless();
|
||||
if(recipeLayout.getFocus() != null) {
|
||||
ItemStack stack = (ItemStack) recipeLayout.getFocus().getValue();
|
||||
if(stack.getItem() == ModItems.lens) {
|
||||
setLenses(recipeLayout, stack.getMetadata(), stack.getMetadata());
|
||||
return;
|
||||
}
|
||||
}
|
||||
setLenses(recipeLayout, 1, ItemLens.SUBTYPES - 1);
|
||||
}
|
||||
|
||||
private void setLenses(IRecipeLayout recipeLayout, int start, int end) {
|
||||
List<ItemStack> firstInput = new ArrayList<>();
|
||||
List<ItemStack> secondInput = new ArrayList<>();
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
|
||||
if(end >= ItemLens.SUBTYPES)
|
||||
end = ItemLens.SUBTYPES - 1;
|
||||
|
||||
for(int i = start; i <= end; i++) {
|
||||
ItemStack firstLens = new ItemStack(ModItems.lens, 1, i);
|
||||
for(ItemStack secondLens : lenses) {
|
||||
if(secondLens.getMetadata() == i)
|
||||
continue;
|
||||
|
||||
if(((ItemLens) ModItems.lens).canCombineLenses(firstLens, secondLens)) {
|
||||
firstInput.add(firstLens);
|
||||
secondInput.add(secondLens);
|
||||
outputs.add(((ItemLens) ModItems.lens).setCompositeLens(firstLens.copy(), secondLens));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
recipeLayout.getItemStacks().set(1, firstInput);
|
||||
recipeLayout.getItemStacks().set(3, secondInput);
|
||||
recipeLayout.getItemStacks().set(0, outputs);
|
||||
}
|
||||
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpecialFloatingFlowerWrapper implements ICraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs = new ArrayList<>();
|
||||
private final ItemStack output;
|
||||
private final ResourceLocation name;
|
||||
|
||||
public SpecialFloatingFlowerWrapper(SpecialFloatingFlowerRecipe recipe) {
|
||||
name = recipe.getRegistryName();
|
||||
inputs.add(ImmutableList.of(ItemBlockSpecialFlower.ofType(recipe.type)));
|
||||
List<ItemStack> normalFloaters = new ArrayList<>();
|
||||
for(EnumDyeColor color : EnumDyeColor.values()) {
|
||||
normalFloaters.add(new ItemStack(ModBlocks.floatingFlower, 1, color.getMetadata()));
|
||||
}
|
||||
inputs.add(normalFloaters);
|
||||
output = ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), recipe.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class TerraPickTippingRecipeWrapper implements ICraftingRecipeWrapper {
|
||||
private final List<List<ItemStack>> inputs;
|
||||
private final ItemStack output;
|
||||
private final ResourceLocation name;
|
||||
|
||||
public TerraPickTippingRecipeWrapper(TerraPickTippingRecipe recipe) {
|
||||
inputs = ImmutableList.of(ImmutableList.of(new ItemStack(ModItems.terraPick)), ImmutableList.of(new ItemStack(ModItems.elementiumPick)));
|
||||
output = new ItemStack(ModItems.terraPick);
|
||||
ItemTerraPick.setTipped(output);
|
||||
|
||||
this.name = recipe.getRegistryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
-112
@@ -1,112 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.elventrade;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class ElvenTradeRecipeCategory implements IRecipeCategory<ElvenTradeRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.elvenTrade";
|
||||
private final String localizedName;
|
||||
private final IDrawable background;
|
||||
private final IDrawable overlay;
|
||||
|
||||
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
|
||||
localizedName = I18n.format("botania.nei.elvenTrade");
|
||||
background = guiHelper.createBlankDrawable(145, 95);
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 0, 4);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
|
||||
minecraft.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
BufferBuilder wr = tess.getBuffer();
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
int startX = 22;
|
||||
int startY = 25;
|
||||
int stopX = 70;
|
||||
int stopY = 73;
|
||||
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
|
||||
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
|
||||
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
|
||||
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ElvenTradeRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
int index = 0, posX = 42;
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, posX, 0);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index++;
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
for(int i = 0; i < ingredients.getOutputs(VanillaTypes.ITEM).size(); i++) {
|
||||
List<ItemStack> stacks = ingredients.getOutputs(VanillaTypes.ITEM).get(i);
|
||||
recipeLayout.getItemStacks().init(index + i, false, 93 + i % 2 * 20, 41 + i / 2 * 20);
|
||||
recipeLayout.getItemStacks().set(index + i, stacks);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.elventrade;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final List<ItemStack> outputs;
|
||||
|
||||
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
}
|
||||
}
|
||||
input = builder.build();
|
||||
outputs = ImmutableList.copyOf(recipe.getOutputs());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, outputs);
|
||||
}
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.manapool;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ManaPoolRecipeCategory implements IRecipeCategory<ManaPoolRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.manaPool";
|
||||
private final IDrawable background;
|
||||
private final String localizedName;
|
||||
private final IDrawable overlay;
|
||||
private final ItemStack renderStack = new ItemStack(ModBlocks.manaPool);
|
||||
|
||||
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.manaPool");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
ItemNBTHelper.setBoolean(renderStack, "RenderFull", true);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IDrawable getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ManaPoolRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
int index = 0;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, true, 40, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
index++;
|
||||
|
||||
if(ingredients.getInputs(VanillaTypes.ITEM).size() > 1) {
|
||||
// Has catalyst
|
||||
recipeLayout.getItemStacks().init(index, true, 20, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getInputs(VanillaTypes.ITEM).get(1));
|
||||
index++;
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, true, 70, 12);
|
||||
recipeLayout.getItemStacks().set(index, renderStack);
|
||||
index++;
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 99, 12);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.manapool;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class ManaPoolRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
private final int mana;
|
||||
|
||||
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
|
||||
if(recipe.getInput() instanceof ItemStack) {
|
||||
builder.add(ImmutableList.of((ItemStack) recipe.getInput()));
|
||||
} else if(recipe.getInput() instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) recipe.getInput()));
|
||||
}
|
||||
|
||||
if(recipe.getCatalyst() != null) {
|
||||
Block block = recipe.getCatalyst().getBlock();
|
||||
if (Item.getItemFromBlock(block) != Items.AIR) {
|
||||
builder.add(ImmutableList.of(new ItemStack(block, 1, block.getMetaFromState(recipe.getCatalyst()))));
|
||||
}
|
||||
}
|
||||
|
||||
input = builder.build();
|
||||
output = recipe.getOutput();
|
||||
mana = recipe.getManaToConsume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
GlStateManager.enableAlpha();
|
||||
HUDHandler.renderManaBar(28, 50, 0x0000FF, 0.75F, mana, TilePool.MAX_MANA / 10);
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
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 mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidIgnemRecipeCategory implements IRecipeCategory<OrechidIgnemRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.orechid_ignem";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechidIgnem");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull OrechidIgnemRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OrechidIgnemRecipeWrapper extends OrechidRecipeWrapper {
|
||||
|
||||
public OrechidIgnemRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
super(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.NETHERRACK, 64);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeightsNether;
|
||||
}
|
||||
|
||||
}
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
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 mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class OrechidRecipeCategory implements IRecipeCategory<OrechidRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.orechid";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public OrechidRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.orechid");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull OrechidRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 40, 12);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/**
|
||||
* This class was created by <codewarrior0>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.orechid;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static vazkii.botania.client.integration.jei.JEIBotaniaPlugin.doesOreExist;
|
||||
|
||||
public class OrechidRecipeWrapper implements IRecipeWrapper, Comparable<OrechidRecipeWrapper> {
|
||||
|
||||
private final int weight;
|
||||
private final List<List<ItemStack>> outputStacks;
|
||||
|
||||
protected ItemStack getInputStack() {
|
||||
return new ItemStack(Blocks.STONE, 64);
|
||||
}
|
||||
|
||||
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) {
|
||||
this.weight = entry.getValue();
|
||||
|
||||
final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight()));
|
||||
|
||||
// Shouldn't ever return an empty list since the ore weight
|
||||
// list is filtered to only have ores with ItemBlocks
|
||||
List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream()
|
||||
.filter(s -> s.getItem() instanceof ItemBlock)
|
||||
.map(ItemStack::copy)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
stackList.forEach(s -> s.setCount(amount));
|
||||
|
||||
outputStacks = Collections.singletonList(stackList);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOreWeights() {
|
||||
return BotaniaAPI.oreWeights;
|
||||
}
|
||||
|
||||
private float getTotalOreWeight() {
|
||||
return (getOreWeights().entrySet().stream()
|
||||
.filter(e -> doesOreExist(e.getKey()))
|
||||
.map(Map.Entry::getValue)
|
||||
.reduce(Integer::sum)).orElse(weight * 64 * 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInput(VanillaTypes.ITEM, getInputStack());
|
||||
ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@Nonnull OrechidRecipeWrapper o) {
|
||||
return Integer.compare(o.weight, weight);
|
||||
}
|
||||
}
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.petalapothecary;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PetalApothecaryRecipeCategory implements IRecipeCategory<PetalApothecaryRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.petals";
|
||||
private final IDrawableStatic background;
|
||||
private final String localizedName;
|
||||
private final IDrawableStatic overlay;
|
||||
|
||||
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(150, 110);
|
||||
localizedName = I18n.format("botania.nei.petalApothecary");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
|
||||
0, 0, 150, 110);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull PetalApothecaryRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().init(0, true, 64, 52);
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.defaultAltar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(VanillaTypes.ITEM).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
point = rotatePointAbout(point, center, angleBetweenEach);
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
private Point rotatePointAbout(Point in, Point about, double degrees) {
|
||||
double rad = degrees * Math.PI / 180.0;
|
||||
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
|
||||
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
|
||||
return new Point((int) newX, (int) newY);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.petalapothecary;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
|
||||
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
}
|
||||
}
|
||||
input = builder.build();
|
||||
output = recipe.getOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.puredaisy;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PureDaisyRecipeCategory implements IRecipeCategory<PureDaisyRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.pureDaisy";
|
||||
private final IDrawable background;
|
||||
private final String localizedName;
|
||||
private final IDrawable overlay;
|
||||
|
||||
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(168, 64);
|
||||
localizedName = I18n.format("botania.nei.pureDaisy");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
|
||||
0, 0, 64, 46);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft, 48, 0);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull PureDaisyRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
boolean inputFluid = !ingredients.getInputs(VanillaTypes.FLUID).isEmpty();
|
||||
boolean outputFluid = !ingredients.getOutputs(VanillaTypes.FLUID).isEmpty();
|
||||
|
||||
if(inputFluid) {
|
||||
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(0, true, 40, 12);
|
||||
recipeLayout.getItemStacks().set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(1, true, 70, 12);
|
||||
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
|
||||
|
||||
if(outputFluid) {
|
||||
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
|
||||
recipeLayout.getFluidStacks().set(2, ingredients.getOutputs(VanillaTypes.FLUID).get(0));
|
||||
} else {
|
||||
recipeLayout.getItemStacks().init(2, false, 99, 12);
|
||||
recipeLayout.getItemStacks().set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.puredaisy;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class PureDaisyRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private List<ItemStack> inputs = ImmutableList.of();
|
||||
private ItemStack output = ItemStack.EMPTY;
|
||||
private FluidStack fluidInput = null;
|
||||
private FluidStack fluidOutput = null;
|
||||
|
||||
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
|
||||
if(recipe.getInput() instanceof String) {
|
||||
inputs = ImmutableList.copyOf(OreDictionary.getOres((String) recipe.getInput()));
|
||||
} else if(recipe.getInput() instanceof Block || recipe.getInput() instanceof IBlockState) {
|
||||
IBlockState state = recipe.getInput() instanceof IBlockState ? (IBlockState) recipe.getInput() : ((Block) recipe.getInput()).getDefaultState();
|
||||
Block b = state.getBlock();
|
||||
|
||||
if(FluidRegistry.lookupFluidForBlock(b) != null) {
|
||||
fluidInput = new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000);
|
||||
} else {
|
||||
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(state)));
|
||||
}
|
||||
}
|
||||
|
||||
Block outBlock = recipe.getOutputState().getBlock();
|
||||
if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
|
||||
fluidOutput = new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000);
|
||||
} else {
|
||||
output = new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(VanillaTypes.ITEM, inputs);
|
||||
|
||||
if (fluidInput != null) {
|
||||
ingredients.setInput(VanillaTypes.FLUID, fluidInput);
|
||||
}
|
||||
|
||||
if (!output.isEmpty()) {
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
if (fluidOutput != null) {
|
||||
ingredients.setOutput(VanillaTypes.FLUID, fluidOutput);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.runicaltar;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Point;
|
||||
import java.util.List;
|
||||
|
||||
public class RunicAltarRecipeCategory implements IRecipeCategory<RunicAltarRecipeWrapper> {
|
||||
|
||||
public static final String UID = "botania.runicAltar";
|
||||
private final IDrawable background;
|
||||
private final String localizedName;
|
||||
private final IDrawable overlay;
|
||||
|
||||
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createBlankDrawable(150, 110);
|
||||
localizedName = I18n.format("botania.nei.runicAltar");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
|
||||
0, 0, 150, 110);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(@Nonnull Minecraft minecraft) {
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
overlay.draw(minecraft);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RunicAltarRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
recipeLayout.getItemStacks().init(0, true, 64, 52);
|
||||
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
|
||||
|
||||
int index = 1;
|
||||
double angleBetweenEach = 360.0 / ingredients.getInputs(VanillaTypes.ITEM).size();
|
||||
Point point = new Point(64, 20), center = new Point(64, 52);
|
||||
|
||||
for(List<ItemStack> o : ingredients.getInputs(VanillaTypes.ITEM)) {
|
||||
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
|
||||
recipeLayout.getItemStacks().set(index, o);
|
||||
index += 1;
|
||||
point = rotatePointAbout(point, center, angleBetweenEach);
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 103, 17);
|
||||
recipeLayout.getItemStacks().set(index, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
}
|
||||
|
||||
private Point rotatePointAbout(Point in, Point about, double degrees) {
|
||||
double rad = degrees * Math.PI / 180.0;
|
||||
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
|
||||
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
|
||||
return new Point((int) newX, (int) newY);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getModName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.integration.jei.runicaltar;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List<List<ItemStack>> input;
|
||||
private final ItemStack output;
|
||||
private final int manaUsage;
|
||||
|
||||
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
|
||||
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof ItemStack) {
|
||||
builder.add(ImmutableList.of((ItemStack) o));
|
||||
}
|
||||
if(o instanceof String) {
|
||||
builder.add(OreDictionary.getOres((String) o));
|
||||
}
|
||||
}
|
||||
input = builder.build();
|
||||
output = recipe.getOutput();
|
||||
manaUsage = recipe.getManaUsage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, input);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
GlStateManager.enableAlpha();
|
||||
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
|
||||
GlStateManager.disableAlpha();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user