Jump to content

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


Thornack

Recommended Posts

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
		 }
	  }
	  
  }

Link to comment
Share on other sites

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;
}
}

 

Link to comment
Share on other sites

@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

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



×
×
  • Create New...

Important Information

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