Class TFileChooserBuilder
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.screen.explorer.TFileChooserBuilder
Sometimes the
TFileChooserScreen.showDialog(FileChooserDialogType, String, Consumer)
options are too limited, and you need more control over how the
TFileChooserScreen
will behave. This is where TFileChooserBuilder
comes in.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal TFileChooserBuilder
addFileFilter
(TFileFilter fileFilter) final TFileChooserBuilder
setParentScreen
(@Nullable net.minecraft.client.gui.screen.Screen parent) Sets theScreen
that will be opened after theTFileChooserScreen
closes.final TFileChooserBuilder
setStartingPath
(@Nullable Path startingPath) Sets thePath
that will be initially shown on theTFileChooserScreen
.final void
showDialog
(FileChooserDialogType dialogType, @Nullable String targetExtension, Consumer<TFileChooserResult> onComplete) Builds theTFileChooserScreen
and shows it usingMinecraftClient.setScreen(Screen)
.final void
showOpenFileDialog
(String targetExtension, Consumer<TFileChooserResult> onComplete) final void
showOpenFileDialog
(Consumer<TFileChooserResult> onComplete) final void
showSaveFileDialog
(String targetExtension, Consumer<TFileChooserResult> onComplete) final void
showSaveFileDialog
(Consumer<TFileChooserResult> onComplete) final void
showSelectDirectoryDialog
(Consumer<TFileChooserResult> onComplete)
-
Constructor Details
-
TFileChooserBuilder
protected TFileChooserBuilder()
-
-
Method Details
-
setParentScreen
public final TFileChooserBuilder setParentScreen(@Nullable @Nullable net.minecraft.client.gui.screen.Screen parent) Sets theScreen
that will be opened after theTFileChooserScreen
closes. -
setStartingPath
Sets thePath
that will be initially shown on theTFileChooserScreen
. -
addFileFilter
- Parameters:
fileFilter
- TheTFileFilter
to add.- Throws:
NullPointerException
-
showOpenFileDialog
-
showOpenFileDialog
public final void showOpenFileDialog(String targetExtension, Consumer<TFileChooserResult> onComplete) -
showSaveFileDialog
-
showSaveFileDialog
public final void showSaveFileDialog(String targetExtension, Consumer<TFileChooserResult> onComplete) -
showSelectDirectoryDialog
-
showDialog
public final void showDialog(FileChooserDialogType dialogType, @Nullable @Nullable String targetExtension, Consumer<TFileChooserResult> onComplete) Builds theTFileChooserScreen
and shows it usingMinecraftClient.setScreen(Screen)
.- Parameters:
dialogType
- TheTFileChooserScreen
'sFileChooserDialogType
.
-