File size: 1,989 Bytes
d46f4a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package net.minecraft.client.renderer;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class Rect2i {
    private int xPos;
    private int yPos;
    private int width;
    private int height;

    public Rect2i(int p_110081_, int p_110082_, int p_110083_, int p_110084_) {
        this.xPos = p_110081_;
        this.yPos = p_110082_;
        this.width = p_110083_;
        this.height = p_110084_;
    }

    public Rect2i intersect(Rect2i p_173053_) {
        int i = this.xPos;
        int j = this.yPos;
        int k = this.xPos + this.width;
        int l = this.yPos + this.height;
        int i1 = p_173053_.getX();
        int j1 = p_173053_.getY();
        int k1 = i1 + p_173053_.getWidth();
        int l1 = j1 + p_173053_.getHeight();
        this.xPos = Math.max(i, i1);
        this.yPos = Math.max(j, j1);
        this.width = Math.max(0, Math.min(k, k1) - this.xPos);
        this.height = Math.max(0, Math.min(l, l1) - this.yPos);
        return this;
    }

    public int getX() {
        return this.xPos;
    }

    public int getY() {
        return this.yPos;
    }

    public void setX(int p_173048_) {
        this.xPos = p_173048_;
    }

    public void setY(int p_173055_) {
        this.yPos = p_173055_;
    }

    public int getWidth() {
        return this.width;
    }

    public int getHeight() {
        return this.height;
    }

    public void setWidth(int p_173057_) {
        this.width = p_173057_;
    }

    public void setHeight(int p_173059_) {
        this.height = p_173059_;
    }

    public void setPosition(int p_173050_, int p_173051_) {
        this.xPos = p_173050_;
        this.yPos = p_173051_;
    }

    public boolean contains(int p_110088_, int p_110089_) {
        return p_110088_ >= this.xPos
            && p_110088_ <= this.xPos + this.width
            && p_110089_ >= this.yPos
            && p_110089_ <= this.yPos + this.height;
    }
}