0
\$\begingroup\$

I'm trying to make a tool pack but every time I get the message:

New Dep: net.minecraftforge:forge:1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1 
> Task :compileJava FAILED 
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianAxeItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianHoeItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 
C:\Users\\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianPickaxeItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianShovelItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianSwordItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 
5 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#sec:command_line_warnings 
BUILD FAILED in 7s 
1 actionable task: 1 executed 
BUILD FAILED

\$\endgroup\$
2
  • \$\begingroup\$ Can you show us the neighborhood of line 43 in ObsidianAxeItem.java ? \$\endgroup\$ – DMGregory Apr 4 at 0:36
  • \$\begingroup\$ how do i do that? \$\endgroup\$ – user149825 Apr 4 at 0:38
0
\$\begingroup\$

The first five lines are indicating where you have errors. Looking at the first one:

C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianAxeItem.java:43: error: illegal start of expression 
                     new ItemStack(, (int)(1)) 
                                   ^ 

This tell us that the code file ObsidianAxeItem.java has an error on line 43. The specific problem is the expression new ItemStack(, (int)(1)).

The ^ symbol underneath indicates where the problem is. In this case, your leading off with a , symbol in the parameter list for the ItemStack constructor.

The other four errors are similar, but in different code files. In terms of fixing the problem, you either need to remove the offending comma or possibly add one or more parameters in front of it. According to the ItemStack documentation I found, here are the valid ways to make a new ItemStack

ItemStack(Block blockIn) 
ItemStack(Block blockIn, int amount) 
ItemStack(Block blockIn, int amount, int meta) 
ItemStack(Item itemIn) 
ItemStack(Item itemIn, int amount) 
ItemStack(Item itemIn, int amount, int meta) 
ItemStack(Item itemIn, int amount, int meta, NBTTagCompound capNBT)

I can't definitively say how to correct this because I don't know what the code originally looked like or what changes you were trying to make, but this should give you a start on fixing the errors.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.