    001package net.minecraft.client.renderer.texture;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005
    006@SideOnly(Side.CLIENT)
    007public class Rect2i
    008{
    009    private int rectX;
    010    private int rectY;
    011    private int rectWidth;
    012    private int rectHeight;
    013
    014    public Rect2i(int par1, int par2, int par3, int par4)
    015    {
    016        this.rectX = par1;
    017        this.rectY = par2;
    018        this.rectWidth = par3;
    019        this.rectHeight = par4;
    020    }
    021
    022    public Rect2i intersection(Rect2i par1Rect2i)
    023    {
    024        int i = this.rectX;
    025        int j = this.rectY;
    026        int k = this.rectX + this.rectWidth;
    027        int l = this.rectY + this.rectHeight;
    028        int i1 = par1Rect2i.getRectX();
    029        int j1 = par1Rect2i.getRectY();
    030        int k1 = i1 + par1Rect2i.getRectWidth();
    031        int l1 = j1 + par1Rect2i.getRectHeight();
    032        this.rectX = Math.max(i, i1);
    033        this.rectY = Math.max(j, j1);
    034        this.rectWidth = Math.max(0, Math.min(k, k1) - this.rectX);
    035        this.rectHeight = Math.max(0, Math.min(l, l1) - this.rectY);
    036        return this;
    037    }
    038
    039    public int getRectX()
    040    {
    041        return this.rectX;
    042    }
    043
    044    public int getRectY()
    045    {
    046        return this.rectY;
    047    }
    048
    049    public int getRectWidth()
    050    {
    051        return this.rectWidth;
    052    }
    053
    054    public int getRectHeight()
    055    {
    056        return this.rectHeight;
    057    }
    058}