ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/booklet/page/PageTextOnly.java

47 lines
1.4 KiB
Java
Raw Normal View History

2015-08-29 23:01:13 +02:00
/*
2015-09-22 23:39:25 +02:00
* This file ("PageTextOnly.java") is part of the Actually Additions Mod for Minecraft.
2015-08-29 23:01:13 +02:00
* 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-08-29 23:01:13 +02:00
*/
2015-12-30 22:02:15 +01:00
package de.ellpeck.actuallyadditions.booklet.page;
2015-08-29 23:01:13 +02:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2015-12-30 22:02:15 +01:00
import de.ellpeck.actuallyadditions.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.util.StringUtil;
2015-08-31 05:44:09 +02:00
import net.minecraft.item.ItemStack;
2015-08-29 23:01:13 +02:00
public class PageTextOnly extends BookletPage{
2015-08-29 23:01:13 +02:00
2015-08-31 05:44:09 +02:00
private ItemStack stack;
public PageTextOnly(int id){
2015-08-29 23:01:13 +02:00
super(id);
}
public PageTextOnly setStack(ItemStack stack){
2015-08-31 05:44:09 +02:00
this.stack = stack;
2015-10-30 21:42:14 +01:00
this.addToPagesWithItemStackData();
2015-08-31 05:44:09 +02:00
return this;
}
2015-12-01 19:48:09 +01:00
@Override
public ItemStack[] getItemStacksForPage(){
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
}
2015-08-29 23:01:13 +02:00
@Override
@SideOnly(Side.CLIENT)
2015-10-04 13:21:07 +02:00
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
String text = gui.currentEntrySet.page.getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(gui.mc.fontRenderer, text, gui.guiLeft+14, gui.guiTop+9, 115, 0, false);
2015-08-30 04:02:28 +02:00
}
2015-08-29 23:01:13 +02:00
}
}