forked from GeyserMC/Geyser
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0654d2d
commit 6338d1c
Showing
6 changed files
with
279 additions
and
83 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
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
65 changes: 65 additions & 0 deletions
65
api/src/main/java/org/geysermc/geyser/api/bedrock/gui/GuiData.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,65 @@ | ||
/* | ||
* Copyright (c) 2024 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.api.bedrock.gui; | ||
|
||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
import java.util.Set; | ||
|
||
public interface GuiData { | ||
/** | ||
* Hides a {@link GuiElement} on the client's side. | ||
* | ||
* @param element the {@link GuiElement} to hide | ||
*/ | ||
void hideElement(@NonNull GuiElement... element); | ||
|
||
/** | ||
* Resets a {@link GuiElement} on the client's side. | ||
* This makes the client decide on its own - e.g. based on client settings - | ||
* whether to show or hide the gui element. | ||
* <p> | ||
* If no elements are specified, this will reset all currently hidden elements | ||
* | ||
* @param element the {@link GuiElement} to reset | ||
*/ | ||
void resetElement(@NonNull GuiElement @Nullable ... element); | ||
|
||
/** | ||
* Determines whether a {@link GuiElement} is currently hidden. | ||
* | ||
* @param element the {@link GuiElement} to check | ||
*/ | ||
boolean isHudElementHidden(@NonNull GuiElement element); | ||
|
||
/** | ||
* Returns the currently hidden {@link GuiElement}s. | ||
* | ||
* @return an unmodifiable view of all currently hidden {@link GuiElement}s | ||
*/ | ||
@NonNull Set<GuiElement> hiddenElements(); | ||
} |
60 changes: 60 additions & 0 deletions
60
api/src/main/java/org/geysermc/geyser/api/bedrock/gui/GuiElement.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,60 @@ | ||
/* | ||
* Copyright (c) 2024 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.api.bedrock.gui; | ||
|
||
/** | ||
* Represent GUI elements on the players HUD display. | ||
* These can be hidden using {@link GuiData#hideElement(GuiElement...)}, | ||
* and one can reset their visibility using {@link GuiData#resetElement(GuiElement...)}. | ||
*/ | ||
public class GuiElement { | ||
public static final GuiElement PAPER_DOLL = new GuiElement(0); | ||
public static final GuiElement ARMOR = new GuiElement(1); | ||
public static final GuiElement TOOL_TIPS = new GuiElement(2); | ||
public static final GuiElement TOUCH_CONTROLS = new GuiElement(3); | ||
public static final GuiElement CROSSHAIR = new GuiElement(4); | ||
public static final GuiElement HOTBAR = new GuiElement(5); | ||
public static final GuiElement HEALTH = new GuiElement(6); | ||
public static final GuiElement PROGRESS_BAR = new GuiElement(7); | ||
public static final GuiElement FOOD_BAR = new GuiElement(8); | ||
public static final GuiElement AIR_BUBBLES_BAR = new GuiElement(9); | ||
public static final GuiElement VEHICLE_HEALTH = new GuiElement(10); | ||
public static final GuiElement EFFECTS_BAR = new GuiElement(11); | ||
public static final GuiElement ITEM_TEXT_POPUP = new GuiElement(12); | ||
|
||
public GuiElement(int id) { | ||
this.id = id; | ||
} | ||
|
||
private final int id; | ||
|
||
/** | ||
* Internal use only; don't depend on these values being consistent. | ||
*/ | ||
public int id() { | ||
return this.id; | ||
} | ||
} |
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
Oops, something went wrong.