Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.18.1 Problem with GUI] Slot 4 not in valid range

Featured Replies

Posted

--> First, I have to warn you, I am new to coding on java, so if you give me a solution, imagine that you are talking to a guy who has been only making texture packs and nothing else ๐Ÿ˜‡

I just started this mod, following Nico Kaupenjohann's tutorial, and I want to add a new entity block that will have a UI, but every time I right-click on it, it opens up the interface, then 1s later, the game crashes and it reports me this error:

Caused by: java.lang.RuntimeException: Slot 4 not in valid range - [0,4)

I know that this error is due to the fact that my UI has 8 slots and the game somehow considers that there could be only 4, but after a good hour of searching, I couldn't find where the game considers it...

If you have any idea, here is the mod on github:ย https://github.com/AstronoCraft/RocketScienceMod/tree/master

Thank you in advance for any help!

  • Author
6 hours ago, diesieben07 said:

Without having looked at your code (because you have not specified which inventory is the problem): Note that ItemStackHandler saves its size to disk. If you change the size later, it will keep the old size when loaded from disk.

Have you tried starting a new world?

Thank you it works now! ๐Ÿ˜…

Sorry I'm kinda dumb...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.