Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Update to 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Nov 30, 2021
1 parent 5f88a6a commit 58cbab9
Show file tree
Hide file tree
Showing 31 changed files with 122 additions and 170 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Illuminations - Changelog:

### Illuminations 1.10.2 - 1.18
- Update to Minecraft 1.18

### Illuminations 1.10.1 - 1.17.1
- Added two integrated resource packs that control the firefly, glowworm and plankton texture. Two options are now available: "lowerres", a lower resolution of the firefly texture, and "pixelaccurate", a firefly texture made to look like the Minecraft Live 2021 firefly announced for the Wild Update
- Added a debug mode config option to enable debug mode logs to troubleshoot issues with cosmetics loading
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'org.ajoberstar.grgit' version '3.1.1'
id 'com.github.breadmoirai.github-release' version '2.2.12'
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// Adds a few utility methods like getProjectProperty
apply from: 'https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/utilities.gradle'
apply from: 'https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/fabric/publish/changelog.gradle'
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.61
loader_version=0.11.6
minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.6

#Fabric api
fabric_version=0.36.1+1.17
fabric_version=0.43.1+1.18

# Mod Properties
mod_version = 1.10.1
mod_version = 1.10.2
maven_group = io.github.ladysnake
archives_base_name = illuminations

Expand All @@ -24,7 +24,7 @@ satin_version = 1.+
owners = Ladysnake
license_header = GPL-3.0-or-later
curseforge_id = 292908
curseforge_versions = 1.17; 1.17.1
curseforge_versions = 1.18
cf_requirements = fabric-api
release_type = release
changelog_url = https://github.com/Ladysnake/Illuminations/blob/main/CHANGELOG.md
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 15 additions & 10 deletions src/main/java/ladysnake/illuminations/client/Illuminations.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public class Illuminations implements ClientModInitializer {
}.getType();
// illuminations cosmetics
private static final String COSMETICS_URL = "https://illuminations.uuid.gg/data";
private static Map<UUID, PlayerCosmeticData> PLAYER_COSMETICS = Collections.emptyMap();
public static ImmutableMap<String, AuraData> AURAS_DATA;
public static ImmutableMap<String, DefaultParticleType> PETS_DATA;
public static ImmutableMap<String, OverheadData> OVERHEADS_DATA;
Expand Down Expand Up @@ -149,6 +148,7 @@ public class Illuminations implements ClientModInitializer {
// spawn biome categories and biomes
public static ImmutableMap<BiomeCategory, ImmutableSet<IlluminationData>> ILLUMINATIONS_BIOME_CATEGORIES;
public static ImmutableMap<Identifier, ImmutableSet<IlluminationData>> ILLUMINATIONS_BIOMES;
private static Map<UUID, PlayerCosmeticData> PLAYER_COSMETICS = Collections.emptyMap();

public static @Nullable PlayerCosmeticData getCosmeticData(PlayerEntity player) {
return PLAYER_COSMETICS.get(player.getUuid());
Expand All @@ -162,29 +162,38 @@ public static void loadPlayerCosmetics() {
// get illuminations player cosmetics
CompletableFuture.supplyAsync(() -> {
try (Reader reader = new InputStreamReader(new URL(COSMETICS_URL).openStream())) {
if (Config.isDebugMode()) logger.log(Level.INFO, "Retrieving Illuminations cosmetics from the dashboard...");
if (Config.isDebugMode())
logger.log(Level.INFO, "Retrieving Illuminations cosmetics from the dashboard...");
return COSMETICS_GSON.<Map<UUID, PlayerCosmeticData>>fromJson(reader, COSMETIC_SELECT_TYPE);
} catch (MalformedURLException e) {
if (Config.isDebugMode()) logger.log(Level.ERROR, "Could not get player cosmetics because of malformed URL: " + e.getMessage());
if (Config.isDebugMode())
logger.log(Level.ERROR, "Could not get player cosmetics because of malformed URL: " + e.getMessage());
} catch (IOException e) {
if (Config.isDebugMode()) logger.log(Level.ERROR, "Could not get player cosmetics because of I/O Error: " + e.getMessage());
if (Config.isDebugMode())
logger.log(Level.ERROR, "Could not get player cosmetics because of I/O Error: " + e.getMessage());
}

return null;
}).exceptionally(throwable -> {
if (Config.isDebugMode()) logger.log(Level.ERROR, "Could not get player cosmetics because wtf is happening", throwable);
if (Config.isDebugMode())
logger.log(Level.ERROR, "Could not get player cosmetics because wtf is happening", throwable);
return null;
}).thenAcceptAsync(playerData -> {
if (playerData != null) {
PLAYER_COSMETICS = playerData;
if (Config.isDebugMode()) logger.log(Level.INFO, "Player cosmetics successfully registered");
} else {
PLAYER_COSMETICS = Collections.emptyMap();
if (Config.isDebugMode()) logger.log(Level.WARN, "Player cosmetics could not registered, cosmetics will be ignored");
if (Config.isDebugMode())
logger.log(Level.WARN, "Player cosmetics could not registered, cosmetics will be ignored");
}
}, MinecraftClient.getInstance());
}

public static boolean isNightTime(World world) {
return world.getSkyAngle(world.getTimeOfDay()) >= 0.25965086 && world.getSkyAngle(world.getTimeOfDay()) <= 0.7403491;
}

@Override
public void onInitializeClient() {
// load config
Expand Down Expand Up @@ -435,8 +444,4 @@ public PlayerCosmeticData deserialize(JsonElement json, Type typeOfT, JsonDeseri
, jsonObject.get("pet"));
}
}

public static boolean isNightTime(World world) {
return world.getSkyAngle(world.getTimeOfDay()) >= 0.25965086 && world.getSkyAngle(world.getTimeOfDay()) <= 0.7403491;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
package ladysnake.illuminations.client;

import static ladysnake.illuminations.client.enums.BiomeCategory.*;

import com.google.common.base.CaseFormat;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import ladysnake.illuminations.client.config.Config;
import ladysnake.illuminations.client.config.DefaultConfig;
import ladysnake.illuminations.client.data.BiomeSettings;
import ladysnake.illuminations.client.enums.BiomeCategory;
import ladysnake.illuminations.client.enums.EyesInTheDarkSpawnRate;
import ladysnake.illuminations.client.enums.FireflySpawnRate;
import ladysnake.illuminations.client.enums.GlowwormSpawnRate;
import ladysnake.illuminations.client.enums.PlanktonSpawnRate;
import ladysnake.illuminations.client.enums.WillOWispsSpawnRate;
import ladysnake.illuminations.client.enums.HalloweenFeatures;
import ladysnake.illuminations.client.enums.*;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
Expand All @@ -26,6 +18,8 @@

import java.util.HashMap;

import static ladysnake.illuminations.client.enums.BiomeCategory.OTHER;

public class IlluminationsModMenuIntegration implements ModMenuApi {

private ConfigBuilder builder;
Expand Down Expand Up @@ -175,7 +169,7 @@ private void GenerateBiomeSettings() {
for (Identifier dimension : BiomeCategory.getDimensions()) {
String name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, dimension.getPath());
ConfigCategory category = builder.getOrCreateCategory(new TranslatableText("category.illuminations." + name));
category.setDescription(new StringVisitable[] { new TranslatableText("category.illuminations." + name + ".description") });
category.setDescription(new StringVisitable[]{new TranslatableText("category.illuminations." + name + ".description")});
biomeCategories.put(dimension, category);
}

Expand Down
55 changes: 17 additions & 38 deletions src/main/java/ladysnake/illuminations/client/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@

import com.google.common.base.CaseFormat;
import ladysnake.illuminations.client.data.BiomeSettings;
import ladysnake.illuminations.client.enums.BiomeCategory;
import ladysnake.illuminations.client.enums.HalloweenFeatures;
import ladysnake.illuminations.client.enums.EyesInTheDarkSpawnRate;
import ladysnake.illuminations.client.enums.FireflySpawnRate;
import ladysnake.illuminations.client.enums.GlowwormSpawnRate;
import ladysnake.illuminations.client.enums.PlanktonSpawnRate;
import ladysnake.illuminations.client.enums.WillOWispsSpawnRate;
import ladysnake.illuminations.client.enums.*;
import net.fabricmc.loader.api.FabricLoader;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.*;
import java.util.function.Consumer;

public class Config {
Expand Down Expand Up @@ -189,8 +177,7 @@ public static EyesInTheDarkSpawnRate getEyesInTheDarkSpawnRate() {
return eyesInTheDarkSpawnRate;
}

public static void setEyesInTheDarkSpawnRate(EyesInTheDarkSpawnRate value)
{
public static void setEyesInTheDarkSpawnRate(EyesInTheDarkSpawnRate value) {
eyesInTheDarkSpawnRate = value;
config.setProperty("eyes-in-the-dark-spawn-rate", value.name());
}
Expand All @@ -199,8 +186,7 @@ public static WillOWispsSpawnRate getWillOWispsSpawnRate() {
return willOWispsSpawnRate;
}

public static void setWillOWispsSpawnRate(WillOWispsSpawnRate value)
{
public static void setWillOWispsSpawnRate(WillOWispsSpawnRate value) {
willOWispsSpawnRate = value;
config.setProperty("will-o-wisps-spawn-rate", value.name());
}
Expand Down Expand Up @@ -232,13 +218,11 @@ public static void setFireflySpawnAlways(boolean value) {
config.setProperty("firefly-spawn-always", Boolean.toString(value));
}

public static boolean doesFireflySpawnUnderground()
{
public static boolean doesFireflySpawnUnderground() {
return fireflySpawnUnderground;
}

public static void setFireflySpawnUnderground(boolean value)
{
public static void setFireflySpawnUnderground(boolean value) {
fireflySpawnUnderground = value;
config.setProperty("firefly-spawn-underground", Boolean.toString(value));
}
Expand Down Expand Up @@ -306,52 +290,47 @@ public static void setDisplayDonationToast(boolean value) {
config.setProperty("display-donation-toast", Boolean.toString(value));
}

public static Map<BiomeCategory, BiomeSettings> getBiomeSettings()
{
public static Map<BiomeCategory, BiomeSettings> getBiomeSettings() {
return biomeSettings;
}

public static BiomeSettings getBiomeSettings(BiomeCategory biome)
{
public static BiomeSettings getBiomeSettings(BiomeCategory biome) {
return biomeSettings.get(biome);
}

public static void setBiomeSettings(BiomeCategory biome, BiomeSettings settings)
{
public static void setBiomeSettings(BiomeCategory biome, BiomeSettings settings) {
biomeSettings.put(biome, settings);
String name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, biome.name());
config.setProperty(name + "-firefly-spawn-rate", settings.fireflySpawnRate().name());
config.setProperty(name + "-firefly-color", Integer.toString(settings.fireflyColor(), 16));
if (settings.glowwormSpawnRate() != null) config.setProperty(name + "-glowworm-spawn-rate", settings.glowwormSpawnRate().name());
if (settings.planktonSpawnRate() != null) config.setProperty(name + "-plankton-spawn-rate", settings.planktonSpawnRate().name());
if (settings.glowwormSpawnRate() != null)
config.setProperty(name + "-glowworm-spawn-rate", settings.glowwormSpawnRate().name());
if (settings.planktonSpawnRate() != null)
config.setProperty(name + "-plankton-spawn-rate", settings.planktonSpawnRate().name());
}

public static void setFireflySettings(BiomeCategory biome, FireflySpawnRate value)
{
public static void setFireflySettings(BiomeCategory biome, FireflySpawnRate value) {
BiomeSettings settings = biomeSettings.get(biome);
biomeSettings.put(biome, settings.withFireflySpawnRate(value));
String name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, biome.name());
config.setProperty(name + "-firefly-spawn-rate", value.name());
}

public static void setFireflyColorSettings(BiomeCategory biome, int color)
{
public static void setFireflyColorSettings(BiomeCategory biome, int color) {
BiomeSettings settings = biomeSettings.get(biome);
biomeSettings.put(biome, settings.withFireflyColor(color));
String name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, biome.name());
config.setProperty(name + "-firefly-color", Integer.toString(color, 16));
}

public static void setGlowwormSettings(BiomeCategory biome, GlowwormSpawnRate value)
{
public static void setGlowwormSettings(BiomeCategory biome, GlowwormSpawnRate value) {
BiomeSettings settings = biomeSettings.get(biome);
biomeSettings.put(biome, settings.withGlowwormSpawnRate(value));
String name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, biome.name());
config.setProperty(name + "-glowworm-spawn-rate", value.name());
}

public static void setPlanktonSettings(BiomeCategory biome, PlanktonSpawnRate value)
{
public static void setPlanktonSettings(BiomeCategory biome, PlanktonSpawnRate value) {
BiomeSettings settings = biomeSettings.get(biome);
biomeSettings.put(biome, settings.withPlanktonSpawnRate(value));
String name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, biome.name());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package ladysnake.illuminations.client.config;

import static ladysnake.illuminations.client.enums.BiomeCategory.*;

import com.google.common.collect.ImmutableMap;
import ladysnake.illuminations.client.data.AuraSettings;
import ladysnake.illuminations.client.data.BiomeSettings;
import ladysnake.illuminations.client.enums.BiomeCategory;
import ladysnake.illuminations.client.enums.HalloweenFeatures;
import ladysnake.illuminations.client.enums.EyesInTheDarkSpawnRate;
import ladysnake.illuminations.client.enums.FireflySpawnRate;
import ladysnake.illuminations.client.enums.GlowwormSpawnRate;
import ladysnake.illuminations.client.enums.PlanktonSpawnRate;
import ladysnake.illuminations.client.enums.WillOWispsSpawnRate;
import ladysnake.illuminations.client.enums.*;

import static ladysnake.illuminations.client.enums.BiomeCategory.*;

public final class DefaultConfig {

Expand Down Expand Up @@ -78,15 +72,15 @@ public final class DefaultConfig {
.put("prismarine", new AuraSettings(0.1f, 1))
.build();

private DefaultConfig() {
throw new UnsupportedOperationException();
}

public static BiomeSettings getBiomeSettings(BiomeCategory biome) {
return BIOME_SETTINGS.get(biome);
}

public static AuraSettings getAuraSettings(String aura) {
return AURA_SETTINGS.get(aura);
}

private DefaultConfig() {
throw new UnsupportedOperationException();
}
}
Loading

0 comments on commit 58cbab9

Please sign in to comment.