Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Get All Items From A Inventory/GUI


8iggy
 Share

Recommended Posts

Hello Everyone! I just started learning how to code forge mods and this is my first post. I have been coding spigot plugins for 2 years so I'm not totally clueless. I just want to know how to get all the items from a Inventory/GUI. I have no clue how. I tried something like this. but it got me nowhere

@SubscribeEvent
    public void onOpenInventory(GuiOpenEvent e) {
        
        e.getGui().itemsplsssss

    }

 

Link to comment
Share on other sites

8 hours ago, Luis_ST said:

you can't actually do that, because getGui returns a Screen,
which is client side and the client doesn't know the inventory unless the client is looking at the inventory
you will need the menu (container) which is server side

what do you tried to achieve?

So how do I get the container? It doesn't need to be a event btw.

Link to comment
Share on other sites

19 hours ago, Luis_ST said:

show your code where do you need the items, because the info you gave doesn't help

I currently have no code. Could you just tell me how to get a server sided container/menu and make it into a variable?

Edited by 8iggy
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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello. I was playing in one of my modded worlds and I crash when I threw a trident at a mob and for some reason the game intsantly crashed saying exception ticking world. Im not sure what truly caused it but all I remember was throwing a trident caused the game to crash   Crash Report: https://paste-bin.xyz/35225
    • We tried removing optifine but the recipes still dont show...
    • @SubscribeEvent public static void tickEvent(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = player.world; if(event.phase == TickEvent.Phase.END) { if(event.side.isServer() && ModKeys.mykey.isKeyDown()) { //This player.noClip = true; player.sendPlayerAbilities(); //Non of them work(in the code i dont duplicate them im just showing that i used the 2 combinations) //Or this player.sendPlayerAbilities(); player.noClip = true; } } }  
    • C:\Users\Lorenz\Desktop\KAYN>java -Xmx3000M -jar forge-1.16.5-36.2.0.jar nogui 2022-01-28 20:08:20,278 main WARN Advanced terminal features are not available in this environment [20:08:20] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.0, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [20:08:20] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_321 by Oracle Corporation [20:08:20] [main/INFO] [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [20:08:20] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/C:/Users/Lorenz/Desktop/KAYN/libraries/org/spongepowered/mixin/0.8.2/mixin-0.8.2.jar Service=ModLauncher Env=SERVER [20:08:21] [main/INFO] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlserver' with arguments [--gameDir, ., nogui] Exception in thread "main" [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.NoSuchMethodError: sun.security.util.ManifestEntryVerifier.<init>(Ljava/util/jar/Manifest;)V [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.SecureJarHandler.createCodeSource(SecureJarHandler.java:66) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:275) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:136) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:98) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at java.lang.ClassLoader.loadClass(Unknown Source) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at java.lang.Class.forName0(Native Method) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at java.lang.Class.forName(Unknown Source) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [20:08:21] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) C:\Users\Lorenz\Desktop\KAYN>PAUSE Drücken Sie eine beliebige Taste . . .   HOW CAN I FIX THIS
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.