Re-add JEI compat
This commit is contained in:
parent
4e580adee1
commit
252a4559f0
24 changed files with 1271 additions and 2 deletions
|
@ -0,0 +1,41 @@
|
|||
package WayofTime.bloodmagic.compat.jei.orb;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapedBloodOrbRecipe;
|
||||
|
||||
public class ShapedOrbRecipeHandler implements IRecipeHandler<ShapedBloodOrbRecipe>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<ShapedBloodOrbRecipe> getRecipeClass()
|
||||
{
|
||||
return ShapedBloodOrbRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ShapedBloodOrbRecipe recipe)
|
||||
{
|
||||
return new ShapedOrbRecipeJEI(Arrays.asList(recipe.getInput()), recipe.getTier(), recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ShapedBloodOrbRecipe recipe)
|
||||
{
|
||||
return recipe.getInput().length > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package WayofTime.bloodmagic.compat.jei.orb;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ShapedOrbRecipeJEI implements IShapedCraftingRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final List inputs;
|
||||
|
||||
private final int tier;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ShapedOrbRecipeJEI(@Nonnull List input, int tier, @Nonnull ItemStack output)
|
||||
{
|
||||
ArrayList inputList = new ArrayList(input);
|
||||
int replaceIndex = 0;
|
||||
Object toReplace = null;
|
||||
|
||||
for (Object object : inputList)
|
||||
{
|
||||
if (object instanceof Integer)
|
||||
{
|
||||
replaceIndex = inputList.indexOf(object);
|
||||
toReplace = object;
|
||||
}
|
||||
}
|
||||
|
||||
if (toReplace != null)
|
||||
{
|
||||
inputList.remove(replaceIndex);
|
||||
inputList.add(replaceIndex, OrbRegistry.getOrbsDownToTier((Integer) toReplace));
|
||||
}
|
||||
|
||||
this.inputs = inputList;
|
||||
this.tier = tier;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||
{
|
||||
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier);
|
||||
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package WayofTime.bloodmagic.compat.jei.orb;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
|
||||
|
||||
public class ShapelessOrbRecipeHandler implements IRecipeHandler<ShapelessBloodOrbRecipe>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<ShapelessBloodOrbRecipe> getRecipeClass()
|
||||
{
|
||||
return ShapelessBloodOrbRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ShapelessBloodOrbRecipe recipe)
|
||||
{
|
||||
return new ShapelessOrbRecipeJEI(recipe.getInput(), recipe.getTier(), recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ShapelessBloodOrbRecipe recipe)
|
||||
{
|
||||
return recipe.getInput().size() > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package WayofTime.bloodmagic.compat.jei.orb;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class ShapelessOrbRecipeJEI implements ICraftingRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final List inputs;
|
||||
|
||||
private final int tier;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ShapelessOrbRecipeJEI(@Nonnull List input, int tier, @Nonnull ItemStack output)
|
||||
{
|
||||
ArrayList inputList = new ArrayList(input);
|
||||
int replaceIndex = 0;
|
||||
Object toReplace = null;
|
||||
|
||||
for (Object object : inputList)
|
||||
{
|
||||
if (object instanceof Integer)
|
||||
{
|
||||
replaceIndex = inputList.indexOf(object);
|
||||
toReplace = object;
|
||||
}
|
||||
}
|
||||
|
||||
if (toReplace != null)
|
||||
{
|
||||
inputList.remove(replaceIndex);
|
||||
inputList.add(replaceIndex, OrbRegistry.getOrbsDownToTier((Integer) toReplace));
|
||||
}
|
||||
|
||||
this.inputs = inputList;
|
||||
this.tier = tier;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||
{
|
||||
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier);
|
||||
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue