Repetitive event trigger

Started by EBhero on Wed, 12/02/2015 - 02:51
Last seen on 19:59, 27. Aug 2016
Joined Nov 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Repetitive event trigger
Wed, 12/02/2015 - 02:51

Hello everyone who is reading this!

I am currently working on a mod to do some calculations with the players coordinates. I have some variables, but I can't find a way to have an event to keep updating them to the current player's position.

I actually need a repetitive event trigger. Like something that is triggered every game tick. In the global event trigger, there is no such thing, sadly.

So if you ever have a way to solve this problem, it would be really appreciated!

Thank you!

 

Last seen on 11:10, 27. Feb 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Try using a key bind for [a,w
Wed, 12/02/2015 - 12:49

Try using a key bind for [a,w,s,d,space].

(Or trigger event when player dies.)

Last seen on 00:22, 16. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
If you want check something
Wed, 12/02/2015 - 13:32

If you want check something every tick you can use:

@SubscribeEvent
    public void worldTick(TickEvent.WorldTickEvent event) {
      
          
        
    }

Last seen on 19:59, 27. Aug 2016
Joined Nov 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Thanks but...
Wed, 12/02/2015 - 22:49

Thanks but...

I don't know how to link this shit useful thing to anything that's normal with MCreator because I still don't know how to correctly use java...

Last seen on 19:59, 27. Aug 2016
Joined Nov 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Actually, I tried to use it
Wed, 12/02/2015 - 23:52

Actually, I tried to use it in custom code with a simple command in it, but it can't compile...

Are you sure this is the correct command?

Last seen on 00:22, 16. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
Can i see your code and error
Thu, 12/03/2015 - 22:57

Can i see your code and error?

Last seen on 19:59, 27. Aug 2016
Joined Nov 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I've created TestKeybimd that
Fri, 12/04/2015 - 01:04

I've created TestKeybimd that triggers the Custom Code when U is pressed.

The code that I've put in Custom code:

@SubscribeEvent
    public void worldTick(TickEvent.WorldTickEvent event) {
      
          if(entity instanceof EntityPlayer){MinecraftServer minecraftserver = MinecraftServer.getServer();if(minecraftserver!=null)minecraftserver.getCommandManager().executeCommand((EntityPlayer)entity, "say hey");}
        
    }

The command make the player execute: say hey

And here is the error log:

C:\Pylo\MCreator160\forge\build\sources\java\mod\mcreator\mcreator_testkeybind.java:153: error: ';' expected
    public void worldTick(TickEvent.WorldTickEvent event) {
                         ^
C:\Pylo\MCreator160\forge\build\sources\java\mod\mcreator\mcreator_testkeybind.java:153: error: ';' expected
    public void worldTick(TickEvent.WorldTickEvent event) {
                                                        ^
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

Last seen on 00:22, 16. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
If you want to print messange
Sat, 12/05/2015 - 09:52

If you want to print messange on press U , why do you need the World tick event?