2015-09-24 23:42:03 +02:00
|
|
|
/*
|
|
|
|
* This file ("PageCoffeeRecipe.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2015-11-02 20:55:19 +01:00
|
|
|
* © 2015 Ellpeck
|
2015-09-24 23:42:03 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package ellpeck.actuallyadditions.booklet.page;
|
|
|
|
|
|
|
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
|
|
|
import ellpeck.actuallyadditions.items.InitItems;
|
|
|
|
import ellpeck.actuallyadditions.items.ItemCoffee;
|
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
2015-10-23 23:08:53 +02:00
|
|
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
2015-09-24 23:42:03 +02:00
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
public class PageCoffeeRecipe extends BookletPage{
|
|
|
|
|
|
|
|
public ItemCoffee.Ingredient ingredient;
|
|
|
|
|
|
|
|
public PageCoffeeRecipe(int id, ItemCoffee.Ingredient ingredient){
|
|
|
|
super(id);
|
|
|
|
this.ingredient = ingredient;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-10-04 13:21:07 +02:00
|
|
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
2015-10-23 23:08:53 +02:00
|
|
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
2015-09-24 23:42:03 +02:00
|
|
|
gui.drawTexturedModalRect(gui.guiLeft+19, gui.guiTop+20, 146, 94, 99, 60);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
2015-10-04 13:21:07 +02:00
|
|
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
2015-09-24 23:42:03 +02:00
|
|
|
String strg = "Coffee Machine Recipe";
|
2015-10-03 19:19:26 +02:00
|
|
|
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
2015-09-24 23:42:03 +02:00
|
|
|
|
|
|
|
String text = gui.currentPage.getText();
|
|
|
|
if(text != null && !text.isEmpty()){
|
2015-10-03 19:19:26 +02:00
|
|
|
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
2015-09-24 23:42:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(this.ingredient.maxAmplifier > 0){
|
2015-10-03 19:19:26 +02:00
|
|
|
gui.mc.fontRenderer.drawString("Maximum Amplifier: "+this.ingredient.maxAmplifier, gui.guiLeft+19+5, gui.guiTop+20+60, 0);
|
2015-09-24 23:42:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < 2; i++){
|
|
|
|
for(int j = 0; j < 4; j++){
|
|
|
|
ItemStack stack;
|
|
|
|
int coordsOffsetX;
|
|
|
|
int coordsOffsetY;
|
|
|
|
|
|
|
|
switch(j){
|
|
|
|
case 0:
|
|
|
|
stack = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
|
|
|
coordsOffsetX = 39;
|
|
|
|
coordsOffsetY = 8;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
stack = new ItemStack(InitItems.itemCoffeeBean);
|
|
|
|
coordsOffsetX = 5;
|
|
|
|
coordsOffsetY = 8;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
stack = new ItemStack(InitItems.itemCoffee);
|
|
|
|
ItemCoffee.addEffectToStack(stack, this.ingredient);
|
|
|
|
coordsOffsetX = 39;
|
|
|
|
coordsOffsetY = 39;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stack = this.ingredient.ingredient;
|
|
|
|
coordsOffsetX = 82;
|
|
|
|
coordsOffsetY = 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(stack != null){
|
2015-10-03 10:16:18 +02:00
|
|
|
if(stack.getItemDamage() == Util.WILDCARD){
|
|
|
|
stack.setItemDamage(0);
|
|
|
|
}
|
2015-09-24 23:42:03 +02:00
|
|
|
|
|
|
|
boolean tooltip = i == 1;
|
|
|
|
|
|
|
|
int xShow = gui.guiLeft+19+coordsOffsetX;
|
|
|
|
int yShow = gui.guiTop+20+coordsOffsetY;
|
|
|
|
if(!tooltip){
|
|
|
|
renderItem(gui, stack, xShow, yShow, 1.0F);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){
|
2015-10-04 13:21:07 +02:00
|
|
|
this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j != 2, mousePressed);
|
2015-09-24 23:42:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|