Skip to content

Commit

Permalink
Replaced jankson with gson to fix config loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
B1n-ry committed Nov 17, 2023
1 parent d7b70e7 commit 210e5a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
### Changes
* Added config to drop contents of deleted graves, when deleted due to the max grave
count reached.
* Config now uses GSON instead of jankson (config file is now yigd.json instead of yigd.json5)

### Fixes
* Graves will no longer unlock when closing and reopening the game
* Added translation keys for enchantments
* Fixed error where game could not read config file, so you could not change the configs

---

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/b1n_ry/yigd/Yigd.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.b1n_ry.yigd.packets.ServerPacketHandler;
import com.b1n_ry.yigd.util.YigdResourceHandler;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
Expand Down Expand Up @@ -61,7 +62,7 @@ public class Yigd implements ModInitializer {

@Override
public void onInitialize() {
AutoConfig.register(YigdConfig.class, JanksonConfigSerializer::new);
AutoConfig.register(YigdConfig.class, GsonConfigSerializer::new);

GRAVE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "grave_block_entity"), FabricBlockEntityTypeBuilder.create(GraveBlockEntity::new, GRAVE_BLOCK).build());

Expand Down
17 changes: 8 additions & 9 deletions src/main/java/com/b1n_ry/yigd/config/YigdConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;
import net.minecraft.item.Item;
import net.minecraft.item.Items;

import java.util.*;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -51,9 +49,9 @@ public static class InventoryConfig {
@ConfigEntry.Gui.CollapsibleObject
public ItemLossConfig itemLoss = new ItemLossConfig();
// delete enchantments
public List<String> vanishingEnchantments = List.of("minecraft:vanishing_curse");
public List<String> vanishingEnchantments = new ArrayList<>() {{ add("minecraft:vanishing_curse"); }};
// soulbinding enchantments
public List<String> soulboundEnchantments = List.of("yigd:soulbound");
public List<String> soulboundEnchantments = new ArrayList<>() {{ add("yigd:soulbound"); }};
// loose soulbound level
public boolean loseSoulboundLevelOnDeath = false;
// void slots
Expand Down Expand Up @@ -249,11 +247,12 @@ public static class Range {

public static class BlockUnderGrave {
public boolean enabled = true;
public List<MapEntry> blockInDimensions = List.of(
new MapEntry("minecraft:overworld", "minecraft:cobblestone"),
new MapEntry("minecraft:nether", "minecraft:soul_soil"),
new MapEntry("minecraft:end", "minecraft:end_stone"),
new MapEntry("misc", "minecraft:dirt"));
public List<MapEntry> blockInDimensions = new ArrayList<>() {{
add(new MapEntry("minecraft:overworld", "minecraft:cobblestone"));
add(new MapEntry("minecraft:nether", "minecraft:soul_soil"));
add(new MapEntry("minecraft:end", "minecraft:end_stone"));
add(new MapEntry("misc", "minecraft:dirt"));
}};
public boolean generateOnProtectedLand = false;
}
}
Expand Down

0 comments on commit 210e5a7

Please sign in to comment.