import org.darkstorm.minecraft.gui.component.Frame; //导入方法依赖的package包/类
@Override
protected void handleComponentInteraction(Frame component, Point location, int button) {
if (button != 0) return;
int offset = component.getWidth() - 2;
int textHeight = theme.getFontRenderer().FONT_HEIGHT;
if (component.isClosable()) {
if (location.x >= offset - textHeight && location.x <= offset && location.y >= 2 &&
location.y <= textHeight + 2) {
component.close();
return;
}
offset -= textHeight + 2;
}
if (component.isPinnable()) {
if (location.x >= offset - textHeight && location.x <= offset && location.y >= 2 &&
location.y <= textHeight + 2) {
component.setPinned(!component.isPinned());
WurstClient.INSTANCE.files.saveGUI(WurstClient.INSTANCE.gui.getFrames());
return;
}
offset -= textHeight + 2;
}
if (component.isMinimizable()) {
if (location.x >= offset - textHeight && location.x <= offset && location.y >= 2 &&
location.y <= textHeight + 2) {
component.setMinimized(!component.isMinimized());
WurstClient.INSTANCE.files.saveGUI(WurstClient.INSTANCE.gui.getFrames());
return;
}
offset -= textHeight + 2;
}
if (location.x >= 0 && location.x <= offset && location.y >= 0 && location.y <= textHeight + 4) {
component.setDragging(true);
}
}