This repository was archived by the owner on Aug 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/main/java/org/lins/mmmjjkx/rykenslimefuncustomizer/objects/machine Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1010import org .jetbrains .annotations .Nullable ;
1111import org .lins .mmmjjkx .rykenslimefuncustomizer .objects .customs .machine .CustomMachine ;
1212
13+ /**
14+ * This data class provides access to machine data for JavaScript integration.
15+ *
16+ * @param blockMenu the menu of the machine, may be null if the machine has no GUI.
17+ * @param data the persistent data of the machine.
18+ * @param machineItem the {@link SlimefunItem} instance of the machine.
19+ * @param block the physical {@link Block} instance of the machine.
20+ * @param processor the {@link MachineProcessor} handling the machine's logic.
21+ * @param operation the current {@link MachineOperation}, ALWAYS be null so far...
22+ * @param machine the {@link CustomMachine} instance defining the machine's behavior.
23+ * @author lijinhong11
24+ *
25+ * <h3>JavaScript Usage Example:</h3>
26+ * <pre>{@code
27+ * function tick(info) {
28+ * // May be null
29+ * var menu = info.blockMenu();
30+ * // Access Java fields in JavaScript should like this:
31+ * // var yourObjectName = info.<recordName>();
32+ * // For example:
33+ * // var block = info.block();
34+ *
35+ * if (menu !== null) {
36+ * // See Slimefun API for more details
37+ * var item = blockMenu.getItemInSlot(0);
38+ * }
39+ *
40+ * // Displayed name
41+ * var itemName = info.machineItem().getItemName();
42+ * }
43+ * }</pre>
44+ */
1345public record MachineInfo (
1446 @ Nullable BlockMenu blockMenu ,
1547 SlimefunBlockData data ,
You can’t perform that action at this time.
0 commit comments