ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/AAScreen.java

48 lines
1.6 KiB
Java

/*
* This file ("GuiWtfMojang.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://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import javax.annotation.Nonnull;
public abstract class AAScreen<T extends Container> extends ContainerScreen<T> {
public AAScreen(T container, PlayerInventory inventory, ITextComponent pTitle) {
super(container, inventory, pTitle);
}
@Override
public void render(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderTooltip(matrixStack, mouseX, mouseY);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
font.draw(matrices, this.title, titleLabelX, titleLabelY, 0xFFFFFF);
}
@Override
protected void init() {
super.init();
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
}