Neoforge causes build errors when using variables

Started by Tazgirl on

Topic category: Troubleshooting, bugs, and solutions

Last seen on 16:05, 6. May 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Neoforge causes build errors when using variables

I've had a couple projects have issues when switching them to the Neoforge generator as it always produces an error when registering variables and accessing them. Tried a couple fixes but nothing prevents the error besides deleting all variables and scripts referencing variables:

Accessing variables error:

symbol: variable PLAYER_VARIABLES
 location: class SimplelifecrystalModVariables
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\procedures\LifeCrystalItemPlayerFinishesUsingItemProcedure.java:23: error: cannot find symbol _vars.NumberOfLifeCrystalsUsed = entity.getData(SimplelifecrystalModVariables.PLAYER_VARIABLES).NumberOfLifeCrystalsUsed + 1;
 ^
 symbol: variable PLAYER_VARIABLES
 location: class SimplelifecrystalModVariables
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\procedures\PlayerUpdateHealthProcedure.java:33: error: cannot find symbol .setBaseValue((20 + (double) LifeCrystalConfigConfiguration.AMOUNT.get() * entity.getData(SimplelifecrystalModVariables.PLAYER_VARIABLES).NumberOfLifeCrystalsUsed));
 ^
 symbol: variable PLAYER_VARIABLES
 location: class SimplelifecrystalModVariables
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\SimplelifecrystalMod.java:47: error: cannot find symbol SimplelifecrystalModVariables.ATTACHMENT_TYPES.register(modEventBus);
 ^
 symbol: variable ATTACHMENT_TYPES
 location: class SimplelifecrystalModVariables

Registering variables error:


 symbol: class Capability
 location: class SimplelifecrystalModVariables
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\network\SimplelifecrystalModVariables.java:87: error: cannot find symbol private static class PlayerVariablesProvider implements ICapabilitySerializable<Tag> {
 ^
 symbol: class ICapabilitySerializable
 location: class SimplelifecrystalModVariables
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\network\SimplelifecrystalModVariables.java:89: error: cannot find symbol public static void onAttachCapabilities(AttachCapabilitiesEvent<Entity> event) {
 ^
 symbol: class AttachCapabilitiesEvent
 location: class PlayerVariablesProvider
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\network\SimplelifecrystalModVariables.java:95: error: cannot find symbol private final LazyOptional<PlayerVariables> instance = LazyOptional.of(() -> playerVariables);
 ^
 symbol: class LazyOptional
 location: class PlayerVariablesProvider
C:\Users\Migra\MCreatorWorkspaces\simplelifecrystal\src\main\java\net\mcreator\simplelifecrystal\network\SimplelifecrystalModVariables.java:98: error: cannot find symbol public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
 ^
Last seen on 16:05, 6. May 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I will try and recreate it…
Wed, 04/24/2024 - 01:35

I will try and recreate it in a no plugin workspace then open one

 

Last seen on 16:05, 6. May 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind, it is apparently…
Wed, 04/24/2024 - 01:55

Nevermind, it is apparently a plugin error at some point though I cant figure out where or which 

Last seen on 17:06, 21. May 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only plugin that messes with…
Wed, 04/24/2024 - 03:35

Only plugin that messes with global variables is kleiders custom renderer I believe