-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/mchorse/mclib/client/gui/utils/GuiDrawable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package mchorse.mclib.client.gui.utils; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import mchorse.mclib.client.gui.framework.GuiTooltip; | ||
import mchorse.mclib.client.gui.framework.elements.IGuiElement; | ||
|
||
public class GuiDrawable implements IGuiElement | ||
{ | ||
public Consumer<Void> callback; | ||
|
||
public GuiDrawable(Consumer<Void> callback) | ||
{ | ||
this.callback = callback; | ||
} | ||
|
||
@Override | ||
public void resize(int width, int height) | ||
{} | ||
|
||
@Override | ||
public boolean isEnabled() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isVisible() | ||
{ | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean mouseScrolled(int mouseX, int mouseY, int scroll) | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public void mouseReleased(int mouseX, int mouseY, int state) | ||
{} | ||
|
||
@Override | ||
public boolean hasActiveTextfields() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public void keyTyped(char typedChar, int keyCode) | ||
{} | ||
|
||
@Override | ||
public void draw(GuiTooltip tooltip, int mouseX, int mouseY, float partialTicks) | ||
{ | ||
if (this.callback != null) | ||
{ | ||
this.callback.accept(null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters