First pass at Soul Forge JEI compat
This commit is contained in:
parent
1171861785
commit
f1f8010edc
|
@ -103,6 +103,7 @@ public class Constants
|
|||
public static final String JEI_CATEGORY_ALTAR = Mod.MODID + ":altar";
|
||||
public static final String JEI_CATEGORY_BINDING = Mod.MODID + ":binding";
|
||||
public static final String JEI_CATEGORY_ALCHEMYARRAY = Mod.MODID + ":alchemyArray";
|
||||
public static final String JEI_CATEGORY_SOULFORGE = Mod.MODID + ":soulForge";
|
||||
|
||||
public static final String WAILA_CONFIG_BYPASS_SNEAK = Mod.MODID + ".bypassSneak";
|
||||
public static final String WAILA_CONFIG_ALTAR = Mod.MODID + ".bloodAltar";
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.api.registry;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -10,7 +11,8 @@ import WayofTime.bloodmagic.api.recipe.SoulForgeRecipe;
|
|||
|
||||
public class SoulForgeRecipeRegistry
|
||||
{
|
||||
public static List<SoulForgeRecipe> recipeList = new ArrayList<SoulForgeRecipe>();
|
||||
@Getter
|
||||
private static List<SoulForgeRecipe> recipeList = new ArrayList<SoulForgeRecipe>();
|
||||
|
||||
public static void registerRecipe(SoulForgeRecipe recipe)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,9 @@ import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeMaker;
|
|||
import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeCategory;
|
||||
import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeHandler;
|
||||
import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeMaker;
|
||||
import WayofTime.bloodmagic.compat.jei.forge.SoulForgeRecipeCategory;
|
||||
import WayofTime.bloodmagic.compat.jei.forge.SoulForgeRecipeHandler;
|
||||
import WayofTime.bloodmagic.compat.jei.forge.SoulForgeRecipeMaker;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import mezz.jei.api.*;
|
||||
|
@ -23,27 +26,39 @@ public class BloodMagicPlugin implements IModPlugin
|
|||
@Override
|
||||
public void register(IModRegistry registry)
|
||||
{
|
||||
registry.addRecipeCategories(new AltarRecipeCategory(), new BindingRecipeCategory(), new AlchemyArrayCraftingCategory());
|
||||
registry.addRecipeCategories(
|
||||
new AltarRecipeCategory(),
|
||||
new BindingRecipeCategory(),
|
||||
new AlchemyArrayCraftingCategory(),
|
||||
new SoulForgeRecipeCategory()
|
||||
);
|
||||
|
||||
registry.addRecipeHandlers(new AltarRecipeHandler(), new BindingRecipeHandler(), new AlchemyArrayCraftingRecipeHandler());
|
||||
registry.addRecipeHandlers(
|
||||
new AltarRecipeHandler(),
|
||||
new BindingRecipeHandler(),
|
||||
new AlchemyArrayCraftingRecipeHandler(),
|
||||
new SoulForgeRecipeHandler()
|
||||
);
|
||||
|
||||
registry.addRecipes(AltarRecipeMaker.getRecipes());
|
||||
registry.addRecipes(BindingRecipeMaker.getRecipes());
|
||||
registry.addRecipes(AlchemyArrayCraftingRecipeMaker.getRecipes());
|
||||
registry.addRecipes(SoulForgeRecipeMaker.getRecipes());
|
||||
|
||||
registry.addDescription(new ItemStack(ModItems.altarMaker), "jei.BloodMagic.desc.altarBuilder");
|
||||
|
||||
jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.bloodLight));
|
||||
jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.spectralBlock));
|
||||
jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.phantomBlock));
|
||||
|
||||
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.OWNER_UUID);
|
||||
jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.SOULS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers)
|
||||
{
|
||||
jeiHelper = jeiHelpers;
|
||||
|
||||
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.bloodLight));
|
||||
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.spectralBlock));
|
||||
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.phantomBlock));
|
||||
|
||||
jeiHelpers.getNbtIgnoreList().ignoreNbtTagNames(Constants.NBT.OWNER_UUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package WayofTime.bloodmagic.compat.jei.forge;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SoulForgeRecipeCategory implements IRecipeCategory
|
||||
{
|
||||
private static final int OUTPUT_SLOT = 0;
|
||||
private static final int GEM_SLOT = 1;
|
||||
private static final int INPUT_SLOT = 2;
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/soulForge.png"), 0, 0, 100, 40);
|
||||
@Nonnull
|
||||
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.soulForge");
|
||||
@Nonnull
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
|
||||
public SoulForgeRecipeCategory() {
|
||||
craftingGridHelper = BloodMagicPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
guiItemStacks.init(OUTPUT_SLOT, false, 73, 13);
|
||||
guiItemStacks.init(GEM_SLOT, true, 42, 0);
|
||||
|
||||
for (int y = 0; y < 3; ++y) {
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
int index = INPUT_SLOT + x + (y * 3);
|
||||
guiItemStacks.init(index, true, x * 18, y * 18);
|
||||
}
|
||||
}
|
||||
|
||||
if (recipeWrapper instanceof SoulForgeRecipeJEI) {
|
||||
SoulForgeRecipeJEI recipe = (SoulForgeRecipeJEI) recipeWrapper;
|
||||
guiItemStacks.set(GEM_SLOT, recipe.getValidGems());
|
||||
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs());
|
||||
craftingGridHelper.setInput(guiItemStacks, recipe.getInputs(), 2, 3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package WayofTime.bloodmagic.compat.jei.forge;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SoulForgeRecipeHandler implements IRecipeHandler<SoulForgeRecipeJEI>
|
||||
{
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<SoulForgeRecipeJEI> getRecipeClass()
|
||||
{
|
||||
return SoulForgeRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull SoulForgeRecipeJEI recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull SoulForgeRecipeJEI recipe)
|
||||
{
|
||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package WayofTime.bloodmagic.compat.jei.forge;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.SoulForgeRecipe;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import lombok.Getter;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class SoulForgeRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
@Getter
|
||||
private SoulForgeRecipe recipe;
|
||||
@Getter
|
||||
private Set<ItemStack> validGems = new HashSet<ItemStack>();
|
||||
|
||||
public SoulForgeRecipeJEI(SoulForgeRecipe recipe)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
|
||||
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 0));
|
||||
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 1));
|
||||
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 2));
|
||||
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 3));
|
||||
this.validGems.add(new ItemStack(ModItems.monsterSoul));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public List getInputs()
|
||||
{
|
||||
return recipe.getInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Collections.singletonList(recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
// String minimum = TextHelper.localize("jei.BloodMagic.recipe.minimumSouls", recipe.getMinimumSouls());
|
||||
// String drained = TextHelper.localize("jei.BloodMagic.recipe.soulsDrained", recipe.getSoulsDrained());
|
||||
// minecraft.fontRendererObj.drawString(minimum, 90 - minecraft.fontRendererObj.getStringWidth(minimum) / 2, 0, Color.gray.getRGB());
|
||||
// minecraft.fontRendererObj.drawString(drained, 90 - minecraft.fontRendererObj.getStringWidth(drained) / 2, 10, Color.gray.getRGB());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package WayofTime.bloodmagic.compat.jei.forge;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.SoulForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.SoulForgeRecipeRegistry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SoulForgeRecipeMaker
|
||||
{
|
||||
@Nonnull
|
||||
public static List<SoulForgeRecipeJEI> getRecipes()
|
||||
{
|
||||
List<SoulForgeRecipe> recipeList = SoulForgeRecipeRegistry.getRecipeList();
|
||||
ArrayList<SoulForgeRecipeJEI> recipes = new ArrayList<SoulForgeRecipeJEI>();
|
||||
|
||||
for (SoulForgeRecipe recipe : recipeList)
|
||||
recipes.add(new SoulForgeRecipeJEI(recipe));
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
|
@ -257,13 +257,16 @@ ritual.BloodMagic.jumpRitual=Ritual of the High Jump
|
|||
ritual.BloodMagic.wellOfSufferingRitual=Well of Suffering
|
||||
ritual.BloodMagic.featheredKnifeRitual=Ritual of the Feathered Knife
|
||||
ritual.BloodMagic.regenerationRitual=Ritual of Regeneration
|
||||
ritual.BloodMagic.harvestRitual=Reap of the Harvest Moon
|
||||
|
||||
# Chat
|
||||
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
|
||||
chat.BloodMagic.altarMaker.building=Building a Tier %d Altar
|
||||
chat.BloodMagic.altarMaker.destroy=Destroyed a Tier %d Altar
|
||||
chat.BloodMagic.altarMaker.creativeOnly=This is a creative only item.
|
||||
|
||||
chat.BloodMagic.damageSource=%s's soul became too weak
|
||||
|
||||
chat.BloodMagic.ritual.weak=You feel a push, but are too weak to perform this ritual.
|
||||
chat.BloodMagic.ritual.prevent=The ritual is actively resisting you!
|
||||
chat.BloodMagic.ritual.activate=A rush of energy flows through the ritual!
|
||||
|
@ -277,6 +280,8 @@ jei.BloodMagic.recipe.binding=Binding Ritual
|
|||
jei.BloodMagic.recipe.alchemyArrayCrafting=Alchemy Array
|
||||
jei.BloodMagic.recipe.requiredLP=LP: %d
|
||||
jei.BloodMagic.recipe.requiredTier=Tier: %d
|
||||
jei.BloodMagic.recipe.minimumSouls=Minimum: %d Souls
|
||||
jei.BloodMagic.recipe.soulsDrained=Drained: %d Souls
|
||||
|
||||
jei.BloodMagic.desc.altarBuilder=A creative-only item for use in debugging and testing.\n\nShift + Right click to change the tier to build. Right click an Altar to initiate the build.\n\nBreak an Altar while holding to dismantle it.
|
||||
|
||||
|
|
Loading…
Reference in a new issue