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.

[1.7.10] How would you disable the scroll wheel while in the main Inventory HUD

Featured Replies

Posted

Hi everyone,

 

If you have been following along I am trying to disable vanilla inventory functionality based on a condition completely so that I may implement my own. Thansk to coolAlias I have disabled the hotbar buttons 1-9 and the E key but the scroll wheel still allows you to select all of the HUD slots (rather than the custom 4 that I want to select)

 

Does anyone know how to disable the scroll wheel from selecting itemslots in the main Inventory hud?

 

  • Author

I wonder if it is possible to remap the scroll wheel to only select the slots that I want  slots 0-3 and 5 in the main player inventory. Ive been trying to find out where vanilla does this but am stumped atm

public int currentItem;

In InventoryPlayer.

 

Use PlayerTickEvent to set it to 3 (max) whenever it's bigger than that.

I think you should run it on both sides, and if there will be rendering glitch where HUD shows larger than 3, then you might even use RenderTickEvent on clint side - it will always stay within server's, just look good.

 

Other way around it is to subscribe to MouseEvent and check if event was "wheeling" and cancel if currentItem is bigger than 3, BUT that might get buggy since you would cancell whole MouseEvent just to do one thing (there are other things).

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Ya that is what I was worried about. Ive been messing with

 

@SubscribeEvent 
   public void mouseEvent(MouseEvent event) {
	ExtendedPlayerProperties epp = ExtendedPlayerProperties.get(this.mc.thePlayer);
	  if(epp.isMorphed()){
	  int dwheel = event.dwheel;
	  System.out.println(dwheel);// always -120, 120 or 0
	  }
	  
  }

 

why is dwheel -120,120, or 0

 

I personally would go with 1st solution (PlayerTickEvent) - there might be mods that would set currentItem directly or by other means than wheeling.

It would also resolve all other sources of changing currentItem. Just run simple check and as told - in addition add "something" on client in case of non-smootheness.

 

As to why 120, -120, 0 - it is number awfully reminding me of 360 (1/3) which is obviously a wheel (or circle, whatever). But idk really.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

I tried the following but it didnt work it sometimes makes it past the 4th item and it is very very glitchy

 

  public void mouseEvent(MouseEvent event) {
	ExtendedPlayerProperties epp = ExtendedPlayerProperties.get(this.mc.thePlayer);
	  if(epp.isMorphed() && event.dwheel !=0){
		 if(this.mc.thePlayer.inventory.currentItem > 3){
		 this.mc.thePlayer.inventory.currentItem = 0;
		 }
	  }
	  
  }

  • Author

This works but it is glitchy.

 

@SubscribeEvent
public void playerTick(PlayerTickEvent event) {
	ExtendedPlayerProperties epp = ExtendedPlayerProperties.get(event.player);
	if(epp.isMorphed() && event.player.inventory.currentItem > 3){
event.player.inventory.currentItem = 3;
}
}

 

  • Author

@SubscribeEvent
  public void renderTick(RenderTickEvent event){
	  ExtendedPlayerProperties epp = ExtendedPlayerProperties.get(this.mc.thePlayer);
	  if(epp.isMorphed() && this.mc.thePlayer.inventory.currentItem > 3){
		  this.mc.thePlayer.inventory.currentItem = 3;
		}
  }

 

This smooths it out but its still not perfect. oh well

  • Author

Any other ideas to try and make this a bit smoother, jumps around a bit still and is a bit jaggedy

Well, if you're changing a lot of stuff in the way the inventory GUI works, I'd make a whole replacement inventory GUI. Subscribe to the open gui event and open your version instead. Copy the vanilla class and then edit it to your liking.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.