Can't add an enum config for my mod addon
poscard8 opened this issue ยท 1 comments
Mod loader
Please select
Minecraft version
1.20.1
Mod version
11.8.0
Modloader version
Forge 47.3.29
Modpack info
No response
[IMPORTANT] If bug:
- I have confirmed this bug is reproducible on a minimal setup, not a modpack with many other mods.
[IMPORTANT] If bug: The latest.log file, not the crash report
https://gist.github.com/poscard8/47cca11b0619205fc49e6c16aed4723e
Issue description
I want to add a 3-state enum config for my mod but can't. Here is the jade config file and my jade plugin file:
{
"minecraft": {
"item_storage.show_name_amount": 5,
"furnace": true,
"harvest_tool.show_unbreakable": false,
"animal_owner": true,
"animal_owner.fetch_names": true,
"harvest_tool.effective_tool": true,
"item_storage.normal_amount": 9,
"item_storage": true,
"harvest_tool": true,
"armor_stand": true,
"fluid_storage.detailed": false,
"energy_storage": true,
"entity_armor.max_for_render": 40,
"breaking_progress": true,
"tnt_stability": true,
"item_storage.items_per_line": 9,
"item_frame": true,
"crop_progress": true,
"command_block": true,
"mob_growth": true,
"harvest_tool.new_line": false,
"entity_health.max_for_render": 40,
"entity_health.show_fractions": false,
"mob_spawner": true,
"redstone": true,
"fluid_storage": true,
"chicken_egg": true,
"jukebox": true,
"brewing_stand": true,
"energy_storage.detailed": false,
"note_block": true,
"beehive": true,
"item_storage.detailed_amount": 54,
"player_head": true,
"block_states": false,
"lectern": true,
"entity_armor": true,
"harvest_tool.creative": false,
"horse_stats": true,
"item_tooltip": true,
"entity_health": true,
"enchantment_power": true,
"zombie_villager": true,
"villager_profession": true,
"mob_breeding": true,
"entity_health.icons_per_line": 10,
"total_enchantment_power": true,
"potion_effects": true,
"painting": true,
"chiseled_bookshelf": true
},
"jade": {
"coordinates.rel": false,
"distance": false,
"block_face": false,
"coordinates": false,
"registry_name": "OFF",
"mod_name": true
},
"peritia": {
"chest_xp_sources": "SURVIVAL_ONLY",
"block_xp_sources": "SURVIVAL_ONLY",
"entity_xp_sources":"SURVIVAL_ONLY"
}
}
package github.poscard8.peritia.compat.jade;
import github.poscard8.peritia.xpsource.XpSource;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
import org.jetbrains.annotations.Nullable;
import snownee.jade.api.IWailaClientRegistration;
import snownee.jade.api.IWailaCommonRegistration;
import snownee.jade.api.IWailaPlugin;
import snownee.jade.api.WailaPlugin;
import java.util.function.Predicate;
import static github.poscard8.peritia.Peritia.asResource;
@WailaPlugin
public class PeritiaJadePlugin implements IWailaPlugin
{
public static final ResourceLocation BLOCK_XP_SOURCES = asResource("block_xp_sources");
public static final ResourceLocation ENTITY_XP_SOURCES = asResource("entity_xp_sources");
public static final ResourceLocation CHEST_XP_SOURCES = asResource("chest_xp_sources");
@Override
public void register(IWailaCommonRegistration registration)
{
registration.registerBlockDataProvider(new ChestDataProvider(), RandomizableContainerBlockEntity.class);
}
@Override
public void registerClient(IWailaClientRegistration registration)
{
registration.addConfig(BLOCK_XP_SOURCES, ConfigOption.SURVIVAL_ONLY);
registration.addConfig(ENTITY_XP_SOURCES, ConfigOption.SURVIVAL_ONLY);
registration.addConfig(CHEST_XP_SOURCES, ConfigOption.SURVIVAL_ONLY);
registration.markAsClientFeature(BLOCK_XP_SOURCES);
registration.markAsClientFeature(ENTITY_XP_SOURCES);
registration.markAsClientFeature(CHEST_XP_SOURCES);
registration.registerBlockComponent(new PeritiaBlockTextProvider(), Block.class);
registration.registerEntityComponent(new PeritiaEntityTextProvider(), LivingEntity.class);
registration.registerBlockComponent(new PeritiaChestTextProvider(), BaseEntityBlock.class);
}
public enum ConfigOption
{
ON(player -> false),
OFF(player -> true),
SURVIVAL_ONLY(player -> !XpSource.canPlayerGainXp(player));
private final Predicate<Player> stopPredicate;
ConfigOption(Predicate<Player> stopPredicate) { this.stopPredicate = stopPredicate; }
public boolean shouldStopRendering(@Nullable Player player) { return player == null || stopPredicate.test(player); }
}
}
Is it a bug or am I doing something wrong?