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();
}
}
Aggregations