Configuring EMC calculation - sinkillerj/ProjectE GitHub Wiki

mapping.cfg

To configure the EMC calculation you need to change values in the mapping.cfg-file. This configuration file is kind of special, because it is not automatically generated, when you start Minecraft with ProjectE installed. You have to load a world for this file to be generated.

The file will be read and written whenever the EMC calculation occurs. This means, that you don't have to restart your game when you made changes: Executing one of the commands that trigger a recalculation is enough (Like: reloadEMC, setEMC, removeEMC).
Warning: EMC calculation does not occur if you use the pregenerate-option!

Currently, the config file contains 3 main categories:

Category: enabledmappers

This section controls which Mappers should be used for EMC Calculation. A Mapper is a piece of code that adds contributions to the EMC calculation system. As of now there are 7 Mappers included in ProjectE:

  • APICustomEMCMapper handles custom EMC values that were received through the API from another mod.
  • CraftingMapper reads crafting recipes from the default CraftingManager. This can not read non-vanilla crafting recipes. (Popular Mods that don't use vanilla recipes: AE2, IC2)
  • CustomEMCMapper reads the custom_emc.cfg file that can be configured with the setEMC and removeEMC commands.
  • FluidMapper adds EMC values to fluid containers like buckets.
  • LazyMapper contains a list of items and their default EMC values.
  • OreDictionaryMapper contains a list of ore dictionary names and their default EMC values, that will then be set for each item in the ore dictionary group.
  • SmeltingMapper reads smelting recipes that can happen in a vanilla furnace.

All of these can be individually disabled/enabled.
Enabling Mappers might cause them to generate additional mapper-specific configuration entries in the mapperConfigurations Category!

Category: general

Logging EMC exploits

When the EMC calculation occurs the algorithm might encounter discrepancies that are caused by values that were set by the user or one of the Mappers.

For example: The EMC value for cobblestone is 1 and a furnace is made from 8 cobblestone. If you now set the EMC value for the furnace to something bigger than 8 it will notice that, because it knows that there is a cheaper way to create the furnace. This only works for conversions the algorithm knows about, though. Custom ways of processing which are not supported by a Mapper will not be found.

The logEMCExploits config option lets you enable/disable the logging of these exploits.

Pregenerated EMC

The pregenerate-config option allows you to disable the EMC calculation.

When you enable this option the next EMC calculation will generate a pregenerated_emc.json file that contains all the EMC values.
As long as this option is set to true and the file exist the EMC calculation will not be executed. Instead the file will be loaded.

Warning: Any other changes to the mapping.cfg or the custom_emc.cfg will NOT take effect until you delete/rename the pregenerated_emc.json file. This also includes the setEMC and removeEMC commands. These will change the custom_emc.cfg file but you will not see the changes until you remove/rename the file. Accordingly the reloadEMC command will only reload the file, but not do a new EMC calculation!

The EMC calculation will not happen again, until that file is removed or the config option is set back to false! If you set the option back to false the file will not be loaded, even if it exists!

Usages of pregenerated EMC values
Speed

Because the EMC calculation does not happen the pregenerated EMC decreases the loading & startup times.
It might also be useful if you are setting a lot of EMC values manually. You don't have to wait for the values to be calculated before you can set the next value. And then regenerate the file by removing/renaming to get all the new values into the calculation all at once.

Versioning

Are you afraid your perfectly crafted EMC values might be changing in the future in case of an update or something else? Just pregenerate the EMC values and these will never change again until you want them to.

Because the pregenerated_emc.json file is readable and JSON you can use this JSON Diff tool to find out what has changed in your EMC values. Just copy & paste two versions of the file into the textboxes and see the differences.

Category: mapperConfigurations

This category contains configurations for enabled mappers. Always check this category after you enabled a mapper to see if it has additional configuration options.