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 am using PlayerController.windowClick to organize my Inventory. For testing purpose I have made a loop, that should swap the 9 slots of hotbar with 9 horizontal slots from inventory:

Minecraft mc = Minecraft.getInstance();
if ( mc.player == null ) return;
PlayerEntity player = mc.player;
PlayerController pc = mc.playerController;
ClickType click = ClickType.SWAP;
for ( int i = 1; i < 4; i ++ ) {
	for ( int j = 0; j < 9; j ++ ) {
		int k = j + i * 9;
		pc.windowClick(0, k, 0, click, player);
		pc.windowClick(0, k + 9, 0, click, player);
		pc.windowClick(0, k, 0, click, player);
	}
}

 It swaps the hotbar slots from 1 to 8 perfectly, but the hotbar slot 0 ( or in inventory it is 36 ) just does not react to windowClick with clickType.SWAP... I tested with clickType.THROW and it dropped the item successfully... What is going on?

Edited by Kemuri Senpai

  • Author

Hmm... But the Method takes this arguments in my opinion:

1) Inventory ID, in code above it's 0

2) Slot ID to interact with

3) whether a right-click

4) Type of interaction

5) The player

 

What do you mean by "taking in two slot IDs"?

  • Author

However, I still have a question 😅

pc.windowClick(0, 37, 0, click, player);
pc.windowClick(0, 38, 0, click, player);
pc.windowClick(0, 37, 0, click, player);

works as I wanted. It swaps the second and the third item in my hotbar. But 

pc.windowClick(0, 36, 0, click, player);
pc.windowClick(0, 37, 0, click, player);
pc.windowClick(0, 36, 0, click, player);

does not swap the first and the second... It actually does nothing

Edited by Kemuri Senpai

  • Author

Ow, I see, so the second "0" i use, is only a placeholder? I could also use any other slot I want?...

So I even could swap two slots without the three commands? Just with one:

clickWindow( inventoryID, 36, 1, click, player )?

I expect this to swap two first slots in hotbar.. Is it how it works?

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.