Java Code Examples for codechicken.lib.config.ConfigTag#save()
The following examples show how to use
codechicken.lib.config.ConfigTag#save() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyClient.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
private void loadClientConfig() { ConfigTag tag; ConfigTag clientTag = CodeChickenLib.config.getTag("client"); clientTag.deleteTag("block_renderer_dispatcher_misc"); tag = clientTag.getTag("catchBlockRenderExceptions")// .setComment(// "With this enabled, CCL will catch all exceptions thrown whilst rendering blocks.",// "If an exception is caught, the block will not be rendered."// ); catchBlockRenderExceptions = tag.setDefaultBoolean(true).getBoolean(); tag = clientTag.getTag("catchItemRenderExceptions")// .setComment(// "With this enabled, CCL will catch all exceptions thrown whilst rendering items.",// "By default CCL will only enhance the crash report, but with 'attemptRecoveryOnItemRenderException' enabled",// " CCL will attempt to recover after the exception."// ); messagePlayerOnRenderExceptionCaught = tag.setDefaultBoolean(true).getBoolean(); clientTag.save(); }
Example 2
Source File: ConfigTests.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testGeneration() throws Throwable { Path dir = Files.createTempDirectory("generation_test"); ConfigTag generated_config = new StandardConfigFile(dir.resolve("generated.cfg")).load(); generated_config.setTagVersion("1.1"); generated_config.setComment("This is a config comment."); ConfigTag tag = generated_config.getTag("Tag1").setComment("Specifies a new ConfigTag"); tag.setTagVersion("1.2.3.4"); ConfigTag bool = tag.getTag("boolean").setDefaultBoolean(false); ConfigTag string = tag.getTag("string").setDefaultString("This is a string with data, Cannot be Multi Line."); ConfigTag integer = tag.getTag("integer").setDefaultInt(123456789); ConfigTag doubl_e = tag.getTag("double").setDefaultDouble(1.2345); ConfigTag hex = tag.getTag("hex").setDefaultHex(0xFFFFFFFF); ConfigTag boolArray = tag.getTag("boolean_array").setDefaultBooleanList(Arrays.asList(true, false, true, false)); ConfigTag stringArray = tag.getTag("string_array").setDefaultStringList(Arrays.asList("value", "value2", "value33")); ConfigTag intArray = tag.getTag("integer_array").setDefaultIntList(Arrays.asList(1, 2, 3, 4, 5, 6)); ConfigTag doubleArray = tag.getTag("double_array").setDefaultDoubleList(Arrays.asList(1.2, 3.4, 5.6, 7.8)); ConfigTag hexArray = tag.getTag("hex_array").setDefaultHexList(Arrays.asList(0xFFFF, 0x00FF)); ConfigTag tag2 = generated_config.getTag("Tag2"); ConfigTag tag3 = tag2.getTag("Tag3"); ConfigTag tag4 = tag3.getTag("Tag4"); ConfigTag depthTest = tag4.getTag("depth_test").setDefaultBoolean(true); generated_config.save(); Path staticFile = dir.resolve("static.cfg"); copyTestFile(staticFile); ConfigTag staticConfig = new StandardConfigFile(staticFile).load(); ensureSame(staticConfig, generated_config); }