문제

I've searched around the net but can't seem to find quite the answer to my problem. Currently I'm organizing items of an inventory into an array, using the index of the array to generate positions for the GUI whenever the player opens that screen. However when the player moves the item I set the item at the old index in the array to null, which I quickly learned sets the slot item to null as well.

Essentially I just need to figure out how to remove the object from the old position and replace it at a new one. Is this possible?

I've considered switching over the inventory to an ArrayList but it would be nice if I didn't have to as it's structured around the use of an array.

도움이 되었습니까?

해결책

Isn't this why God invented linked lists?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top