57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.client.gui.narration;
 | |
| 
 | |
| import java.util.Collection;
 | |
| import java.util.List;
 | |
| import net.fabricmc.api.EnvType;
 | |
| import net.fabricmc.api.Environment;
 | |
| import net.minecraft.client.gui.components.TabOrderedElement;
 | |
| 
 | |
| /**
 | |
|  * An interface for GUI elements that can provide narration information.
 | |
|  */
 | |
| @Environment(EnvType.CLIENT)
 | |
| public interface NarratableEntry extends TabOrderedElement, NarrationSupplier {
 | |
| 	/**
 | |
| 	 * {@return the narration priority}
 | |
| 	 */
 | |
| 	NarratableEntry.NarrationPriority narrationPriority();
 | |
| 
 | |
| 	/**
 | |
| 	 * {@return {@code true} if the element is active, {@code false} otherwise}
 | |
| 	 */
 | |
| 	default boolean isActive() {
 | |
| 		return true;
 | |
| 	}
 | |
| 
 | |
| 	default Collection<? extends NarratableEntry> getNarratables() {
 | |
| 		return List.of(this);
 | |
| 	}
 | |
| 
 | |
| 	/**
 | |
| 	 * The narration priority levels.
 | |
| 	 */
 | |
| 	@Environment(EnvType.CLIENT)
 | |
| 	public static enum NarrationPriority {
 | |
| 		/**
 | |
| 		 * No narration priority.
 | |
| 		 */
 | |
| 		NONE,
 | |
| 		/**
 | |
| 		 * Narration priority when the element is being hovered.
 | |
| 		 */
 | |
| 		HOVERED,
 | |
| 		/**
 | |
| 		 * Narration priority when the element is focused.
 | |
| 		 */
 | |
| 		FOCUSED;
 | |
| 
 | |
| 		/**
 | |
| 		 * Checks if the narration priority is terminal, indicating that no further narration will occur after this.
 | |
| 		 * <p>
 | |
| 		 * @return {@code true} if the narration priority is terminal, {@code false} otherwise.
 | |
| 		 */
 | |
| 		public boolean isTerminal() {
 | |
| 			return this == FOCUSED;
 | |
| 		}
 | |
| 	}
 | |
| }
 |