Damage item event doesn't work

Status
Works as designed
Type
Product/platform
Not applicable
Priority
Normal
Issue description

The damage item event doesn't work. It makes recompilation fail.

Here is the code of the error (I made a debug item):

C:\Pylo\MCreator178\forge\build\sources\main\java\mod\mcreator\mcreator_testduration.java:98: error: cannot find symbol
                itemstack.damageItem(1, entity);
                ^
  symbol:   variable itemstack
  location: class Itemtestduration
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

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.

 

Issue comments

This event can only be used in some cases. We will improve the checks on when one can use it or when not in the future.

You can attach this event to On player hits entity with item only right now.



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.