-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathRecipeTransferSyncHandler.java
More file actions
40 lines (34 loc) · 1.31 KB
/
Copy pathRecipeTransferSyncHandler.java
File metadata and controls
40 lines (34 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package gregtech.api.mui.sync;
import gregtech.api.mui.GregTechGuiScreen;
import gregtech.api.mui.IRecipeTransferReceiver;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.SyncHandler;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.MustBeInvokedByOverriders;
/**
* A base class for to handle implementing {@link IRecipeTransferReceiver} on a {@link SyncHandler}s to automatically
* register and unregister it from the map of valid handlers in {@link GregTechGuiScreen}.
*/
public abstract class RecipeTransferSyncHandler extends SyncHandler implements IRecipeTransferReceiver {
@ApiStatus.OverrideOnly
@MustBeInvokedByOverriders
@Override
public void init(String key, PanelSyncManager syncManager) {
super.init(key, syncManager);
if (syncManager.isClient()) {
GregTechGuiScreen.registerRecipeTransferHandler(getKey(), this, getTransferHandlerPriority());
}
}
protected int getTransferHandlerPriority() {
return 0;
}
@ApiStatus.OverrideOnly
@MustBeInvokedByOverriders
@Override
public void dispose() {
if (getSyncManager().isClient()) {
GregTechGuiScreen.removeRecipeTransferHandler(getKey());
}
super.dispose();
}
}