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

Commit

Permalink
Fix the default config version being attempted to be serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
florensie committed Apr 15, 2022
1 parent 35f5bf2 commit 2076a2f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [7.0.2] - 2022-04-15
### Fixed
- Fix the default config version being attempted to be serialized

## [7.0.1] - 2022-04-10
### Fixed
- Removed use of loom's interface injection as it caused issues with refmap remapping
Expand Down Expand Up @@ -245,8 +249,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[Unreleased]: https://github.com/florensie/artifacts-fabric/compare/v7.0.1...HEAD
[7.0.0]: https://github.com/florensie/artifacts-fabric/compare/v7.0.0...v7.0.1
[Unreleased]: https://github.com/florensie/artifacts-fabric/compare/v7.0.2...HEAD
[7.0.2]: https://github.com/florensie/artifacts-fabric/compare/v7.0.1...v7.0.2
[7.0.1]: https://github.com/florensie/artifacts-fabric/compare/v7.0.0...v7.0.1
[7.0.0]: https://github.com/florensie/artifacts-fabric/compare/v6.0.0...v7.0.0
[6.0.0]: https://github.com/florensie/artifacts-fabric/compare/v5.0.1...v6.0.0
[5.0.2]: https://github.com/florensie/artifacts-fabric/compare/v5.0.1...v5.0.2
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ minecraft_version=1.18.2-rc1
loader_version=0.13.3

# Mod Properties
mod_version=7.0.1
mod_version=7.0.2
maven_group=artifacts
archives_base_name=artifacts

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/artifacts/Artifacts.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public class Artifacts implements ModInitializer {
);
public static ModConfig CONFIG;

// The current/required version of the config file format
// Increase this if the config format has changed in an incompatible way
// When the game is loaded with an older config version, it will reset all values to their defaults
public static final int CONFIG_VERSION = 1;

@Override
@SuppressWarnings("ResultOfMethodCallIgnored")
public void onInitialize() {
Expand Down Expand Up @@ -60,7 +65,7 @@ private ModConfig getConfigAndInvalidateOldVersions() {
ConfigHolder<ModConfig> configHolder = AutoConfig.register(ModConfig.class,
PartitioningSerializer.wrap(Toml4jConfigSerializer::new));
int currentVersion = configHolder.getConfig().general.configVersion;
int requiredVersion = ModConfig.General.CONFIG_VERSION;
int requiredVersion = Artifacts.CONFIG_VERSION;
if (currentVersion != requiredVersion) {
LOGGER.warn("Resetting incompatible config with version {} to version {}", currentVersion, requiredVersion);
configHolder.resetToDefault();
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/artifacts/common/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ private ModConfig() {

@Config(name = "general")
public static final class General implements ConfigData {
// The current/required version of the config file format
// Increase this if the config format has changed in an incompatible way
// When the game is loaded with an older config version, it will reset all values to their defaults
public static final int CONFIG_VERSION = 1;

@SuppressWarnings("unused")
@ConfigEntry.Gui.Excluded
public int configVersion = CONFIG_VERSION;
public int configVersion = Artifacts.CONFIG_VERSION;
@ConfigEntry.Gui.Tooltip(count = 2)
public int everlastingFoodCooldown = 300;
@ConfigEntry.Gui.Tooltip(count = 2)
Expand Down

0 comments on commit 2076a2f

Please sign in to comment.