MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / Variables

Class Variables

Minecraft-Utils/1.9.4/src/Variables.java:32–1264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30import java.util.*;
31
32public class Variables implements IVariables {
33
34 private static Field forgeChatField;
35 private static Method rightClickMouse;
36
37 static {
38 if (Transformer.FORGE) {
39 try {
40 forgeChatField = Names.guiChat.load().getDeclaredField("field_146415_a");
41 forgeChatField.setAccessible(true);
42 rightClickMouse = Names.minecraft.load().getDeclaredMethod("func_147121_ag");
43 rightClickMouse.setAccessible(true);
44 } catch (Exception e) {
45 throw new RuntimeException(e);
46 }
47 } else {
48 try {
49 rightClickMouse = Names.minecraft.load().getDeclaredMethod("ax");
50 rightClickMouse.setAccessible(true);
51 } catch (Exception e) {
52 throw new RuntimeException(e);
53 }
54 }
55 }
56
57 private bcv scaledResolution;
58 private IGui2ndChat gui2ndChat = new Gui2ndChat();
59
60 private final ResourceManager resourceManager;
61 private Kernel32.SYSTEM_POWER_STATUS batteryStatus;
62
63 private static final List<PotionEffectImpl> DUMMY_POTIONS = Arrays.asList(new PotionEffectImpl("effect.jump", 20, "0:01", 1, 10, true, true, 0x22ff4c),
64 new PotionEffectImpl("effect.moveSpeed", 20 * 50, "0:50", 1, 0, true, true, 0x7cafc6));
65
66 public Variables() {
67 updateScaledResolution();
68 try {
69 this.resourceManager = new ResourceManager(getGameProfile());
70 } catch (Exception e) {
71 throw new RuntimeException(e);
72 }
73 try {
74 Class<?> enumGameSettings = Names.gameOption.load();
75 Method setMaxValue = Transformer.FORGE ? enumGameSettings.getDeclaredMethod("func_148263_a", float.class) : enumGameSettings.getDeclaredMethod("a", float.class);
76 Field gamma = Transformer.FORGE ? enumGameSettings.getDeclaredField("GAMMA") : enumGameSettings.getDeclaredField("d");
77 setMaxValue.invoke(gamma.get(null), 10.0f);
78 Field fov = Transformer.FORGE ? enumGameSettings.getDeclaredField("FOV") : enumGameSettings.getDeclaredField("c");
79 setMaxValue.invoke(fov.get(null), 130f);
80 } catch (Exception e) {
81 MinecraftFactory.getClassProxyCallback().getLogger().warn("Could not patch game settings", e);
82 }
83 if (Utils.getPlatform() == Utils.Platform.WINDOWS) {
84 try {
85 batteryStatus = new Kernel32.SYSTEM_POWER_STATUS();
86 } catch (Throwable ignored) {
87 }
88 }
89 }

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected