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

I looked through many of the players functions. But I cant find anything that tells you whether the inventory is open or not. How would I do this?

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!

You should check it on client side, By checking opened GUI.

So what do you actually want to achieve?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

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!

  • Author

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!

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

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.

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.

  • Author

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!

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/

  • Author

You need to register it on the FML bus:

FMLCommonHandler.instance().bus()

.

Oh. Stupid me. Thanks for the help though.

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!

  • Author

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!

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.