aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
blob: f912b33c5229b633aca5affdcb9354d149debd9a (plain)
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
package me.shedaniel.rei.api;

import me.shedaniel.rei.RoughlyEnoughItemsCore;

import java.awt.*;
import java.util.List;

public interface DisplayHelper {
    
    List<DisplayBoundsHandler> getSortedBoundsHandlers(Class screenClass);
    
    DisplayBoundsHandler getResponsibleBoundsHandler(Class screenClass);
    
    void registerBoundsHandler(DisplayBoundsHandler handler);
    
    public static interface DisplayBoundsHandler<T> {
        Class getBaseSupportedClass();
        
        Rectangle getLeftBounds(T screen);
        
        Rectangle getRightBounds(T screen);
        
        default Rectangle getItemListArea(Rectangle rectangle) {
            return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField ? 27 + 22 : 27));
        }
        
        default float getPriority() {
            return 0f;
        }
    }
    
}