From 77e421a109343eb3015ab50c75848033b4ce8078 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sun, 26 Mar 2017 20:46:55 -0700 Subject: [PATCH] Add configuration option to disable the chunkloader --- build.gradle | 2 +- .../additionalpipes/APConfiguration.java | 8 ++++- .../additionalpipes/AdditionalPipes.java | 31 +++++++++++-------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 82b0b13..2a31948 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' // adds the forge dependency -version = "4.7.5" +version = "4.7.6" group= "com.buildcraft.additionalpipes" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "additionalpipes" diff --git a/src/main/java/buildcraft/additionalpipes/APConfiguration.java b/src/main/java/buildcraft/additionalpipes/APConfiguration.java index 4f8d6f8..0726018 100644 --- a/src/main/java/buildcraft/additionalpipes/APConfiguration.java +++ b/src/main/java/buildcraft/additionalpipes/APConfiguration.java @@ -2,9 +2,9 @@ import java.io.File; +import buildcraft.additionalpipes.utils.Log; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import buildcraft.additionalpipes.utils.Log; public class APConfiguration @@ -15,6 +15,8 @@ public class APConfiguration public static boolean enableDebugLog; + public static boolean enableChunkloader; + // keybinding public static int laserKeyCode; // config option (& in options menu) // misc @@ -82,6 +84,10 @@ else if(powerTransmittanceCfg < 0.0) Property gpPullRateProperty = config.get(Configuration.CATEGORY_GENERAL, "gravityFeedPipeTicksPerPull", 48); gpPullRateProperty.comment = "How many ticks the Gravity Feed Pipe needs to extract an item"; gravityFeedPipeTicksPerPull = gpPullRateProperty.getInt(); + + Property enableChunkloaderProperty = config.get(Configuration.CATEGORY_GENERAL, "enableChunkloader", true); + enableChunkloaderProperty.comment = "Whether or not the chunkloader is added as a block"; + enableChunkloader = enableChunkloaderProperty.getBoolean(); } catch(Exception e) { diff --git a/src/main/java/buildcraft/additionalpipes/AdditionalPipes.java b/src/main/java/buildcraft/additionalpipes/AdditionalPipes.java index b1ef135..234e3d4 100644 --- a/src/main/java/buildcraft/additionalpipes/AdditionalPipes.java +++ b/src/main/java/buildcraft/additionalpipes/AdditionalPipes.java @@ -168,12 +168,24 @@ public void init(FMLInitializationEvent event) NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); - Log.info("Registering chunk load handler"); - ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkLoadingHandler()); - chunkLoadViewer = new ChunkLoadViewDataProxy(APConfiguration.chunkSightRange); - FMLCommonHandler.instance().bus().register(chunkLoadViewer); - - proxy.registerKeyHandler(); + if(APConfiguration.enableChunkloader) + { + Log.info("Registering chunk load handler"); + ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkLoadingHandler()); + chunkLoadViewer = new ChunkLoadViewDataProxy(APConfiguration.chunkSightRange); + FMLCommonHandler.instance().bus().register(chunkLoadViewer); + + // register Teleport Tether block + blockChunkLoader = new BlockChunkLoader(); + blockChunkLoader.setBlockName("teleportTether"); + GameRegistry.registerBlock(blockChunkLoader, ItemBlock.class, "chunkLoader"); + GameRegistry.registerTileEntity(TileChunkLoader.class, "TeleportTether"); + GameRegistry.addRecipe(new ShapedOreRecipe(blockChunkLoader, "iii", "iLi", "ici", 'i', "ingotIron", 'L', "gemLapis", 'c', BuildCraftSilicon.redstoneChipset)); + + // the lasers key function depends on the chunk loading code, so it can only be enabled if the chunk loader is + proxy.registerKeyHandler(); + + } proxy.registerRendering(); @@ -224,13 +236,6 @@ public void init(FMLInitializationEvent event) } - // ChunkLoader - blockChunkLoader = new BlockChunkLoader(); - blockChunkLoader.setBlockName("teleportTether"); - GameRegistry.registerBlock(blockChunkLoader, ItemBlock.class, "chunkLoader"); - GameRegistry.registerTileEntity(TileChunkLoader.class, "TeleportTether"); - GameRegistry.addRecipe(new ShapedOreRecipe(blockChunkLoader, "iii", "iLi", "ici", 'i', "ingotIron", 'L', "gemLapis", 'c', BuildCraftSilicon.redstoneChipset)); - dogDeaggravator = new ItemDogDeaggravator(); GameRegistry.registerItem(dogDeaggravator, ItemDogDeaggravator.NAME); GameRegistry.addRecipe(new ShapedOreRecipe(dogDeaggravator, "gsg", "gig", "g g", 'i', "ingotIron", 'g', "ingotGold", 's', "stickWood"));