Advertisement
flidiii

Untitled

Feb 20th, 2025
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.44 KB | None | 0 0
  1. package org.example.ecosub;
  2.  
  3. import net.minecraft.world.level.Level;
  4. import net.minecraft.world.entity.player.Player;
  5. import net.minecraft.world.entity.player.Inventory;
  6. import net.minecraft.resources.ResourceLocation;
  7. import net.minecraft.network.chat.Component;
  8. import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
  9. import net.minecraft.client.gui.GuiGraphics;
  10. import com.mojang.blaze3d.systems.RenderSystem;
  11. import java.util.HashMap;
  12.  
  13. public class WalletguiScreen extends AbstractContainerScreen<WalletguiMenu> {
  14.     private final Level world;
  15.     private final int x, y, z;
  16.     private final Player entity;
  17.     private final WalletguiMenu menu;
  18.     private static final ResourceLocation texture = new ResourceLocation("ecosub:textures/screens/walletgui.png");
  19.  
  20.     public WalletguiScreen(WalletguiMenu container, Inventory inventory, Component text) {
  21.         super(container, inventory, text);
  22.         this.menu = container;
  23.         this.world = container.world;
  24.         this.x = container.x;
  25.         this.y = container.y;
  26.         this.z = container.z;
  27.         this.entity = container.entity;
  28.         this.imageWidth = 176;
  29.         this.imageHeight = 166;
  30.     }
  31.  
  32.     @Override
  33.     public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
  34.         this.renderBackground(guiGraphics);
  35.         super.render(guiGraphics, mouseX, mouseY, partialTicks);
  36.         this.renderTooltip(guiGraphics, mouseX, mouseY);
  37.     }
  38.  
  39.     @Override
  40.     protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int gx, int gy) {
  41.         RenderSystem.setShaderColor(1, 1, 1, 1);
  42.         RenderSystem.enableBlend();
  43.         RenderSystem.defaultBlendFunc();
  44.         guiGraphics.blit(texture, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, this.imageWidth, this.imageHeight);
  45.         RenderSystem.disableBlend();
  46.     }
  47.  
  48.     @Override
  49.     public boolean keyPressed(int key, int b, int c) {
  50.         if (key == 256) {
  51.             this.minecraft.player.closeContainer();
  52.             return true;
  53.         }
  54.         return super.keyPressed(key, b, c);
  55.     }
  56.  
  57.     @Override
  58.     protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) {
  59.         guiGraphics.drawString(this.font, Component.translatable("gui.ecosub.walletgui.label_balans", menu.balance), 18, 17, -12829636, false);
  60.     }
  61.  
  62.     @Override
  63.     public void init() {
  64.         super.init();
  65.     }
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement