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

47 lines
1.5 KiB
Java
Raw Normal View History

2015-08-29 23:01:13 +02:00
/*
2016-05-16 22:52:27 +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
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2015-08-29 23:01:13 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-05-16 22:54:42 +02:00
* © 2015-2016 Ellpeck
2015-08-29 23:01:13 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.booklet.page;
2015-08-29 23:01:13 +02: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.StringUtil;
2016-01-05 14:57:50 +01:00
import net.minecraft.client.Minecraft;
2015-08-31 05:44:09 +02:00
import net.minecraft.item.ItemStack;
2016-01-07 18:20:59 +01:00
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
2015-08-29 23:01:13 +02:00
2016-01-05 14:57:50 +01:00
public class PageTextOnly extends BookletPageAA{
2015-08-29 23:01:13 +02:00
2016-06-27 19:32:28 +02:00
private ItemStack[] stacks;
2015-08-31 05:44:09 +02:00
public PageTextOnly(int id){
2015-08-29 23:01:13 +02:00
super(id);
}
2016-06-27 19:32:28 +02:00
public PageTextOnly setStacks(ItemStack... stacks){
this.stacks = stacks;
2015-08-31 05:44:09 +02:00
return this;
}
2015-08-29 23:01:13 +02:00
@Override
@SideOnly(Side.CLIENT)
2016-01-05 14:57:50 +01:00
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
2016-05-14 13:51:18 +02:00
String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
2015-08-30 04:02:28 +02:00
}
2015-08-29 23:01:13 +02:00
}
@Override
public ItemStack[] getItemStacksForPage(){
2016-06-27 19:32:28 +02:00
return this.stacks == null ? new ItemStack[0] : this.stacks;
}
2015-08-29 23:01:13 +02:00
}