also update jei deprecations
This commit is contained in:
Shadows_of_Fire 2018-12-11 01:18:31 -05:00
parent ebda3195bb
commit 6e46026e68
10 changed files with 83 additions and 72 deletions

View file

@ -14,7 +14,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea' apply plugin: 'idea'
version = "1.12.2-r143" version = "1.12.2-r144"
group = "de.ellpeck.actuallyadditions" group = "de.ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"

View file

@ -10,73 +10,74 @@
package de.ellpeck.actuallyadditions.mod.jei.booklet; package de.ellpeck.actuallyadditions.mod.jei.booklet;
import java.util.ArrayList;
import java.util.List;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList; public class BookletRecipeWrapper extends RecipeWrapperWithButton {
import java.util.List;
public class BookletRecipeWrapper extends RecipeWrapperWithButton{
public final IBookletPage thePage; public final IBookletPage thePage;
public BookletRecipeWrapper(IBookletPage page){ public BookletRecipeWrapper(IBookletPage page) {
this.thePage = page; this.thePage = page;
} }
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients) {
List<ItemStack> itemList = new ArrayList<ItemStack>(); List<ItemStack> itemList = new ArrayList<ItemStack>();
this.thePage.getItemStacksForPage(itemList); this.thePage.getItemStacksForPage(itemList);
ingredients.setInputs(ItemStack.class, itemList); ingredients.setInputs(VanillaTypes.ITEM, itemList);
ingredients.setOutputs(ItemStack.class, itemList); ingredients.setOutputs(VanillaTypes.ITEM, itemList);
List<FluidStack> fluidList = new ArrayList<FluidStack>(); List<FluidStack> fluidList = new ArrayList<FluidStack>();
this.thePage.getFluidStacksForPage(fluidList); this.thePage.getFluidStacksForPage(fluidList);
ingredients.setInputs(FluidStack.class, fluidList); ingredients.setInputs(VanillaTypes.FLUID, fluidList);
ingredients.setOutputs(FluidStack.class, fluidList); ingredients.setOutputs(VanillaTypes.FLUID, fluidList);
} }
@Override @Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
List<String> header = minecraft.fontRenderer.listFormattedStringToWidth(StringUtil.localize("container.nei."+ActuallyAdditions.MODID+".booklet.header").replaceAll("<item>", TextFormatting.BLUE+"").replaceAll("<r>", TextFormatting.BLACK+""), 150); List<String> header = minecraft.fontRenderer.listFormattedStringToWidth(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".booklet.header").replaceAll("<item>", TextFormatting.BLUE + "").replaceAll("<r>", TextFormatting.BLACK + ""), 150);
for(int i = 0; i < header.size(); i++){ for (int i = 0; i < header.size(); i++) {
minecraft.fontRenderer.drawString((String)header.get(i), 0, 17+i*(minecraft.fontRenderer.FONT_HEIGHT+1), 0, false); minecraft.fontRenderer.drawString((String) header.get(i), 0, 17 + i * (minecraft.fontRenderer.FONT_HEIGHT + 1), 0, false);
} }
int maxLines = 4; int maxLines = 4;
IBookletChapter chapter = this.thePage.getChapter(); IBookletChapter chapter = this.thePage.getChapter();
String aText = chapter.getAllPages()[0].getInfoText(); String aText = chapter.getAllPages()[0].getInfoText();
List<String> text = minecraft.fontRenderer.listFormattedStringToWidth(aText != null ? aText : TextFormatting.DARK_RED+StringUtil.localize("container.nei."+ActuallyAdditions.MODID+".booklet.noText"), 150); List<String> text = minecraft.fontRenderer.listFormattedStringToWidth(aText != null ? aText : TextFormatting.DARK_RED + StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".booklet.noText"), 150);
for(int i = 0; i < Math.min(maxLines, text.size()); i++){ for (int i = 0; i < Math.min(maxLines, text.size()); i++) {
minecraft.fontRenderer.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? TextFormatting.RESET+""+TextFormatting.BLACK+"..." : ""), 0, 16+25+i*(minecraft.fontRenderer.FONT_HEIGHT+1), 0, false); minecraft.fontRenderer.drawString(text.get(i) + (i == maxLines - 1 && text.size() > maxLines ? TextFormatting.RESET + "" + TextFormatting.BLACK + "..." : ""), 0, 16 + 25 + i * (minecraft.fontRenderer.FONT_HEIGHT + 1), 0, false);
} }
minecraft.fontRenderer.drawString(TextFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false); minecraft.fontRenderer.drawString(TextFormatting.ITALIC + chapter.getLocalizedName(), 25, 85, 0, false);
minecraft.fontRenderer.drawString(TextFormatting.ITALIC+"Page "+(chapter.getPageIndex(this.thePage)+1), 25, 95, 0, false); minecraft.fontRenderer.drawString(TextFormatting.ITALIC + "Page " + (chapter.getPageIndex(this.thePage) + 1), 25, 95, 0, false);
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
} }
@Override @Override
public int getButtonX(){ public int getButtonX() {
return 0; return 0;
} }
@Override @Override
public int getButtonY(){ public int getButtonY() {
return 84; return 84;
} }
@Override @Override
public IBookletPage getPage(){ public IBookletPage getPage() {
return this.thePage; return this.thePage;
} }
} }

