41 lines
859 B
Java
41 lines
859 B
Java
package net.minecraft.client.gui.components.events;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public abstract class AbstractContainerEventHandler implements ContainerEventHandler {
|
|
@Nullable
|
|
private GuiEventListener focused;
|
|
private boolean isDragging;
|
|
|
|
@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;
|
|
}
|
|
}
|