2016-11-10 21:07:15 +01:00
|
|
|
/*
|
|
|
|
* This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-11-10 21:07:15 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
|
|
|
|
2016-11-12 00:29:01 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
2017-02-13 14:16:57 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
2016-11-10 21:07:15 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-11-12 00:29:01 +01:00
|
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
|
|
import net.minecraftforge.fml.client.config.GuiUtils;
|
|
|
|
|
2016-11-16 19:08:56 +01:00
|
|
|
import java.util.List;
|
2016-11-12 00:29:01 +01:00
|
|
|
import java.util.Map;
|
2016-11-10 21:07:15 +01:00
|
|
|
|
|
|
|
public class PageFurnace extends BookletPage{
|
|
|
|
|
2016-11-12 00:29:01 +01:00
|
|
|
private final ItemStack input;
|
|
|
|
private final ItemStack output;
|
|
|
|
|
2016-11-10 21:07:15 +01:00
|
|
|
public PageFurnace(int localizationKey, ItemStack output){
|
2016-11-22 22:54:35 +01:00
|
|
|
this(localizationKey, output, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public PageFurnace(int localizationKey, ItemStack output, int priority){
|
|
|
|
super(localizationKey, priority);
|
2016-11-12 00:29:01 +01:00
|
|
|
this.output = output;
|
|
|
|
this.input = getInputForOutput(output);
|
|
|
|
}
|
|
|
|
|
2016-11-16 20:31:16 +01:00
|
|
|
private static ItemStack getInputForOutput(ItemStack output){
|
|
|
|
for(Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()){
|
2017-02-13 14:16:57 +01:00
|
|
|
ItemStack stack = entry.getValue();
|
|
|
|
if(StackUtil.isValid(stack)){
|
|
|
|
if(stack.isItemEqual(output)){
|
|
|
|
return entry.getKey();
|
|
|
|
}
|
2016-11-16 20:31:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-11-12 00:29:01 +01:00
|
|
|
@Override
|
|
|
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
|
|
|
|
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
|
|
|
|
|
|
|
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
|
|
|
GuiUtils.drawTexturedModalRect(startX+23, startY+10, 0, 146, 80, 26, 0);
|
|
|
|
|
2016-12-07 15:25:04 +01:00
|
|
|
gui.renderScaledAsciiString("(Furnace Recipe)", startX+32, startY+42, 0, false, gui.getMediumFontSize());
|
2016-11-12 00:29:01 +01:00
|
|
|
|
|
|
|
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+57);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initGui(GuiBookletBase gui, int startX, int startY){
|
|
|
|
super.initGui(gui, startX, startY);
|
|
|
|
|
|
|
|
gui.addOrModifyItemRenderer(this.input, startX+23+1, startY+10+5, 1F, true);
|
|
|
|
gui.addOrModifyItemRenderer(this.output, startX+23+59, startY+10+5, 1F, false);
|
|
|
|
}
|
|
|
|
|
2016-11-16 19:08:56 +01:00
|
|
|
@Override
|
|
|
|
public void getItemStacksForPage(List<ItemStack> list){
|
|
|
|
super.getItemStacksForPage(list);
|
|
|
|
|
|
|
|
list.add(this.output);
|
|
|
|
}
|
2016-11-10 21:07:15 +01:00
|
|
|
}
|