| 30 | import java.util.*; |
| 31 | |
| 32 | public class Variables implements IVariables, GLFWKeyCallbackI { |
| 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(Names.rightClickMouse.getName()); |
| 50 | rightClickMouse.setAccessible(true); |
| 51 | } catch (Exception e) { |
| 52 | throw new RuntimeException(e); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | private final GLFWKeyCallback previousCallback; |
| 58 | |
| 59 | private IGui2ndChat gui2ndChat = new Gui2ndChat(); |
| 60 | |
| 61 | private final ResourceManager resourceManager; |
| 62 | private Kernel32.SYSTEM_POWER_STATUS batteryStatus; |
| 63 | |
| 64 | private static final List<PotionEffectImpl> DUMMY_POTIONS = Arrays.asList(new PotionEffectImpl("effect.jump", 20, "0:01", 1, 10, true, true, 0x22ff4c), |
| 65 | new PotionEffectImpl("effect.moveSpeed", 20 * 50, "0:50", 1, 0, true, true, 0x7cafc6)); |
| 66 | |
| 67 | public Variables() { |
| 68 | Keyboard.init(new Keyboard.KeyboardHandler() { |
| 69 | @Override |
| 70 | public boolean isKeyDown(int key) { |
| 71 | return GLFW.glfwGetKey(getMinecraft().f.j(), key) == 1; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public void enableRepeatEvents(boolean repeat) { |
| 76 | getMinecraft().v.a(repeat); |
| 77 | } |
| 78 | }); |
| 79 | Mouse.init(new Mouse.MouseHandler() { |
| 80 | @Override |
| 81 | public boolean isButtonDown(int button) { |
| 82 | return GLFW.glfwGetMouseButton(getMinecraft().f.j(), button) == 1; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public int getX() { |
| 87 | return (int) getMinecraft().u.e(); |
| 88 | } |
| 89 | |