Jump to content

[1.15.2] Is there a way to add an item to the beacon GUI for my mod?


Lord_DBT

Recommended Posts

I am new to modding and have come across a road block (probably due to my inexperience). I have enabled my modded items to be able to be used as a payment for beacons fine, however I am unable to figure out how to make my custom items appear next to the diamond, iron ingot, gold ingot etc. when looking at the GUI for the beacon. Any help would be appreciated :) 

Link to comment
Share on other sites

  • 1 month later...
On 6/28/2020 at 10:50 PM, ChampionAsh5357 said:

I'm guessing you didn't look at the BeaconScreen code at all. Here's a tidbit:

 [removed code for BeaconScreen#drawGuiContainerBackgroundLayer - diesieben07]

You would just need to adjust the x and y offsets from there.

Thank you that helped a lot! I didn't know how to create events when originally posting this but I learnt the basics and I create GuiOpenEvent that changes the Beacon GUI to my own modified version.

@Mod.EventBusSubscriber(modid = MyMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class ModClientEvents {

    @SubscribeEvent
    public static void onOpenBeacon(GuiOpenEvent event) {
        if(event.getGui() instanceof BeaconScreen) {
            BeaconScreen gui = (BeaconScreen) event.getGui();
            event.setGui(new ModifiedBeaconGui(gui.getContainer(), (PlayerInventory)gui.getListener(), gui.getTitle()));
        }
    }

Yet if there is a better way to do this please share on this post.

I also have updated my mod to 1.16.1 but I am not sure how to edit the topic title.

Link to comment
Share on other sites

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.