Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Commit 0bd728a

Browse files
authored
1 parent 75be89e commit 0bd728a

File tree

1 file changed

+32
-0
lines changed
  • src/main/java/org/lins/mmmjjkx/rykenslimefuncustomizer/objects/machine

1 file changed

+32
-0
lines changed

src/main/java/org/lins/mmmjjkx/rykenslimefuncustomizer/objects/machine/MachineInfo.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@
1010
import org.jetbrains.annotations.Nullable;
1111
import 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+
*/
1345
public record MachineInfo(
1446
@Nullable BlockMenu blockMenu,
1547
SlimefunBlockData data,

0 commit comments

Comments
 (0)