ENTITY_TYPE cannot be resolved or is not a field #2017
-
ENTITY_TYPE cannot be resolved or is not a fieldJava(33554502)I created a SpawnInit.java and this error is being created, I have no clue why. @SuppressWarnings("deprecation")
public class SpawnInit {
public static int SpawnRate = 100;
public static void addSpawn(Predicate<BiomeSelectionContext> BiomeSelector, SpawnGroup spawnGroup, SpawnSettings.SpawnEntry se) {
Preconditions.checkArgument(se.type.getSpawnGroup() != SpawnGroup.MISC, "MISC spawns pigs");
Identifier id = Registry.ENTITY_TYPE.getId(se.type); //ERROR HERE
Preconditions.checkState(id != Registry.ENTITY_TYPE.getDefaultId(), "Unregistered entity type: %S", se.type); //ERROR HERE
BiomeModifications.create(id).add(ModificationPhase.ADDITIONS, BiomeSelector, context -> {
context.getSpawnSettings().addSpawn(spawnGroup, se);
});
}
//Rest of the code
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
All the questions you keep asking have nothing to do with Fabric, Minecraft or mod development. They are all basic "I don't understand java" questions that don't really belong on this forum. For this one, you don't show your imports, try adding:
If it doesn't let you, it is probably because you have some other class with the name |
Beta Was this translation helpful? Give feedback.
All the questions you keep asking have nothing to do with Fabric, Minecraft or mod development.
They are all basic "I don't understand java" questions that don't really belong on this forum.
And you never post all the information to make it possible to answer the question.
So we have to guess what the problem is.
For this one, you don't show your imports, try adding:
If it doesn't let you, it is probably because you have some other class with the name
Registry
in scope and this is causing your problem.