84 lines
		
	
	
	
		
			2.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
	
		
			2.3 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.client.gui.components;
 | |
| 
 | |
| import net.fabricmc.api.EnvType;
 | |
| import net.fabricmc.api.Environment;
 | |
| import net.minecraft.client.gui.ComponentPath;
 | |
| import net.minecraft.client.gui.components.events.ContainerEventHandler;
 | |
| import net.minecraft.client.gui.components.events.GuiEventListener;
 | |
| import net.minecraft.client.gui.navigation.FocusNavigationEvent;
 | |
| import net.minecraft.network.chat.Component;
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| @Environment(EnvType.CLIENT)
 | |
| public abstract class AbstractContainerWidget extends AbstractScrollArea implements ContainerEventHandler {
 | |
| 	@Nullable
 | |
| 	private GuiEventListener focused;
 | |
| 	private boolean isDragging;
 | |
| 
 | |
| 	public AbstractContainerWidget(int i, int j, int k, int l, Component component) {
 | |
| 		super(i, j, k, l, component);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public final boolean isDragging() {
 | |
| 		return this.isDragging;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public final void setDragging(boolean isDragging) {
 | |
| 		this.isDragging = isDragging;
 | |
| 	}
 | |
| 
 | |
| 	@Nullable
 | |
| 	@Override
 | |
| 	public GuiEventListener getFocused() {
 | |
| 		return this.focused;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void setFocused(@Nullable GuiEventListener focused) {
 | |
| 		if (this.focused != null) {
 | |
| 			this.focused.setFocused(false);
 | |
| 		}
 | |
| 
 | |
| 		if (focused != null) {
 | |
| 			focused.setFocused(true);
 | |
| 		}
 | |
| 
 | |
| 		this.focused = focused;
 | |
| 	}
 | |
| 
 | |
| 	@Nullable
 | |
| 	@Override
 | |
| 	public ComponentPath nextFocusPath(FocusNavigationEvent event) {
 | |
| 		return ContainerEventHandler.super.nextFocusPath(event);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean mouseClicked(double mouseX, double mouseY, int button) {
 | |
| 		boolean bl = this.updateScrolling(mouseX, mouseY, button);
 | |
| 		return ContainerEventHandler.super.mouseClicked(mouseX, mouseY, button) || bl;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean mouseReleased(double mouseX, double mouseY, int button) {
 | |
| 		super.mouseReleased(mouseX, mouseY, button);
 | |
| 		return ContainerEventHandler.super.mouseReleased(mouseX, mouseY, button);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) {
 | |
| 		super.mouseDragged(mouseX, mouseY, button, dragX, dragY);
 | |
| 		return ContainerEventHandler.super.mouseDragged(mouseX, mouseY, button, dragX, dragY);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean isFocused() {
 | |
| 		return ContainerEventHandler.super.isFocused();
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void setFocused(boolean focused) {
 | |
| 		ContainerEventHandler.super.setFocused(focused);
 | |
| 	}
 | |
| }
 |