Jump to content

[1.7.10]How would I check if the players inventory is open?


starwarsmace

Recommended Posts

The server does in fact not know if the player is looking at their inventory or not. As far as the server is concerned you are always looking at your inventory, unless you are looking at another container (such as a chest).

On the client you can check Minecraft.getMinecraft().currentScreen instanceof GuiInventory (which would only cover the survival inventory).

Sorry about not telling you guys. I figured it out. I just used the GUIOPEN event, though diesieben's method is much better.

Anyway, now I have another question is there a good and efficient way to see which slot the player clicked?

 

Edit: By the way, it has to be the middle click. And is using the lwjgl Mouse class x and y and then compare it to the x and y to all the slots in the inventory and see which was the closest a good idea?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

I should probably make a new thread for this but oh well. This is an open gl questions really.

https://www.opengl.org/discussion_boards/showthread.php/185705-How-do-I-use-smoothing-groups-from-obj-files?p=1264468#post1264468

 

To summarize what I asked in that thread, how would I smooth a .obj model using the smoothiing groups? 

 

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

The server does in fact not know if the player is looking at their inventory or not. As far as the server is concerned you are always looking at your inventory, unless you are looking at another container (such as a chest).

On the client you can check Minecraft.getMinecraft().currentScreen instanceof GuiInventory (which would only cover the survival inventory).

 

I played around with this and was wondering, how would you check for the players HUD inventory bar being open in survival mode and specifically check for a slot number and whether or not it contains an item

Link to comment
Share on other sites

I guess to clarify

 

how would you check whether or not a specific slot in the players HUD inventory bar does not contain an item. And -- if and only if  this specific slot doesnt contain an itemstack (ie is empty where itemstack is null) then add an item to that specific slot. Ive been stumped by this for a while.

Link to comment
Share on other sites

try this it happens the first time but after that it doesnt work... move the items around remove them from the hud it isnt that simple.

 

@SubscribeEvent
public void onPlayerJoin(PlayerLoggedInEvent event) {
	System.out.println("This is called Log In");

	if(!event.player.worldObj.isRemote && !event.player.capabilities.isCreativeMode){
		System.out.println("on server side and not in creative");
		if(event.player.inventory.mainInventory[0] == null){
			System.out.println("Adding itemCustom1");	
			event.player.inventory.addItemStackToInventory(new ItemStack(CommonProxy.itemCustom1));
			} 
		if(event.player.inventory.mainInventory[1] == null){
			System.out.println("Adding itemCustom2");	
			event.player.inventory.addItemStackToInventory(new ItemStack(CommonProxy.itemCustom2));
		    }
		if(event.player.inventory.mainInventory[2] == null){
			System.out.println("Adding itemCustom3");	
			event.player.inventory.addItemStackToInventory(new ItemStack(CommonProxy.itemCustom3));
		    }
	}

}

[EDIT] the weird thing is if you move the item -> itemCustom3 lets say to a different slot lets say slot 5 and then relog. Now slot 3 is empty and so you should get itemCustom 3 placed into slot 3 but you dont you get it in slot 5 now. If you throw the item away then it works again upon relog you get item 3 in slot 3.

Link to comment
Share on other sites

For some reason MouseInputEvent didnt call. It might be because Im not registering it on the right bus. It has no javadocs, so I was wondering whether any of you know. Also, im currently registering it on MinecraftForge.EVENT_BUS

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

You need to register it on the FML bus:

FMLCommonHandler.instance().bus()

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

