-
Notifications
You must be signed in to change notification settings - Fork 0
mod.bt.BindCheck & mod.bt.BindCheckEvent
tiffit edited this page Jul 23, 2018
·
2 revisions
The BindCheck interface is used to set requirement(s) for whether a keybind should be triggered or not. By default, all keybindings have a Bind Check that always returns true.
boolean canRun(CheckEvent event); Return true to allow the keybinding to run.
The BindCheckEvent class is used during bind checks to provide relevant information to determine if the keybinding can run or not.
Keybind bind; -getter- The keybind to check.
IPlayer player; The player.
Keybind getBind(); The method version of bind.
IItemStack getHeldStack(@Optional boolean offhand); Returns the IItemStack the player is currently holding.
IPlayer getPlayer(); The method version of player.
var left = mod.bt.Binds.getKeybind("key.left");
left.setBindCheck(function(e as mod.bt.BindCheckEvent){
return e.getHeldStack().isEmpty;
});
The "left" keybinding will only trigger if the player is not holding anything.