mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Add IKeyBinding interface
This commit is contained in:
parent
d36448de80
commit
fba9da7e13
39
src/main/java/net/wurstclient/mixin/KeyBindingMixin.java
Normal file
39
src/main/java/net/wurstclient/mixin/KeyBindingMixin.java
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2014 - 2019 | Wurst-Imperium | All rights reserved.
|
||||
*
|
||||
* This source code is subject to the terms of the GNU General Public
|
||||
* License, version 3. If a copy of the GPL was not distributed with this
|
||||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
package net.wurstclient.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.wurstclient.WurstClient;
|
||||
import net.wurstclient.mixinterface.IKeyBinding;
|
||||
|
||||
@Mixin(KeyBinding.class)
|
||||
public class KeyBindingMixin implements IKeyBinding
|
||||
{
|
||||
@Shadow
|
||||
private boolean pressed;
|
||||
@Shadow
|
||||
private InputUtil.KeyCode keyCode;
|
||||
|
||||
@Override
|
||||
public void setPressed(boolean pressed)
|
||||
{
|
||||
this.pressed = pressed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActallyPressed()
|
||||
{
|
||||
long handle = WurstClient.MC.window.getHandle();
|
||||
int code = keyCode.getKeyCode();
|
||||
return InputUtil.isKeyPressed(handle, code);
|
||||
}
|
||||
}
|
15
src/main/java/net/wurstclient/mixinterface/IKeyBinding.java
Normal file
15
src/main/java/net/wurstclient/mixinterface/IKeyBinding.java
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2014 - 2019 | Wurst-Imperium | All rights reserved.
|
||||
*
|
||||
* This source code is subject to the terms of the GNU General Public
|
||||
* License, version 3. If a copy of the GPL was not distributed with this
|
||||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
package net.wurstclient.mixinterface;
|
||||
|
||||
public interface IKeyBinding
|
||||
{
|
||||
public void setPressed(boolean pressed);
|
||||
|
||||
public boolean isActallyPressed();
|
||||
}
|
@ -11,6 +11,7 @@
|
||||
"ClientPlayerEntityMixin",
|
||||
"ClientPlayNetworkHandlerMixin",
|
||||
"GameRendererMixin",
|
||||
"KeyBindingMixin",
|
||||
"KeyboardMixin"
|
||||
],
|
||||
"injectors": {
|
||||
|
Loading…
Reference in New Issue
Block a user