mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
r144
also update jei deprecations
This commit is contained in:
parent
ebda3195bb
commit
6e46026e68
10 changed files with 83 additions and 72 deletions
|
@ -14,7 +14,7 @@ buildscript {
|
|||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'idea'
|
||||
|
||||
version = "1.12.2-r143"
|
||||
version = "1.12.2-r144"
|
||||
group = "de.ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions"
|
||||
|
||||
|
|
|
@ -10,73 +10,74 @@
|
|||
|
||||
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.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BookletRecipeWrapper extends RecipeWrapperWithButton{
|
||||
public class BookletRecipeWrapper extends RecipeWrapperWithButton {
|
||||
|
||||
public final IBookletPage thePage;
|
||||
|
||||
public BookletRecipeWrapper(IBookletPage page){
|
||||
public BookletRecipeWrapper(IBookletPage page) {
|
||||
this.thePage = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients){
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<ItemStack> itemList = new ArrayList<ItemStack>();
|
||||
this.thePage.getItemStacksForPage(itemList);
|
||||
ingredients.setInputs(ItemStack.class, itemList);
|
||||
ingredients.setOutputs(ItemStack.class, itemList);
|
||||
ingredients.setInputs(VanillaTypes.ITEM, itemList);
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, itemList);
|
||||
|
||||
List<FluidStack> fluidList = new ArrayList<FluidStack>();
|
||||
this.thePage.getFluidStacksForPage(fluidList);
|
||||
ingredients.setInputs(FluidStack.class, fluidList);
|
||||
ingredients.setOutputs(FluidStack.class, fluidList);
|
||||
ingredients.setInputs(VanillaTypes.FLUID, fluidList);
|
||||
ingredients.setOutputs(VanillaTypes.FLUID, fluidList);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
int maxLines = 4;
|
||||
IBookletChapter chapter = this.thePage.getChapter();
|
||||
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);
|
||||
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);
|
||||
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++) {
|
||||
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+"Page "+(chapter.getPageIndex(this.thePage)+1), 25, 95, 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);
|
||||
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonX(){
|
||||
public int getButtonX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonY(){
|
||||
public int getButtonY() {
|
||||
return 84;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletPage getPage(){
|
||||
public IBookletPage getPage() {
|
||||
return this.thePage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
|||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -46,13 +47,13 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
|
|||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
for(ItemStack s : ingredient.getInput().getMatchingStacks())
|
||||
list.add(s);
|
||||
for (ItemStack s : ingredient.getInput().getMatchingStacks())
|
||||
list.add(s);
|
||||
list.add(this.cup);
|
||||
list.add(this.coffeeBeans);
|
||||
ingredients.setInputs(ItemStack.class, list);
|
||||
|
||||
ingredients.setOutput(ItemStack.class, this.theOutput);
|
||||
ingredients.setInputs(VanillaTypes.ITEM, list);
|
||||
|
||||
ingredients.setOutput(VanillaTypes.ITEM, this.theOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
|||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -32,8 +33,8 @@ public class CompostRecipeWrapper extends RecipeWrapperWithButton {
|
|||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, Arrays.asList(recipe.getInput().getMatchingStacks()));
|
||||
ingredients.setOutput(ItemStack.class, recipe.getOutput());
|
||||
ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(recipe.getInput().getMatchingStacks()));
|
||||
ingredients.setOutput(VanillaTypes.ITEM, recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,50 +22,51 @@ import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CrusherRecipeWrapper extends RecipeWrapperWithButton{
|
||||
public class CrusherRecipeWrapper extends RecipeWrapperWithButton {
|
||||
|
||||
public final CrusherRecipe theRecipe;
|
||||
|
||||
public CrusherRecipeWrapper(CrusherRecipe recipe){
|
||||
public CrusherRecipeWrapper(CrusherRecipe recipe) {
|
||||
this.theRecipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients){
|
||||
ingredients.setInputs(ItemStack.class, Arrays.asList(theRecipe.getInput().getMatchingStacks()));
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(theRecipe.getInput().getMatchingStacks()));
|
||||
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(this.theRecipe.getOutputOne());
|
||||
if(StackUtil.isValid(this.theRecipe.getOutputTwo())){
|
||||
if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
|
||||
list.add(this.theRecipe.getOutputTwo());
|
||||
}
|
||||
ingredients.setOutputs(ItemStack.class, list);
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||
if(StackUtil.isValid(this.theRecipe.getOutputTwo())){
|
||||
minecraft.fontRenderer.drawString(this.theRecipe.getSecondChance()+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
|
||||
minecraft.fontRenderer.drawString(this.theRecipe.getSecondChance() + "%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||
}
|
||||
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonX(){
|
||||
public int getButtonX() {
|
||||
return -5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonY(){
|
||||
public int getButtonY() {
|
||||
return 26;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletPage getPage(){
|
||||
public IBookletPage getPage() {
|
||||
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,46 +19,47 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
|||
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
|
||||
public class EmpowererRecipeWrapper extends RecipeWrapperWithButton {
|
||||
|
||||
public final EmpowererRecipe theRecipe;
|
||||
|
||||
public EmpowererRecipeWrapper(EmpowererRecipe recipe){
|
||||
public EmpowererRecipeWrapper(EmpowererRecipe recipe) {
|
||||
this.theRecipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients){
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
for(ItemStack s : theRecipe.getInput().getMatchingStacks())
|
||||
for (ItemStack s : theRecipe.getInput().getMatchingStacks())
|
||||
inputs.add(s);
|
||||
for(ItemStack s : theRecipe.getStandOne().getMatchingStacks())
|
||||
for (ItemStack s : theRecipe.getStandOne().getMatchingStacks())
|
||||
inputs.add(s);
|
||||
for(ItemStack s : theRecipe.getStandTwo().getMatchingStacks())
|
||||
for (ItemStack s : theRecipe.getStandTwo().getMatchingStacks())
|
||||
inputs.add(s);
|
||||
for(ItemStack s : theRecipe.getStandThree().getMatchingStacks())
|
||||
for (ItemStack s : theRecipe.getStandThree().getMatchingStacks())
|
||||
inputs.add(s);
|
||||
for(ItemStack s : theRecipe.getStandFour().getMatchingStacks())
|
||||
for (ItemStack s : theRecipe.getStandFour().getMatchingStacks())
|
||||
inputs.add(s);
|
||||
|
||||
ingredients.setInputs(ItemStack.class, inputs);
|
||||
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput());
|
||||
|
||||
ingredients.setInputs(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonX(){
|
||||
public int getButtonX() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getButtonY(){
|
||||
public int getButtonY() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBookletPage getPage(){
|
||||
public IBookletPage getPage() {
|
||||
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockEmpowerer));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,51 +18,52 @@ 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.item.ItemStack;
|
||||
|
||||
public class ReconstructorRecipeCategory implements IRecipeCategory<ReconstructorRecipeWrapper>{
|
||||
public class ReconstructorRecipeCategory implements IRecipeCategory<ReconstructorRecipeWrapper> {
|
||||
|
||||
public static final String NAME = "actuallyadditions.reconstructor";
|
||||
|
||||
private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid(){
|
||||
public String getUid() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(){
|
||||
return StringUtil.localize("container.nei."+NAME+".name");
|
||||
public String getTitle() {
|
||||
return StringUtil.localize("container.nei." + NAME + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModName(){
|
||||
public String getModName() {
|
||||
return ActuallyAdditions.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground(){
|
||||
public IDrawable getBackground() {
|
||||
return this.background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft){
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F);
|
||||
}
|
||||
|
||||
@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().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().set(1, ingredients.getOutputs(ItemStack.class).get(0).get(0));
|
||||
recipeLayout.getItemStacks().set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0).get(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
|||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||
import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -42,8 +43,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton {
|
|||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, Arrays.asList(this.theRecipe.getInput().getMatchingStacks()));
|
||||
ingredients.setOutput(ItemStack.class, this.theRecipe.getOutput());
|
||||
ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.theRecipe.getInput().getMatchingStacks()));
|
||||
ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,8 +87,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton {
|
|||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInput(ItemStack.class, BOOK);
|
||||
ingredients.setOutput(ItemStack.class, OUT);
|
||||
ingredients.setInput(VanillaTypes.ITEM, BOOK);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, OUT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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.
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
1.11.2=110
|
||||
1.12=118
|
||||
1.12.1=121
|
||||
1.12.2=143
|
||||
1.12.2=144
|
Loading…
Reference in a new issue