How can i fix these errors?

Started by X_RareNick_X on

Topic category: Advanced modding

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can i fix these errors?

Okay. I tried to remake wait script from 2021.1 in 2020.5 and got these errors.

D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:46: error: illegal start of expression @SubscribeEvent;
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:47: error: illegal start of expression public void tick(TickEvent.ServerTickEvent event) {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:47: error: illegal start of expression public void tick(TickEvent.ServerTickEvent event) {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:47: error: ';' expected public void tick(TickEvent.ServerTickEvent event) {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:47: error: ';' expected public void tick(TickEvent.ServerTickEvent event) {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:55: error: illegal start of expression private void run() {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:55: error: illegal start of expression private void run() {
^
D:\1\NewFolder\build\sources\main\java\net\mcreator\thecronos\procedure\ProcedureLightBeamUpdateTick.java:55: error: ';' expected private void run() {
^
8 errors
:compileJava FAILED
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. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
5 actionable tasks: 4 executed, 1 up-to-date
BUILD FAILED
Task completed in 1308 milliseconds

Also my script:
package net.mcreator.thecronos.procedure;

import net.mcreator.thecronos.ElementsThecronosMod;

import java.util.Map;

@ElementsThecronosMod.ModElement.Tag
public class ProcedureLightBeamUpdateTick extends ElementsThecronosMod.ModElement {
    public ProcedureLightBeamUpdateTick(ElementsThecronosMod instance) {
        super(instance, 69);
    }

    public static void executeProcedure(Map<String, Object> dependencies) {
if (dependencies.get("x") == null) {
            System.err.println("Failed to load dependency x for procedure LightBeamUpdateTick!");
            return;
        }
        if (dependencies.get("y") == null) {
            System.err.println("Failed to load dependency y for procedure LightBeamUpdateTick!");
            return;
        }
        if (dependencies.get("z") == null) {
            System.err.println("Failed to load dependency z for procedure LightBeamUpdateTick!");
            return;
        }
        if (dependencies.get("world") == null) {
            System.err.println("Failed to load dependency world for procedure LightBeamUpdateTick!");
            return;
        }
    
        int x = (int) dependencies.get("x");
        int y = (int) dependencies.get("y");
        int z = (int) dependencies.get("z");
        World world = (World) dependencies.get("world");

        new Object() {
            private int ticks = 0;
            private float waitTicks;
            private IWorld world;
            public void start(IWorld world, int waitTicks) {
                this.waitTicks = waitTicks;
                MinecraftForge.EVENT_BUS.register(this);
                this.world = world;
            }
        }
            @SubscribeEvent;
            public void tick(TickEvent.ServerTickEvent event) {
                if (event.phase == TickEvent.Phase.END) {
                    this.ticks += 1;
                    if (this.ticks >= this.waitTicks)
                        run();
                }
            }

            private void run() {
                world.setBlockState(new BlockPos((int) x, (int) y, (int) z), Blocks.AIR.getDefaultState(), 3);
            }
    }
}    

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe because the forge…
Thu, 02/25/2021 - 20:27

Maybe because the forge versions are different? IDK