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.

Featured Replies

Posted

Ok so I'm writing a mod that adds a entity that has its own inventory like the player.  its inventory holds 27 Itemstacks like a chest. now the only way to open this GUI is to be ridding the entity(only why both the client and server can get the inventory instance right now).  now i use

	 
player.openGui(ShurtugalMod.instance, 1, this.worldObj,(int) posX,(int) posY,(int) posZ);

to open the GUI, i don't do anything with x y z because its not a TileEntity.  now that being said when i open the GUI with a keybinding i wrote that tell the server when its clicked from my entity file it opens but when i try to access any of the container slots over id of 45 it crashes giving this error saying that the size of this array-list is only 45

2013-01-10 15:15:17 [iNFO] [sTDERR] Caused by: java.lang.IndexOutOfBoundsException: Index: 56, Size: 45
2013-01-10 15:15:17 [iNFO] [sTDERR] 	at java.util.ArrayList.rangeCheck(ArrayList.java:571)
2013-01-10 15:15:17 [iNFO] [sTDERR] 	at java.util.ArrayList.get(ArrayList.java:349)
2013-01-10 15:15:17 [iNFO] [sTDERR] 	at net.minecraft.inventory.Container.slotClick(Container.java:198)

this is the line it crashes on

 var7 = (Slot)this.inventorySlots.get(par1);

so i decided to see what the size of this array-list was so the line before the crash i added a console print out of "this.inventorySlots.size()" and that returned 63(the number of slots in this gui) like it should be.  so to see if it was because i open it from an entity not a block and that was problem so i quickly mod the GUI open statement for a block i made and so it brings up the same GUI as the dragon like this

Player.openGui(ShurtugalMod.instance, 1, par1World,par2, par3, par4);

and it comes up and works without a problem. im not sure what i did wrong? if anyone could help that would be awesome.

heres all the relevant code, ask if you need anymore

 

IInventory class

 

Reveal hidden contents

 

 

Container Class

 

Reveal hidden contents

 

 

GUI Class(Although this really isnt needed to find the bug, i think?)

 

Reveal hidden contents

 

 

GuiHandler

 

Reveal hidden contents

 

 

Anything else you need just ask

 

 

Thank you for time.

 

  • Author

Heres the full crash Report

 

Reveal hidden contents

 

 

Also i forgot to say im using Forge version 6.5.0.467 for minecraft 1.4.6

I believe the problem is in your container class and registering only 9 of the slots because 36+9=your 45 exception

The Korecraft Mod

  • Author

I found the problem, when i opened it vie dragon i was opening it from server side when all other chests and containers open from client side. Still as always thank you.

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.