Running a Python file when a command is run

Started by Barboddd on

Topic category: Advanced modding

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Running a Python file when a command is run

Is there any way to make a Python file run when a command is run in the game?

I have this code for Procedure:

Procedure script

and this code for Command:

Command script

but it gave me this error:

> Task :compileJava FAILED
C:\Users\Asus\MCreatorWorkspaces\maker\src\main\java\net\menu\Main.java:5: error: class MainProcedure is public, should be declared in a file named MainProcedure.java public class MainProcedure {
^
C:\Users\Asus\MCreatorWorkspaces\maker\src\main\java\net\menu\Test.java:17: error: class TestCommand is public, should be declared in a file named TestCommand.java public class TestCommand {
^
C:\Users\Asus\MCreatorWorkspaces\maker\src\main\java\net\menu\Test.java:14: error: cannot find symbol import net.menu.procedures.MainProcedures;
^
symbol: class MainProcedures
location: package net.menu.procedures
C:\Users\Asus\MCreatorWorkspaces\maker\src\main\java\net\menu\Main.java:8: error: cannot find symbol ProcessBuilder pb = new ProcessBuilder(Arrasy.asList("python", PythonPath));
^
symbol: variable Arrasy
location: class MainProcedure
C:\Users\Asus\MCreatorWorkspaces\maker\src\main\java\net\menu\Test.java:32: error: cannot find symbol MainProcedures.execute(world, x, y, z, entity);

Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The first error message says…
Sun, 03/26/2023 - 18:44
  1. The first error message says that the MainProcedure class should be declared in a file named MainProcedure.java. Check that you have a file named MainProcedure.java in the correct directory and that it contains the MainProcedure class.
  2. The second error message says that the TestCommand class should be declared in a file named TestCommand.java. Check that you have a file named TestCommand.java in the correct directory and that it contains the TestCommand class.
  3. The third error message says that the compiler cannot find the MainProcedures class. Check that you have imported the correct package and that the MainProcedures class is defined in that package.
  4. The fourth error message says that there is a typo in the MainProcedure class. The variable name Arrasy should be Arrays.
  5. The fifth error message says that the compiler cannot find the MainProcedures.execute method. Check that you have imported the correct package and that the MainProcedures class defines the execute method.

    maybe check these n see if that fixes anything