2020-09-09 16:48:43 +02:00
|
|
|
package de.ellpeck.actuallyadditions.booklet.page;
|
2016-11-10 21:07:15 +01:00
|
|
|
|
2016-11-12 00:29:01 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
2020-09-09 16:48:43 +02:00
|
|
|
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
|
2016-11-17 18:03:37 +01:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2016-11-12 00:29:01 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraftforge.fml.client.config.GuiUtils;
|
2017-02-18 00:54:58 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2016-11-12 00:29:01 +01:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public class PagePicture extends BookletPage {
|
2016-11-10 21:07:15 +01:00
|
|
|
|
2016-11-12 00:29:01 +01:00
|
|
|
private final ResourceLocation resLoc;
|
|
|
|
private final int yTextOffset;
|
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
|
2016-11-22 22:54:35 +01:00
|
|
|
super(localizationKey, priority);
|
|
|
|
this.resLoc = resLoc;
|
|
|
|
this.yTextOffset = yTextOffset;
|
|
|
|
}
|
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
|
2016-11-10 21:07:15 +01:00
|
|
|
super(localizationKey);
|
2016-11-12 15:13:20 +01:00
|
|
|
this.yTextOffset = yTextOffset;
|
|
|
|
this.resLoc = resLoc;
|
|
|
|
}
|
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
|
2016-11-12 15:13:20 +01:00
|
|
|
this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
|
2016-11-12 00:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-02-18 00:54:58 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2019-05-02 09:10:29 +02:00
|
|
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
2016-11-12 00:29:01 +01:00
|
|
|
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
|
|
|
|
|
|
|
gui.mc.getTextureManager().bindTexture(this.resLoc);
|
2016-11-17 18:03:37 +01:00
|
|
|
|
|
|
|
GlStateManager.pushMatrix();
|
|
|
|
GlStateManager.enableBlend();
|
|
|
|
GlStateManager.disableAlpha();
|
2019-05-02 09:10:29 +02:00
|
|
|
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
|
2016-11-17 18:03:37 +01:00
|
|
|
GlStateManager.disableBlend();
|
|
|
|
GlStateManager.enableAlpha();
|
|
|
|
GlStateManager.popMatrix();
|
2016-11-12 00:29:01 +01:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
|
2016-11-10 21:07:15 +01:00
|
|
|
}
|
|
|
|
}
|