mailbox gui texture

This commit is contained in:
DaniTheSkunk 2022-10-31 23:55:56 +00:00
parent 5330dd2b4e
commit ecce95c09f
2 changed files with 21 additions and 1 deletions

View File

@ -1,21 +1,41 @@
package com.danitheskunk.skunkstuff.Blocks;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.HopperScreen;
import net.minecraft.client.gui.screens.inventory.ShulkerBoxScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
@Environment(EnvType.CLIENT)
public class ScreenMailbox extends AbstractContainerScreen<MenuMailbox> {
private static final ResourceLocation LOCATION =
new ResourceLocation(Blocks.namespace,
"textures/gui/container/mailbox.png");
public ScreenMailbox(MenuMailbox handler, Inventory inventory, Component title) {
super(handler, inventory, title);
}
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
this.renderTooltip(matrices, mouseX, mouseY);
}
@Override
protected void renderBg(PoseStack matrices, float delta, int mouseX,
int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, LOCATION);
int i = (this.width - this.imageWidth) / 2;
int j = (this.height - this.imageHeight) / 2;
this.blit(matrices, i, j, 0, 0, this.imageWidth, this.imageHeight);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB