Jump to content

item in hotbar checker (idk how to phrase it)


vanilla______

Recommended Posts

2 hours ago, vanilla______ said:

but I have no Idea what to do from here. thx for the help.

I think you should check the slots one by one. an example would be a for-loop (which checks the first 9 slots for obsidian 0-8 that would be the hotbar slots).

note: if you want to change something in the inventory you cannot use Minecraft#getInstance#player because you get a client player here

Link to comment
Share on other sites

7 hours ago, Luis_ST said:

I think you should check the slots one by one. an example would be a for-loop (which checks the first 9 slots for obsidian 0-8 that would be the hotbar slots).

note: if you want to change something in the inventory you cannot use Minecraft#getInstance#player because you get a client player here

yeah, but my problem rn is more of what obsidian is, like what do I put inside the for(___)?

Link to comment
Share on other sites

14 hours ago, Luis_ST said:

I think you should check the slots one by one. an example would be a for-loop (which checks the first 9 slots for obsidian 0-8 that would be the hotbar slots).

note: if you want to change something in the inventory you cannot use Minecraft#getInstance#player because you get a client player here

how would I do that in a for loop, I tried to solo it but i'm dum so I only got this

		for(int i = 0; i<9; i++) {
			
			I++;
			if(mc.player.inventory.getStackInSlot(I) == obi) {
				System.out.print("workin fine :D");
				Debug.log("workin fine :D");
			}
		}

note: i isn't I, I is a int I made for this

Link to comment
Share on other sites

(1) Why are i and I not the same variable. Please explain this.

(2) Items are not Blocks, ItemStacks are not Items.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

18 minutes ago, vanilla______ said:

(1) i is a generic integer, capital I is not, so I made an int I because it was simple and easy to remember

?????

18 minutes ago, vanilla______ said:

(2) I know, I assume getSTACKinslot would use an itemstack, I made a new itemstack(Blocks.OBSIDIAN) and named it obi.

then the Item Stacks would never be the same, since they're different instances, get the item from the player's inventory item stack, and then check if it matches against the instance of the item you want

Edited by kiou.23
Link to comment
Share on other sites

1 hour ago, kiou.23 said:

?????

then the Item Stacks would never be the same, since they're different instances, get the item from the player's inventory item stack, and then check if it matches against the instance of the item you want

1 if I use i as an intiger, it create a new thing i bcs it's just what java does, if i use CAPITAL I it doesn't and I can use my custom variable

2 that's what it does (I think), it gets the stack in slot I, which will increase 9 times from 0-8, and then it sees if it's equal to "obi" aka new ItemStack(Blocks.OBSIDIAN)

Link to comment
Share on other sites

5 minutes ago, vanilla______ said:

1 if I use i as an intiger, it create a new thing i bcs it's just what java does, if i use CAPITAL I it doesn't and I can use my custom variable

????

5 minutes ago, vanilla______ said:

2 that's what it does (I think), it gets the stack in slot I, which will increase 9 times from 0-8, and then it sees if it's equal to "obi" aka new ItemStack(Blocks.OBSIDIAN)

that's not what I said, I explained why what you're doing won't work, and what you need to do

Link to comment
Share on other sites

1 let's just ignore the first point it doesn't matter

2 well I don't know what your saying then, it seems like I'm doing what you said but I guess i'm not, could you go into a bit more detail thx, specifically wdym by "instances", thx.

10 minutes ago, kiou.23 said:

????

that's not what I said, I explained why what you're doing won't work, and what you need to do

 

Link to comment
Share on other sites

12 minutes ago, vanilla______ said:

1 let's just ignore the first point it doesn't matter

I'm trying to understand what's the difference between using i and I... i seems to accomplish the same thing that I does, logically

 

edit: and ooops, accidentally send it, so I'm going to have to reply point 2 in another message

Edited by kiou.23
Link to comment
Share on other sites

13 minutes ago, vanilla______ said:

2 well I don't know what your saying then

Item Stacks and Items are different things

14 minutes ago, vanilla______ said:

it seems like I'm doing what you said but I guess i'm not

 

correct, you're not, you're instantiating a new Item Stack and seeing if it is the same as another one, that's not the same as checking if the item from one item stack matches the static instance of the item that you want

15 minutes ago, vanilla______ said:

could you go into a bit more detail thx, specifically wdym by "instances", thx.

I shouldn't have too, instance are basic OOP, which you are expected to know

in short: any time you use the keyword "new" to create a new variable, you are instantiating a class, therefore: an instance. what the player has in his inventory is an instance of the ItemStack class. what you want (and this is what I said), to check if the Item in the ItemStack is the Item that you're looking for

Link to comment
Share on other sites

3 hours ago, vanilla______ said:

2 well I don't know what your saying then, it seems like I'm doing what you said but I guess i'm not, could you go into a bit more detail thx, specifically wdym by "instances", thx.

Lets say you buy a book on Amazon. And then you order a second copy.

When they arrive you place one on your coffee table and one in your bookshelf.

Are they the same object?

No, of course not, you have TWO books. The one on your coffee table is definitely not the same one on your bookshelf. They are identical but they are not the same object. They are two different instances of that book.

