code snippet: ((IronGolem)entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((IronGolem)entity, ExampleEntity.class, false, false));
# Replace IronGolemEntity with the id of a mob, like using /summon but make the first letter capital then where theres a _ remove it and make the letter a capital then finally add Entity at the end. Same goes for ExampleEntity
I tried replacing IronGolem with Cat, and Example with CreeperSprout, but it gave me this error:
Executing Gradle task: build Build info: MCreator 2023.3.36712, forge-1.20.1, 64-bit, 8192 MB, Mac OS X, JVM 17.0.7, JAVA_HOME: /Applications/MCreator.app/Contents/jdk.bundle/Contents/Home, started on: 2023-09-23-12:25:45
> Task :compileJava FAILED /Users/Drake/MCreatorWorkspaces/creeper_spread/src/main/java/net/mcreator/creeperspread/procedures/WhenCreeperSproutSpawnsProcedure.java:10: error: cannot find symbol ((Cat) entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((Cat) entity, CreeperSproutEntity.class, false, false)); ^ symbol: variable entity location: class WhenCreeperSproutSpawnsProcedure /Users/Drake/MCreatorWorkspaces/creeper_spread/src/main/java/net/mcreator/creeperspread/procedures/WhenCreeperSproutSpawnsProcedure.java:10: error: cannot find symbol ((Cat) entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((Cat) entity, CreeperSproutEntity.class, false, false)); ^ symbol: variable entity location: class WhenCreeperSproutSpawnsProcedure 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. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 5s 1 actionable task: 1 executed
I’m also trying to figure this out
I know a way that uses code snippets.
Trigger: on spawn
if event/target entity is sub type of (Mob Type):
code snippet: ((IronGolem)entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((IronGolem)entity, ExampleEntity.class, false, false));
# Replace IronGolemEntity with the id of a mob, like using /summon but make the first letter capital then where theres a _ remove it and make the letter a capital then finally add Entity at the end. Same goes for ExampleEntity
Iron golem Would be the mob type in this example.
I tried replacing IronGolem with Cat, and Example with CreeperSprout, but it gave me this error:
Executing Gradle task: build
Build info: MCreator 2023.3.36712, forge-1.20.1, 64-bit, 8192 MB, Mac OS X, JVM 17.0.7, JAVA_HOME: /Applications/MCreator.app/Contents/jdk.bundle/Contents/Home, started on: 2023-09-23-12:25:45
> Task :compileJava FAILED
/Users/Drake/MCreatorWorkspaces/creeper_spread/src/main/java/net/mcreator/creeperspread/procedures/WhenCreeperSproutSpawnsProcedure.java:10: error: cannot find symbol ((Cat) entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((Cat) entity, CreeperSproutEntity.class, false, false));
^
symbol: variable entity
location: class WhenCreeperSproutSpawnsProcedure
/Users/Drake/MCreatorWorkspaces/creeper_spread/src/main/java/net/mcreator/creeperspread/procedures/WhenCreeperSproutSpawnsProcedure.java:10: error: cannot find symbol ((Cat) entity).targetSelector.addGoal(1, new NearestAttackableTargetGoal((Cat) entity, CreeperSproutEntity.class, false, false));
^
symbol: variable entity
location: class WhenCreeperSproutSpawnsProcedure
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.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
1 actionable task: 1 executed
BUILD FAILED
Task completed in 43 seconds
What did I do wrong?