-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Restructure some things, prepare WaystoneUserSettings
- Loading branch information
1 parent
38c8678
commit 405e440
Showing
16 changed files
with
439 additions
and
365 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
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
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
25 changes: 25 additions & 0 deletions
25
shared/src/main/java/net/blay09/mods/waystones/comparator/UserSortingComparator.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.blay09.mods.waystones.comparator; | ||
|
||
import net.blay09.mods.waystones.api.IWaystone; | ||
import net.blay09.mods.waystones.core.PlayerWaystoneManager; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
import java.util.Comparator; | ||
|
||
public class UserSortingComparator implements Comparator<IWaystone> { | ||
|
||
private final Player player; | ||
|
||
public UserSortingComparator(Player player) { | ||
this.player = player; | ||
} | ||
|
||
@Override | ||
public int compare(IWaystone o1, IWaystone o2) { | ||
final var settings1 = PlayerWaystoneManager.getUserSettingsForWaystone(player, o1); | ||
final var settings2 = PlayerWaystoneManager.getUserSettingsForWaystone(player, o2); | ||
final var sortIndex1 = settings1.sortIndex(); | ||
final var sortIndex2 = settings2.sortIndex(); | ||
return Integer.compare(sortIndex1, sortIndex2); | ||
} | ||
} |
Oops, something went wrong.