-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add compatibility for serene seasons
- Loading branch information
1 parent
51cd97c
commit 74c2213
Showing
8 changed files
with
76 additions
and
13 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
12 changes: 12 additions & 0 deletions
12
src/main/java/randommcsomethin/fallingleaves/seasons/FabricSeasonsCompat.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,12 @@ | ||
package randommcsomethin.fallingleaves.seasons; | ||
|
||
public class FabricSeasonsCompat { | ||
public static Season convertSeason(io.github.lucaargolo.seasons.utils.Season season) { | ||
return switch (season) { | ||
case SPRING -> Season.SPRING; | ||
case SUMMER -> Season.SUMMER; | ||
case FALL -> Season.FALL; | ||
case WINTER -> Season.WINTER; | ||
}; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/randommcsomethin/fallingleaves/seasons/Season.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,9 @@ | ||
package randommcsomethin.fallingleaves.seasons; | ||
|
||
// abstract over Fabric Seasons and Serene Seasons | ||
public enum Season { | ||
SPRING, | ||
SUMMER, | ||
FALL, | ||
WINTER | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/randommcsomethin/fallingleaves/seasons/Seasons.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,29 @@ | ||
package randommcsomethin.fallingleaves.seasons; | ||
|
||
import io.github.lucaargolo.seasons.FabricSeasons; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.minecraft.client.world.ClientWorld; | ||
import org.jetbrains.annotations.Nullable; | ||
import randommcsomethin.fallingleaves.FallingLeavesClient; | ||
import sereneseasons.api.season.SeasonHelper; | ||
|
||
public class Seasons { | ||
@Nullable | ||
public static Season currentSeason = null; | ||
|
||
public static void tick(ClientWorld world) { | ||
Season newSeason = null; | ||
|
||
if (FabricLoader.getInstance().isModLoaded("seasons")) { | ||
newSeason = FabricSeasonsCompat.convertSeason(FabricSeasons.getCurrentSeason()); | ||
} else if (FabricLoader.getInstance().isModLoaded("sereneseasons")) { | ||
newSeason = SereneSeasonsCompat.convertSeason(SeasonHelper.getSeasonState(world).getSeason()); | ||
} | ||
|
||
if (currentSeason != newSeason) { | ||
FallingLeavesClient.LOGGER.debug("changed season {} -> {}", currentSeason, newSeason); | ||
} | ||
|
||
currentSeason = newSeason; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/randommcsomethin/fallingleaves/seasons/SereneSeasonsCompat.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,12 @@ | ||
package randommcsomethin.fallingleaves.seasons; | ||
|
||
public class SereneSeasonsCompat { | ||
public static Season convertSeason(sereneseasons.api.season.Season season) { | ||
return switch (season) { | ||
case SPRING -> Season.SPRING; | ||
case SUMMER -> Season.SUMMER; | ||
case AUTUMN -> Season.FALL; | ||
case WINTER -> Season.WINTER; | ||
}; | ||
} | ||
} |
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