blob: 9d3bf1cb25290ee2d66f3dbdadcc7c4348e80285 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);
}
}
}
}
|