Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. I just want to get my basemod and my entity.class file to work together without a static/non-static error.
  2.  
  3. This is the relevant command in my entity.class file :
  4.  
  5. PlayerTurnonLight = mod_Attacking_The_Darkness.IstheLightOn();
  6. if (PlayerTurnonLight)
  7.  
  8. *turn on the light which works fine*
  9.  
  10.  
  11. This is the basemod "Attacking the Darkness" which is basically just a script-kiddie stolen version of the pastebin keybinding example.
  12.  
  13. *import commands*
  14.  
  15.  
  16. public class mod_Attacking_The_Darkness extends BaseMod
  17. {
  18.  
  19. //variables
  20.  
  21. public Minecraft mc;
  22. public boolean wasKeyDown[];
  23. public static KeyBinding keys[];
  24. public boolean TurnOnLight;
  25. World world = mc.theWorld;
  26.  
  27.  
  28. public mod_Attacking_The_Darkness()
  29.  
  30.  
  31.  
  32.  
  33. {
  34.  
  35.  
  36. TurnOnLight = false;
  37.  
  38. // setting up keystrokes
  39.  
  40.  
  41.  
  42. mc = ModLoader.getMinecraftInstance();
  43.  
  44. keys = new KeyBinding[3];
  45. keys[0] = new KeyBinding("Action", Keyboard.KEY_C);
  46. keys[1] = new KeyBinding("Action2", Keyboard.KEY_V);
  47. keys[2] = new KeyBinding("Action3", Keyboard.KEY_B);
  48. ModLoader.SetInGameHook(this, true, false);
  49. ModLoader.SetInGUIHook(this, true, false);
  50. KeyBinding akeybinding[];
  51. int i = (akeybinding = keys).length;
  52. for(int j = 0; j < i; j++)
  53. {
  54. KeyBinding keybinding = akeybinding[j];
  55. ModLoader.RegisterKey(this, keybinding, false);
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63. }
  64.  
  65.  
  66.  
  67. public void KeyboardEvent(KeyBinding keybinding)
  68. {
  69.  
  70. if (!mc.inGameHasFocus)
  71. {
  72. return;
  73. }
  74.  
  75. if (keybinding == keys[0]) // C
  76. {
  77. // actions for C here
  78. }
  79. else if (keybinding == keys[1]) // V
  80.  
  81.  
  82.  
  83.  
  84. // the boolean is determined with the v key
  85.  
  86.  
  87.  
  88.  
  89. {
  90. //HEADLIGHTS FOR CAR
  91.  
  92.  
  93. if (!TurnOnLight)
  94. {
  95. TurnOnLight = true;
  96. } else {
  97. TurnOnLight = false;
  98. }
  99. //}
  100.  
  101. }
  102. else if (keybinding == keys[2]) // B
  103. {
  104. // actions for B here
  105. }
  106. }
  107.  
  108.  
  109. // the function i want to call from my entity in game.
  110.  
  111.  
  112. public boolean IstheLightOn()
  113.  
  114. {
  115.  
  116. return TurnOnLight;
  117.  
  118. }
  119.  
  120. public String Version()
  121. {
  122. return "Attacking_The_Darkness 1.0";
  123. }
  124.  
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement