Posted September 8, 201510 yr 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?
September 8, 201510 yr 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
September 8, 201510 yr 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.
September 8, 201510 yr 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
September 8, 201510 yr 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.
September 8, 201510 yr 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; } } }
September 8, 201510 yr 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; } }
September 8, 201510 yr 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
September 8, 201510 yr Author Any other ideas to try and make this a bit smoother, jumps around a bit still and is a bit jaggedy
September 10, 201510 yr 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.