View file

@ -26,6 +26,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -46,13 +47,13 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
@Override @Override
public void getIngredients(IIngredients ingredients) { public void getIngredients(IIngredients ingredients) {
List<ItemStack> list = new ArrayList<>(); List<ItemStack> list = new ArrayList<>();
for(ItemStack s : ingredient.getInput().getMatchingStacks()) for (ItemStack s : ingredient.getInput().getMatchingStacks())
list.add(s); list.add(s);
list.add(this.cup); list.add(this.cup);
list.add(this.coffeeBeans); list.add(this.coffeeBeans);
ingredients.setInputs(ItemStack.class, list); ingredients.setInputs(VanillaTypes.ITEM, list);
ingredients.setOutput(ItemStack.class, this.theOutput); ingredients.setOutput(VanillaTypes.ITEM, this.theOutput);
} }
@Override @Override

View file

@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -32,8 +33,8 @@ public class CompostRecipeWrapper extends RecipeWrapperWithButton {
@Override @Override
public void getIngredients(IIngredients ingredients) { public void getIngredients(IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Arrays.asList(recipe.getInput().getMatchingStacks())); ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(recipe.getInput().getMatchingStacks()));
ingredients.setOutput(ItemStack.class, recipe.getOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getOutput());
} }
@Override @Override

View file

@ -22,50 +22,51 @@ import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class CrusherRecipeWrapper extends RecipeWrapperWithButton{ public class CrusherRecipeWrapper extends RecipeWrapperWithButton {
public final CrusherRecipe theRecipe; public final CrusherRecipe theRecipe;
public CrusherRecipeWrapper(CrusherRecipe recipe){ public CrusherRecipeWrapper(CrusherRecipe recipe) {
this.theRecipe = recipe; this.theRecipe = recipe;
} }
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Arrays.asList(theRecipe.getInput().getMatchingStacks())); ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(theRecipe.getInput().getMatchingStacks()));
List<ItemStack> list = new ArrayList<>(); List<ItemStack> list = new ArrayList<>();
list.add(this.theRecipe.getOutputOne()); list.add(this.theRecipe.getOutputOne());
if(StackUtil.isValid(this.theRecipe.getOutputTwo())){ if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
list.add(this.theRecipe.getOutputTwo()); list.add(this.theRecipe.getOutputTwo());
} }
ingredients.setOutputs(ItemStack.class, list); ingredients.setOutputs(VanillaTypes.ITEM, list);
} }
@Override @Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
if(StackUtil.isValid(this.theRecipe.getOutputTwo())){ if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
minecraft.fontRenderer.drawString(this.theRecipe.getSecondChance()+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); minecraft.fontRenderer.drawString(this.theRecipe.getSecondChance() + "%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
} }
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
} }
@Override @Override
public int getButtonX(){ public int getButtonX() {
return -5; return -5;
} }
@Override @Override
public int getButtonY(){ public int getButtonY() {
return 26; return 26;
} }
@Override @Override
public IBookletPage getPage(){ public IBookletPage getPage() {
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockGrinder)); return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
} }
} }

View file

@ -19,46 +19,47 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton {
public final EmpowererRecipe theRecipe; public final EmpowererRecipe theRecipe;
public EmpowererRecipeWrapper(EmpowererRecipe recipe){ public EmpowererRecipeWrapper(EmpowererRecipe recipe) {
this.theRecipe = recipe; this.theRecipe = recipe;
} }
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients) {
List<ItemStack> inputs = new ArrayList<>(); List<ItemStack> inputs = new ArrayList<>();
for(ItemStack s : theRecipe.getInput().getMatchingStacks()) for (ItemStack s : theRecipe.getInput().getMatchingStacks())
inputs.add(s); inputs.add(s);
for(ItemStack s : theRecipe.getStandOne().getMatchingStacks()) for (ItemStack s : theRecipe.getStandOne().getMatchingStacks())
inputs.add(s); inputs.add(s);
for(ItemStack s : theRecipe.getStandTwo().getMatchingStacks()) for (ItemStack s : theRecipe.getStandTwo().getMatchingStacks())
inputs.add(s); inputs.add(s);
for(ItemStack s : theRecipe.getStandThree().getMatchingStacks()) for (ItemStack s : theRecipe.getStandThree().getMatchingStacks())
inputs.add(s); inputs.add(s);
for(ItemStack s : theRecipe.getStandFour().getMatchingStacks()) for (ItemStack s : theRecipe.getStandFour().getMatchingStacks())
inputs.add(s); inputs.add(s);
ingredients.setInputs(ItemStack.class, inputs); ingredients.setInputs(VanillaTypes.ITEM, inputs);
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput()); ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput());
} }
@Override @Override
public int getButtonX(){ public int getButtonX() {
return 2; return 2;
} }
@Override @Override
public int getButtonY(){ public int getButtonY() {
return 2; return 2;
} }
@Override @Override
public IBookletPage getPage(){ public IBookletPage getPage() {
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockEmpowerer)); return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockEmpowerer));
} }
} }

