Compilation Error

Published by Nayzal on Wed, 05/27/2020 - 21:11
Status
Works as designed
Type
Product/platform
MCreator/Windows
Priority
Normal
Issue description

Hi, I'm just having trouble with my mod. I tried to finish an element but it failed to compile. I can't find the reason why, so I'm seeking aid in these forums.

Issue comments

Here's the log:

Executing Gradle task: build
Build info: MCreator 2020.3.22116, forge-1.15.2, 64-bit, 8073 MB, Windows 10, JVM 1.8.0_252, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk
> Configure project :
New Dep: net.minecraftforge:forge:1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1
> Task :compileJava FAILED
C:\Users\gabea\MCreatorWorkspaces\dungeons_mod\src\main\java\net\mcreator\dungeonsmod\item\SwordItem.java:30: error: constructor SwordItem in class SwordItem cannot be applied to given types; elements.items.add(() -> new SwordItem(new IItemTier() {
^
required: DungeonsModModElements
found: <anonymous IItemTier>,int,float,Properties
reason: actual and formal argument lists differ in length
C:\Users\gabea\MCreatorWorkspaces\dungeons_mod\src\main\java\net\mcreator\dungeonsmod\item\SwordItem.java:55: error: method does not override or implement a method from a supertype @Override
^
C:\Users\gabea\MCreatorWorkspaces\dungeons_mod\src\main\java\net\mcreator\dungeonsmod\item\SwordItem.java:57: error: cannot find symbol super.addInformation(itemstack, world, list, flag);
^
symbol: method addInformation(ItemStack,World,List<ITextComponent>,ITooltipFlag)
3 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#se…
BUILD FAILED in 2s
1 actionable task: 1 executed
BUILD FAILED
Task completed in 4875 milliseconds
 

You named your element "Sword" This is too generic name already used by Minecraft core classes and it clashes.

When making new element, you are warned to not use such generic names, please follow the messages in order to use this tool properly. Thanks!

Awesome, thank you! I tried before to add a new sword that was named something different and it still had a compilation error for whatever reason, but if I got rid of the original the new one no longer had any problems.

error for whatever reason, but if I got rid of the original the new one no longer had any problems.

Because old one still existed and still had generic name



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.