Jump to content

Recommended Posts

Posted

I'm just starting to learn minecraft modding and would like to understand how i can display an empty gui by pressing the key. 

I tried to figure it out myself from the vanilla minecraft code and tutorials, but I could not understand how it all works

Posted

What is an empty gui? If it does not store any information (e.g. inventories, sharing data) a simple screen will work using Minecraft#displayGuiScreen (this is client only).

Otherwise you will need a registered container and screen, and open it with NetworkHooks#openGui (this should be done on server, in this case you send a packet when the key is pressed).

There's a key input event that you can use, or use client tick event to proceed with keybindings (check Minecraft.java).

  • Like 1
Posted

Thanks for the tip. How to make a gui as a standard player inventory for storing resources, but with 1 cell. What i should use? I saw tutorials and people uses tileentity, containers but which of this do I need and what function do they perform. I wanna start with simple things 

Posted (edited)

Thanks for the tips i made a single stack chest. But how i can fix the inventory title pos and how should i call the lang variable to change the  chest name

 forum.PNG.dd1289b617f195a60b1e9f2cb63ba371.PNG

Edited by Klarks
Posted

That's not a problem it was just a placeholder. What i should change or add here i couldn't find anything similar in the vanilla code

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
    this.renderBackground(matrixStack);
    super.render(matrixStack, mouseX, mouseY, partialTicks);
    this.renderHoveredTooltip(matrixStack, mouseX, mouseY);
}
Posted

I fixed by adding this.playerInventoryTitleY = 42;

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
    this.renderBackground(matrixStack);
    //this.playerInventoryTitleX = 10;
    this.playerInventoryTitleY = 42;
    super.render(matrixStack, mouseX, mouseY, partialTicks);
    this.renderHoveredTooltip(matrixStack, mouseX, mouseY);
}

forum.PNG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.