Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I just want to get my basemod and my entity.class file to work together without a static/non-static error.
- This is the relevant command in my entity.class file :
- PlayerTurnonLight = mod_Attacking_The_Darkness.IstheLightOn();
- if (PlayerTurnonLight)
- *turn on the light which works fine*
- This is the basemod "Attacking the Darkness" which is basically just a script-kiddie stolen version of the pastebin keybinding example.
- *import commands*
- public class mod_Attacking_The_Darkness extends BaseMod
- {
- //variables
- public Minecraft mc;
- public boolean wasKeyDown[];
- public static KeyBinding keys[];
- public boolean TurnOnLight;
- World world = mc.theWorld;
- public mod_Attacking_The_Darkness()
- {
- TurnOnLight = false;
- // setting up keystrokes
- mc = ModLoader.getMinecraftInstance();
- keys = new KeyBinding[3];
- keys[0] = new KeyBinding("Action", Keyboard.KEY_C);
- keys[1] = new KeyBinding("Action2", Keyboard.KEY_V);
- keys[2] = new KeyBinding("Action3", Keyboard.KEY_B);
- ModLoader.SetInGameHook(this, true, false);
- ModLoader.SetInGUIHook(this, true, false);
- KeyBinding akeybinding[];
- int i = (akeybinding = keys).length;
- for(int j = 0; j < i; j++)
- {
- KeyBinding keybinding = akeybinding[j];
- ModLoader.RegisterKey(this, keybinding, false);
- }
- }
- public void KeyboardEvent(KeyBinding keybinding)
- {
- if (!mc.inGameHasFocus)
- {
- return;
- }
- if (keybinding == keys[0]) // C
- {
- // actions for C here
- }
- else if (keybinding == keys[1]) // V
- // the boolean is determined with the v key
- {
- //HEADLIGHTS FOR CAR
- if (!TurnOnLight)
- {
- TurnOnLight = true;
- } else {
- TurnOnLight = false;
- }
- //}
- }
- else if (keybinding == keys[2]) // B
- {
- // actions for B here
- }
- }
- // the function i want to call from my entity in game.
- public boolean IstheLightOn()
- {
- return TurnOnLight;
- }
- public String Version()
- {
- return "Attacking_The_Darkness 1.0";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement