blob: 2b07e6edd99db1441dfcf41b126227e65b16fe6a (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Copyright (c) 2018, 2019, 2020 shedaniel
* Licensed under the MIT License (the "License").
*/
package me.shedaniel.rei.gui.widget;
import me.shedaniel.math.api.Point;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.AbstractParentElement;
import net.minecraft.client.gui.Drawable;
/**
* The base class for a screen widget
*
* @see WidgetWithBounds for a widget with bounds
*/
public abstract class Widget extends AbstractParentElement implements Drawable {
/**
* The Minecraft Client instance
*/
protected final MinecraftClient minecraft = MinecraftClient.getInstance();
/**
* The font for rendering text
*/
protected final TextRenderer font = minecraft.textRenderer;
public int getZ() {
return this.getBlitOffset();
}
public void setZ(int z) {
this.setBlitOffset(z);
}
public boolean containsMouse(double mouseX, double mouseY) {
return false;
}
public final boolean containsMouse(int mouseX, int mouseY) {
return containsMouse((double) mouseX, (double) mouseY);
}
public final boolean containsMouse(Point point) {
return containsMouse(point.x, point.y);
}
@Override
public final boolean isMouseOver(double double_1, double double_2) {
return containsMouse(double_1, double_2);
}
}
|