Error on build (Registry.register)
ThomasDubuis opened this issue ยท 3 comments
I have clone the repo and switch to the branch 1.20.1-fabric.
When i run the Minecraft Client configuration I have this error :
`15:12:34: Executing ':classes'...
Starting Gradle Daemon...
Gradle Daemon started in 504 ms
Configure project :
Fabric Loom: 1.4.4
Task :compileJava FAILED
/Users/thomasdubuis/Downloads/BellsAndWhistlesMod/src/main/java/com/sudolev/bellsandwhistles/content/CBWBlocks.java:108: error: no suitable method found for register(ResourceKey<Registry>,ResourceLocation,Block)
return Registry.register(Registries.BLOCK, new ResourceLocation(BellsAndWhistles.ID, name), block);
^
method Registry.<T#1>register(Registry<? super T#1>,String,T#1) is not applicable
(cannot infer type-variable(s) T#1
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<? super T#1>))
method Registry.<V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2) is not applicable
(cannot infer type-variable(s) V#1,T#2
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<V#1>))
method Registry.<V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3) is not applicable
(cannot infer type-variable(s) V#2,T#3
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<V#2>))
where T#1,V#1,T#2,V#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1>register(Registry<? super T#1>,String,T#1)
V#1 extends Object declared in method <V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2)
T#2 extends V#1 declared in method <V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2)
V#2 extends Object declared in method <V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3)
T#3 extends V#2 declared in method <V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3)
/Users/thomasdubuis/Downloads/BellsAndWhistlesMod/src/main/java/com/sudolev/bellsandwhistles/content/CBWBlocks.java:112: error: no suitable method found for register(ResourceKey<Registry>,ResourceLocation,BlockItem)
return Registry.register(Registries.ITEM, new ResourceLocation(BellsAndWhistles.ID, name),
^
method Registry.<T#1>register(Registry<? super T#1>,String,T#1) is not applicable
(cannot infer type-variable(s) T#1
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<? super T#1>))
method Registry.<V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2) is not applicable
(cannot infer type-variable(s) V#1,T#2
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<V#1>))
method Registry.<V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3) is not applicable
(cannot infer type-variable(s) V#2,T#3
(argument mismatch; ResourceKey<Registry> cannot be converted to Registry<V#2>))
where T#1,V#1,T#2,V#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1>register(Registry<? super T#1>,String,T#1)
V#1 extends Object declared in method <V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2)
T#2 extends V#1 declared in method <V#1,T#2>register(Registry<V#1>,ResourceLocation,T#2)
V#2 extends Object declared in method <V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3)
T#3 extends V#2 declared in method <V#2,T#3>register(Registry<V#2>,ResourceKey<V#2>,T#3)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
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 --info option to get more log output.
Run with --scan to get full insights.
BUILD FAILED in 6s
1 actionable task: 1 executed
15:12:40: Execution finished ':classes'.
`
When I change the Registries.BLOCK into BuiltInRegistries.BLOCK like :
return Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(BellsAndWhistles.ID, name), block);
The build is good but I have an other error :
error.txt
Yes... the fabric 1.20.1 branch is a WIP branch and there are errors. I have some local commits (ones that I haven't pushed) on my machine, too. I'll sit down and try to get a release-ready build going...
Everything should now be fixed. I published a 1.20 fabric version to Modrinth, Curseforge, and Github.