0
0
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:
Alexander01998 2019-07-22 21:46:04 +02:00
parent d36448de80
commit fba9da7e13
3 changed files with 55 additions and 0 deletions

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

View 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();
}

View File

@ -11,6 +11,7 @@
"ClientPlayerEntityMixin",
"ClientPlayNetworkHandlerMixin",
"GameRendererMixin",
"KeyBindingMixin",
"KeyboardMixin"
],
"injectors": {