Search in sources :

Example 1 with BlockCapturingCategory

use of org.spongepowered.common.config.category.BlockCapturingCategory in project SpongeCommon by SpongePowered.

the class MixinBlock_BlockCapturing method initializeBlockCapturingState.

@Override
public void initializeBlockCapturingState(World worldIn) {
    SpongeConfig<? extends GeneralConfigBase> activeConfig = ((IMixinWorldServer) worldIn).getActiveConfig();
    BlockCapturingCategory blockCapturing = activeConfig.getConfig().getBlockCapturing();
    String[] ids = this.getId().split(":");
    String modId = ids[0];
    String name = ids[1];
    BlockCapturingModCategory modCapturing = blockCapturing.getModMappings().get(modId);
    if (modCapturing == null && blockCapturing.autoPopulateData()) {
        modCapturing = new BlockCapturingModCategory();
        blockCapturing.getModMappings().put(modId.toLowerCase(), modCapturing);
        modCapturing.getBlockMap().put(name.toLowerCase(), false);
        if (blockCapturing.autoPopulateData()) {
            activeConfig.save();
        }
        return;
    } else if (modCapturing != null) {
        if (!modCapturing.isEnabled()) {
            this.processTickChangesImmediately = false;
            return;
        }
        Boolean processImmediately = modCapturing.getBlockMap().get(name.toLowerCase());
        if (processImmediately != null) {
            this.processTickChangesImmediately = processImmediately;
        }
    }
    if (blockCapturing.autoPopulateData()) {
        activeConfig.save();
    }
}
Also used : BlockCapturingCategory(org.spongepowered.common.config.category.BlockCapturingCategory) IMixinWorldServer(org.spongepowered.common.interfaces.world.IMixinWorldServer) BlockCapturingModCategory(org.spongepowered.common.config.category.BlockCapturingModCategory)

Aggregations

BlockCapturingCategory (org.spongepowered.common.config.category.BlockCapturingCategory)1 BlockCapturingModCategory (org.spongepowered.common.config.category.BlockCapturingModCategory)1 IMixinWorldServer (org.spongepowered.common.interfaces.world.IMixinWorldServer)1