-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed unnecessary sided-create supplier method
- Loading branch information
1 parent
ff74ca9
commit c81e3e2
Showing
3 changed files
with
11 additions
and
30 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
17 changes: 1 addition & 16 deletions
17
...v/genshinstrument/client/gui/screens/instrument/partial/note/label/NoteLabelSupplier.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 |
---|---|---|
@@ -1,30 +1,15 @@ | ||
package com.cstav.genshinstrument.client.gui.screens.instrument.partial.note.label; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import com.cstav.genshinstrument.client.gui.screens.instrument.partial.note.NoteButton; | ||
|
||
import net.minecraft.network.chat.Component; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
import net.minecraftforge.fml.loading.FMLEnvironment; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
@FunctionalInterface | ||
public interface NoteLabelSupplier { | ||
public static final NoteLabelSupplier EMPTY = create(() -> (note) -> Component.empty()); | ||
|
||
/** | ||
* Creates a new common-sided NoteLabelSupplier. | ||
* Its result will always return null if {@link FMLEnvironment#dist} is not set to {@link Dist#CLIENT}. | ||
* @param sup A supplier that holds the label supplier | ||
*/ | ||
public static NoteLabelSupplier create(final Supplier<NoteLabelSupplier> sup) { | ||
return (FMLEnvironment.dist == Dist.CLIENT) | ||
? (note) -> sup.get().get(note) | ||
: null | ||
; | ||
} | ||
public static final NoteLabelSupplier EMPTY = (note) -> Component.empty(); | ||
|
||
public Component get(final NoteButton note); | ||
} |