It appears to me that the Slot.displayX(or y) is offsetted. For example, the first slot on the screen is around 240 pixels on the x. But the slot.displayX is saying the x is on 8, when 8 is all the way at the edge. It looks like to me it is offeseted. Does it start at the left side of the players inventory? And does the y start at the top of the inventory? If so, is there some equation that I can use to get the offset, since I know that the pixel lengths change when the gui size changes or its fullscreen or not.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

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

    • Slot Bonus New Member 100 Di Awal To Rendah   ⚡️ KLIK DAFTAR BONUS NEW MEMBER 100 DI AWAL ⚡️ ⚡️ LINK SLOT GACOR BONUS NEW MEMBER 100 DI DEPAN ⚡️     Slot Bonus 100 Situs Slot Online Gacor Bonus New Member 100 Di Awal Slot Bonus 100 adalah permainan di slot online gacor dengan winrate tembus 99% menggunakan akun pro. Kami adalah situs Slot Bonus 100 yang menghadirkan semua permainan slot terbaik di Asia. Semua member diberikan pelayanan maximal serta CS yang selalu siap 24 jam. Itulah mengapa, banyak member lama yang masih bermain di situs kami. Bagi yang mencari Slot Bonus 100 super gacor, Situs kami adalah tempatnya. Jangan bingung karena kami selalu memberikan RTP terbaru agar tahu kapan waktu yang tepat untuk main dan bisa WD sampai puluhan juta rupiah. Ratusan pemain mengenal kami sebagai situs Slot Bonus 100 No 1 karena kami mempermudah pemain untuk mendapatkan maxwin. Winrate ditingkatkan sampai di atas rata-rata. Bagi yang ingin mendapatkan pola, bisa mencoba dulu bermain demo slot gacor di situs Slot Bonus 100 terbaik 2024 ini. Pemain yang daftar dan main hari ini lewat link Slot Bonus 100, dikasih jaminan 100% menang.
    • Hello, for educational purpose I am trying to port a mod from 1.20.1 to 1.20.2+ but I can't understand how the new networking system works. I manage to get through it for the most part, but I'm stuck on how to register packets. The previous method was: INSTANCE.registerMessage(id++, CPExecuteSkill.class, CPExecuteSkill::toBytes, CPExecuteSkill::fromBytes, CPExecuteSkill::handle); with instance being of type SimpleChannel.  (The forge document is not up to date for this part unfortunatly) Any help or clear documentation would be welcome.
    • ☾☾ KLIK DAFTAR DI SINI ☽☽ ☾☾ KLIK DAFTAR DI SINI ☽☽ ☾☾ KLIK DAFTAR DI SINI ☽☽   SLOT BANK MANDIRI merupakan situs daftar bandar judol yang deposit menggunakan bank mandiri hanya 1menit Langsung masuk di dalam akun anda. SLOT BANK MANDIRI menyediakan berbagai macam game slot online terlengkap provider termasuk daftar deposit via bank mandiri dan semua game slot gacor maxwin terbaru 2024.    
    • Selamat datang di TOTO88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor TOTO88 ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini TOTO88.
    • Slot88 Viral = Situs Slot88 Gacor Modal Receh Gampang Menang Viral Slot88 Online Min Depo 1000 1RB 1K 1ribu Tanpa Potongan ▶️▶️DAFTAR◀️◀️ ▶️▶️DAFTAR◀️◀️ ▶️▶️DAFTAR◀️◀️ Slot88 Viral menjadi sorotan para pecinta slot online dengan berbagai fitur menarik yang ditawarkan. Berikut adalah ulasan singkat tentang situs ini: Slot88 Gacor Modal Receh Slot88 Viral menawarkan pengalaman bermain slot online yang menarik dengan modal yang sangat terjangkau. Dengan deposit mulai dari 1000, 1RB, 1K, hingga 1ribu tanpa potongan, Anda dapat langsung memulai petualangan Anda untuk mencari kemenangan besar. Gampang Menang di Slot88 Online Salah satu daya tarik utama dari Slot88 Viral adalah peluang besar untuk meraih kemenangan. Dengan berbagai pilihan permainan slot gacor yang disediakan, para pemain memiliki kesempatan yang lebih besar untuk mendapatkan jackpot dan hadiah besar lainnya. Min Depo Tanpa Potongan Slot88 Viral memastikan bahwa setiap transaksi deposit dilakukan tanpa potongan, sehingga Anda dapat menggunakan seluruh saldo deposit Anda untuk bermain tanpa kehilangan sebagian karena biaya transaksi. Ini memberi Anda nilai yang lebih besar untuk setiap deposit yang Anda lakukan. Viral di Kalangan Pecinta Slot Online Slot88 Viral telah menjadi viral di kalangan pecinta slot online karena reputasinya yang baik dalam menyediakan pengalaman bermain yang adil, transparan, dan menguntungkan bagi para pemainnya. Dengan jumlah pemain yang terus bertambah, situs ini terus memperkuat posisinya sebagai salah satu destinasi utama untuk bermain slot online. Jadi, jika Anda mencari situs slot online yang menarik, menghibur, dan memberikan peluang besar untuk menang, Slot88 Viral adalah pilihan yang tepat. Bergabunglah sekarang dan rasakan sensasi bermain di salah satu situs slot paling populer di dunia daring!  
  • Topics

×
×
  • Create New...

Important Information

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