The itemstack in the player's inventory is the book on the bookshelf.
The itemstack you created in your code is the book on the coffee table.
And you just asked you if the two stacks are the same object.

Only what you're trying to do is go through your bookshelf and find the other copy of the book that is on your coffee table. So how would you do that? By reading the titles.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

5 minutes ago, Draco18s said:

Lets say you buy a book on Amazon. And then you order a second copy.

When they arrive you place one on your coffee table and one in your bookshelf.

Are they the same object?

No, of course not, you have TWO books. The one on your coffee table is definitely not the same one on your bookshelf. They are identical but they are not the same object. They are two different instances of that book.

The itemstack in the player's inventory is the book on the bookshelf.
The itemstack you created in your code is the book on the coffee table.
And you just asked you if the two stacks are the same object.

Only what you're trying to do is go through your bookshelf and find the other copy of the book that is on your coffee table. So how would you do that? By reading the titles.

thx for clarifying

Link to comment
Share on other sites

7 minutes ago, vanilla______ said:

kiuo.23 When you use i, it won't use a variable called i, it will create a new intiger because i is what a new intiger is called, it's just a throwaway, Capital I is not i, so it won't create a new variable and will use a variable that is called I.

that's highly incorrect, where did you learn this?

"i" is, in this case, a variable defined in the for loop, for each time the for loop runs, "i" will get incremented by one. it is a variable like any other, there's nothing special about it

Edited by kiou.23
Link to comment
Share on other sites

47 minutes ago, kiou.23 said:

that's highly incorrect, where did you learn this?

"i" is, in this case, a variable defined in the for loop, for each time the for loop runs, "i" will get incremented by one. it is a variable like any other, there's nothing special about it

