feat: initial work on GuiMove

This commit is contained in:
əlemi 2023-03-08 19:37:50 +01:00
parent fbee153272
commit 0184889798
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,49 @@
package ftbsc.bscv.modules.motion;
import com.google.auto.service.AutoService;
import ftbsc.bscv.ICommons;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.AbstractModule;
import net.minecraft.client.gui.screen.IngameMenuScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.OptionsSoundsScreen;
import net.minecraft.client.gui.screen.VideoSettingsScreen;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@AutoService(ILoadable.class)
public class GuiMove extends AbstractModule implements ICommons {
@SubscribeEvent
public void onPlayerUpdate(LivingEvent.LivingUpdateEvent event) {
if (MC.player == null) return;
if (event.getEntityLiving() != MC.player) return;
KeyBinding[] keys = {
MC.options.keyUp,
MC.options.keyDown,
MC.options.keyLeft,
MC.options.keyRight,
MC.options.keyJump,
};
if (
MC.screen instanceof ContainerScreen
|| MC.screen instanceof OptionsScreen
|| MC.screen instanceof VideoSettingsScreen
|| MC.screen instanceof OptionsSoundsScreen
|| MC.screen instanceof IngameMenuScreen
) {
for (KeyBinding key : keys) {
boolean state = InputMappings.isKeyDown(MC.getWindow().getWindow(), key.getKey().getValue());
KeyBinding.set(key.getKey(), state);
key.setDown(state);
}
}
}
}

View file

@ -20,6 +20,6 @@ public class FastInteract extends QuickModule implements ICommons {
public void onTick(TickEvent.ClientTickEvent event) {
if (MC == null) return;
MC.rightClickDelay = 0;
MC.rightClickDelay = 0; // ACCESSTRANSFORMER
}
}