User Tools

Site Tools


tutorial:events

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:events [2019/07/03 00:22] – clarified sheep setSheared method draylartutorial:events [2019/07/03 00:29] – added javadoc description draylar
Line 50: Line 50:
  
 return ActionResult.PASS; return ActionResult.PASS;
 +</code>
 +
 +In the [[https://github.com/FabricMC/fabric|Fabric API]], we add Javadoc comments to the top of callback classes to document what each ActionResult does. In our case, it might be:
 +<code java [enable_line_numbers="false"]>
 +/**
 + * Callback for shearing a sheep.
 + * Called before the sheep is sheared, items are dropped, and items are damaged.
 + * Upon return:
 + * - SUCCESS cancels further processing and continues with normal shearing behavior.
 + * - PASS falls back to further processing and defaults to SUCCESS if no other listeners are available
 + * - FAIL cancels further processing and does not shear the sheep.
 +/**
 </code> </code>
  
tutorial/events.txt · Last modified: 2021/05/28 00:31 by 127.0.0.1