blob: d83d3c198edc9950f13b1f2201f83d8b8aa09c35 (
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
|
package ftbsc.bscv.modules.motion;
import com.google.auto.service.AutoService;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.QuickModule;
import net.minecraft.client.util.InputMappings;
import net.minecraftforge.client.settings.IKeyConflictContext;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@AutoService(ILoadable.class)
public class AutoWalk extends QuickModule {
private IKeyConflictContext previous_ctx;
@Override
public void enable() {
this.previous_ctx = MC.options.keyUp.getKeyConflictContext();
MC.options.keyUp.setKeyConflictContext(KeyConflictContext.UNIVERSAL);
super.enable();
}
@Override
public void disable() {
super.disable();
if (!InputMappings.isKeyDown(MC.getWindow().getWindow(), MC.options.keyUp.getKey().getValue())) {
MC.options.keyUp.setDown(false);
}
MC.options.keyUp.setKeyConflictContext(this.previous_ctx);
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase == Phase.END) return;
MC.options.keyUp.setDown(true);
}
}
|