Skip to content

Commit

Permalink
Add configuration option to disable the chunkloader
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Mar 27, 2017
1 parent 8300544 commit 77e421a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
31 changes: 18 additions & 13 deletions src/main/java/buildcraft/additionalpipes/AdditionalPipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit 77e421a

Please sign in to comment.