User Tools

Site Tools


tutorial:propertydelegates

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:propertydelegates [2020/08/14 17:14] – [Our new ScreenHandler] manymoney2tutorial:propertydelegates [2020/08/14 17:18] – [Showing the Information with the Screen] manymoney2
Line 133: Line 133:
  
 ====== Showing the Information with the Screen ====== ====== Showing the Information with the Screen ======
 +As the screen gets the ScreenHandler in its constructor, we have access to the property delegate from above and can render the integer on screen
 <code java [enable_line_numbers="true"] BoxScreen.java> <code java [enable_line_numbers="true"] BoxScreen.java>
  
Line 169: Line 169:
  
 </code> </code>
 +
 +====== Result ======
 +As the registration of the ScreenHandler is identical to the first tutorial we can see the result already!
 +When the BlockEntity is placed it will increase the syncedInt by one each tick, when we look inside the container the integer will
 +automatically be synced to the client and rendered in the top left corner.
 +
 +
 +
 +If you want a more realistic example, you might want to have a look at AbstractFurnaceEntity and AbstractFurnaceScreenHandler in the minecraft code.
  
  
tutorial/propertydelegates.txt · Last modified: 2022/05/27 16:00 by solidblock