2015-10-30 20:07:36 +01:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
|
2015-10-30 20:07:36 +01:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-10-30 20:07:36 +01:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-05-16 22:54:42 +02:00
|
|
|
* © 2015-2016 Ellpeck
|
2015-10-30 20:07:36 +01:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
2015-10-30 20:07:36 +01:00
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
2016-01-05 14:57:50 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
2015-10-30 20:07:36 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-10-30 20:07:36 +01:00
|
|
|
|
|
|
|
public class PagePicture extends PageTextOnly{
|
|
|
|
|
2016-05-19 20:05:12 +02:00
|
|
|
private final ResourceLocation resLoc;
|
|
|
|
private final int textStartY;
|
2015-10-30 20:07:36 +01:00
|
|
|
|
|
|
|
public PagePicture(int id, String resLocName, int textStartY){
|
2016-07-31 17:20:49 +02:00
|
|
|
this(id, AssetUtil.getBookletGuiLocation(resLocName), textStartY);
|
|
|
|
}
|
|
|
|
|
|
|
|
public PagePicture(int id, ResourceLocation resLoc, int textStartY){
|
2015-10-30 20:07:36 +01:00
|
|
|
super(id);
|
|
|
|
this.textStartY = textStartY;
|
2016-07-31 17:20:49 +02:00
|
|
|
this.resLoc = resLoc;
|
2015-10-30 20:07:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-11-29 14:30:44 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2016-01-05 14:57:50 +01:00
|
|
|
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
|
|
|
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resLoc);
|
2016-01-06 05:17:54 +01:00
|
|
|
gui.drawRect(gui.getGuiLeft(), gui.getGuiTop(), 0, 0, gui.getXSize(), gui.getYSize());
|
2015-10-30 20:07:36 +01:00
|
|
|
|
2016-05-14 13:51:18 +02:00
|
|
|
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
|
2015-10-30 20:07:36 +01:00
|
|
|
if(text != null && !text.isEmpty()){
|
2016-05-02 17:46:53 +02:00
|
|
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+this.textStartY, 115, 0, false);
|
2015-10-30 20:07:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|