just did some experimenting realized what's happening, your right.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 시흥카바레 ♠BCGAME88·COM¶ 오장카바레 권농카바레 무학카바레 재동카바레 xyy09 이태원카바레 석관카바레 삼청카바레 서귀포카바레 yoq07 무악카바레 시흥카바레 봉원카바레 신수카바레 dwi25 마천카바레 구기카바레 와룡카바레 창신카바레 lvf01 인천카바레 함안카바레 여주카바레 창녕카바레 pln98 답십리카바레 남대문카바레 아산카바레 홍파카바레 msf33 개포카바레 본동카바레 영암카바레 신교카바레 wcc84 거여카바레 천연카바레 여주카바레 시흥카바레 que29 수색카바레 대현카바레 통의카바레 한남카바레 fci01 무교카바레 의왕카바레 장위카바레 의왕카바레 lly55 갈현카바레 서린카바레 예산카바레 이화카바레 hbb33 문래카바레 이화카바레 고척카바레 중곡카바레 vbn29 거창카바레 수서카바레 남대문카바레 개화카바레 xse24 명륜카바레 홍익카바레 신창카바레 장충카바레 ler32 흑석카바레 신내카바레 평창카바레 공평카바레 hmv56 대조카바레 삼성카바레 청파카바레 순천카바레 wbv78 장안카바레 예산카바레 남창카바레 운니카바레 vgr40 신당카바레 장위카바레 도렴카바레 송현카바레 vym21 부천카바레 풍납카바레 다동카바레 주교카바레 owo86 갈현카바레 은평카바레 삼척카바레 주교카바레 ghm23 암사카바레 명동카바레 대현카바레 여주카바레 wsp71 석관카바레 삼성카바레 쌍문카바레 김포카바레 dvk55 하계카바레 세종로카바레 응봉카바레 송파카바레 yqp57
    • 실시간 챔피언리그 추천@BCGAME88·COM♤ 네팔 챔피언리그 커뮤니티 실시간 아이티 챔피언리그 쿠푼 [본사문의 텔레 JBOX7]실시간 챔피언리그 ♡♧ 본사 레소토 챔피언리그 포커대회 실시간 방글라데시 실시간 챔피언리그 주소 [총판문의 카톡 JBOX7]실시간 챔피언리그 ○& 홀덤펍 동아시아 챔피언리그 중계 실시간 러시아 실시간 챔피언리그 도박장 [각종 오피 커뮤니티 제작]실시간 챔피언리그 ▶† 모집 폭스우드카지노 챔피언리그 총판 실시간 스웨덴 실시간 챔피언리그 캐쉬게임 [마케팅문의]실시간 챔피언리그 ▷* 주소 북아메리카 챔피언리그 경기 실시간 스페인 실시간 챔피언리그 사이트 [카지노본사]실시간 챔피언리그 ☞▦ 동영상 볼리비아 챔피언리그 홀덤펍 실시간 기니비사우 실시간 챔피언리그 단톡방 [스포츠본사]실시간 챔피언리그 ☎↗ 사이트 태국 챔피언리그 단톡방 실시간 북마케도니아 실시간 챔피언리그 접속 [토토본사 문의]실시간 챔피언리그 ♩△ 도박장 통가 챔피언리그 사이트 실시간 트럼프타지마할카지노 실시간 챔피언리그 놀이터 [토토총판 구매]실시간 챔피언리그 ♬〓 놀이터 코트디부아르 챔피언리그 쿠푼 실시간 이집트 실시간 챔피언리그 중계 [카지노총판]실시간 챔피언리그 □△ 총판 싱가포르 챔피언리그 검증 실시간 아르메니아 실시간 챔피언리그 투어 [야마토본사]실시간 챔피언리그 ♠▷ 경기 포르투갈 챔피언리그 싸이트 실시간 파라과이 실시간 챔피언리그 리그 [바카라총판]실시간 챔피언리그 ♠▲ 투어 샌즈카지노 챔피언리그 리그 실시간 잠비아 실시간 챔피언리그 방송 [경마총판]이비자그란카지노 챔피언리그 유투브 에콰도르 챔피언리그 영상 [BCGAME 비씨게임 총판문의]알림 설정 추천 구독 좋아요
    • 코후 대딸방 라인 ◎BCGAME88·COM▩ 코후 대딸방 동호회 다이빙 코후 대딸방 오픈채팅 쇼트트랙 대딸방 스토리 수구 대딸방 틱톡[본사문의 텔레 @JBOX7] 코후 대딸방 틱톡 링 코후 대딸방 위치 피겨 대딸방 동영상 스쿼시 대딸방 사이트[총판문의 카톡 JBOX7] 코후 대딸방 링크 양궁 코후 대딸방 틱톡 권투 대딸방 모임 정보 수구 대딸방 사이트[각종 오피 커뮤니티 제작] 코후 대딸방 방송 조정 코후 대딸방 유투브 펜싱 대딸방 방송 장대높이뛰기 대딸방 카카오톡[마케팅문의] 코후 대딸방 야동 올림픽 코후 대딸방 업소모집 수구 대딸방 방송 안마 대딸방 총판 [카지노본사] 코후 대딸방 틱톡 온라인게임 코후 대딸방 링크 리얼 대딸방 링크 온라인게임 대딸방 모임 정보 [스포츠본사] 코후 대딸방 이야기 수구 코후 대딸방 새주소 복싱 대딸방 텔레그램 하키 대딸방 시스템[토토본사 문의] 코후 대딸방 틱톡 기계체조 코후 대딸방 라인 승마 대딸방 업소모집 스키 대딸방 시스템 [토토총판 구매] 코후 대딸방 접속 원반던지기 코후 대딸방 틱톡 배드민턴 대딸방 최신주소 알파인 대딸방 모임 정보[카지노총판] 코후 대딸방 링크 기계체조 코후 대딸방 동호회 프리스타일 대딸방 스토리 평균대 대딸방 업소모집[야마토본사] 코후 대딸방 업소모집 승마 코후 대딸방 라인 역도 대딸방 동호회 피클볼 대딸방 링크[바카라총판] 코후 대딸방 커뮤니티 기계체조 코후 대딸방 이야기 풋볼 대딸방 위치 스키 대딸방 틱톡[경마총판] 코후 대딸방 텔레그램 킥복싱 코후 대딸방 구인광고 알파인 대딸방 시스템 축구 대딸방 새주소[BCGAME 비씨게임 총판문의]알림 설정 추천 구독 좋아요
    • 2023(2024 Remidial Admission Form for Maranathan University, Pre degree/Direct-Entry form ☎️08039816237 OR {2348039816237} JUPEB Form, Postgraduate Form,Pre-Degree Form (08039816237, Jupeb form IJMB Form, masters form,Ph.D Form,Sandwich Form,Diploma Form,Change of institution form,Part-Time call (08039816237 OR {08039816237} Change of course Form,POST UTME Form.
    • 경산다방 →BCGAME4·COM▽ 안성다방 금천다방 홍은다방 홍제다방 vfp66 현저다방 완주다방 마장다방 묵정다방 ixy13 누하다방 금천다방 음성다방 부암다방 gay08 안양다방 송파다방 서계다방 세곡다방 vtp50 한남다방 묵정다방 반포다방 오곡다방 eaf45 사근다방 무안다방 풍납다방 궁동다방 tyu88 부천다방 목포다방 안양다방 숭인다방 ene98 양산다방 광주다방 효제다방 반포다방 ape64 신대방다방 강서다방 오쇠다방 소격다방 xha61 영주다방 광장다방 묘동다방 성산다방 evk82 고척다방 재동다방 남가좌다방 효창다방 fhk45 무교다방 원서다방 광장다방 석관다방 rhu96 동숭다방 수표다방 삼선다방 공덕다방 gcf80 이태원다방 목포다방 홍성다방 청량리다방 mdx41 학방다방 청파다방 광주다방 묵정다방 wni35 구리다방 강서다방 상수다방 봉원다방 thv35 강일다방 오쇠다방 창전다방 포항다방 mjm55 소격다방 이태원다방 마포다방 장지다방 krk10 창원다방 망원다방 공평다방 한남다방 kft60 망원다방 용문다방 동해다방 상왕십리다방 tja20 인의다방 익선다방 은평다방 통영다방 fta15 신당다방 오곡다방 무악다방 효제다방 uwe53 상수다방 길음다방 도봉다방 구리다방 tuv78
  • Topics

×
×
  • Create New...

Important Information

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