View file

@ -18,51 +18,52 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ReconstructorRecipeCategory implements IRecipeCategory<ReconstructorRecipeWrapper>{ public class ReconstructorRecipeCategory implements IRecipeCategory<ReconstructorRecipeWrapper> {
public static final String NAME = "actuallyadditions.reconstructor"; public static final String NAME = "actuallyadditions.reconstructor";
private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor); private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor);
private final IDrawable background; private final IDrawable background;
public ReconstructorRecipeCategory(IGuiHelper helper){ public ReconstructorRecipeCategory(IGuiHelper helper) {
this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60); this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60);
} }
@Override @Override
public String getUid(){ public String getUid() {
return NAME; return NAME;
} }
@Override @Override
public String getTitle(){ public String getTitle() {
return StringUtil.localize("container.nei."+NAME+".name"); return StringUtil.localize("container.nei." + NAME + ".name");
} }
@Override @Override
public String getModName(){ public String getModName() {
return ActuallyAdditions.NAME; return ActuallyAdditions.NAME;
} }
@Override @Override
public IDrawable getBackground(){ public IDrawable getBackground() {
return this.background; return this.background;
} }
@Override @Override
public void drawExtras(Minecraft minecraft){ public void drawExtras(Minecraft minecraft) {
AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F); AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F);
} }
@Override @Override
public void setRecipe(IRecipeLayout recipeLayout, ReconstructorRecipeWrapper wrapper, IIngredients ingredients){ public void setRecipe(IRecipeLayout recipeLayout, ReconstructorRecipeWrapper wrapper, IIngredients ingredients) {
recipeLayout.getItemStacks().init(0, true, 4, 18); recipeLayout.getItemStacks().init(0, true, 4, 18);
recipeLayout.getItemStacks().set(0, ingredients.getInputs(ItemStack.class).get(0).get(0)); recipeLayout.getItemStacks().set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0).get(0));
recipeLayout.getItemStacks().init(1, false, 66, 18); recipeLayout.getItemStacks().init(1, false, 66, 18);
recipeLayout.getItemStacks().set(1, ingredients.getOutputs(ItemStack.class).get(0).get(0)); recipeLayout.getItemStacks().set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0).get(0));
} }
} }

View file

@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion; import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapperFactory; import mezz.jei.api.recipe.IRecipeWrapperFactory;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -42,8 +43,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton {
@Override @Override
public void getIngredients(IIngredients ingredients) { public void getIngredients(IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Arrays.asList(this.theRecipe.getInput().getMatchingStacks())); ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.theRecipe.getInput().getMatchingStacks()));
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput()); ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput());
} }
@Override @Override
@ -86,8 +87,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton {
@Override @Override
public void getIngredients(IIngredients ingredients) { public void getIngredients(IIngredients ingredients) {
ingredients.setInput(ItemStack.class, BOOK); ingredients.setInput(VanillaTypes.ITEM, BOOK);
ingredients.setOutput(ItemStack.class, OUT); ingredients.setOutput(VanillaTypes.ITEM, OUT);
} }
} }

View file

@ -1,3 +1,7 @@
# 1.12.2-r144
* Phantom Breakers should function properly again.
* Greenhouse Glass functions again (wasn't broken, but it works now)
# 1.12.2-r143 # 1.12.2-r143
* Greenhouse Glass will now work with any non-opaque block below it, instead of only air below it. Yes, this means they can stack. * Greenhouse Glass will now work with any non-opaque block below it, instead of only air below it. Yes, this means they can stack.
* Greenhouse Glass should no longer crash if it is over the void. * Greenhouse Glass should no longer crash if it is over the void.

View file

@ -8,4 +8,4 @@
1.11.2=110 1.11.2=110
1.12=118 1.12=118
1.12.1=121 1.12.1=121
1.12.2=143 1.12.2=144