MOD Lesson 6 / 10Free open classes

Light up a block with a click

BooleanProperty records "on" and "off"

Use BooleanProperty to save the switch status, right-click to switch the texture, brightness and prompt text, and correct the experimental loop in the template that will modify the blocks in batches.

Lesson goals

After completing this lesson

  • Understand the division of labor between BlockState and Property
  • Use BooleanProperty to save switch status
  • Connect Java, Blockstates, models and stickers
Works of this courseSimon energy lamp that can be switched on and off with the right button

Courseware

Read courseware online

The course is based on simon-minecraft-template-1.20 and contains an IntelliJ project screenshot, complete code, test and error.

Download PDF

The current browser cannot display PDF directly.

Download the courseware for this course