Added Mining Config Options
Config options added: * Mining Cost Multiplier, scales power usage of both Quarry and Mining Well * Max Depth, limited Quarry/Well to a certain depth below the block * One Time Use Quarries, Quarry doesn't drop an item when broken, get it right the first time (defaults to false)
This commit is contained in:
parent
880fd64e27
commit
74fd409330
7 changed files with 229 additions and 76 deletions
|
@ -11,6 +11,7 @@ import buildcraft.core.DefaultProps;
|
|||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.ConfigUtils;
|
||||
import buildcraft.factory.BlockAutoWorkbench;
|
||||
import buildcraft.factory.BlockFloodGate;
|
||||
import buildcraft.factory.BlockFrame;
|
||||
|
@ -61,12 +62,14 @@ import net.minecraftforge.common.Configuration;
|
|||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Property;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
@Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerFactory.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftFactory {
|
||||
|
||||
public static final int MINING_MJ_COST_PER_BLOCK = 64;
|
||||
public static BlockQuarry quarryBlock;
|
||||
public static BlockMiningWell miningWellBlock;
|
||||
public static BlockAutoWorkbench autoWorkbenchBlock;
|
||||
|
@ -77,8 +80,10 @@ public class BuildCraftFactory {
|
|||
public static BlockTank tankBlock;
|
||||
public static BlockRefinery refineryBlock;
|
||||
public static BlockHopper hopperBlock;
|
||||
public static boolean hopperDisabled;
|
||||
public static boolean allowMining = true;
|
||||
public static boolean quarryOneTimeUse = false;
|
||||
public static float miningMultiplier = 1;
|
||||
public static int miningDepth = 256;
|
||||
public static PumpDimensionList pumpDimensionList;
|
||||
@Instance("BuildCraft|Factory")
|
||||
public static BuildCraftFactory instance;
|
||||
|
@ -133,10 +138,7 @@ public class BuildCraftFactory {
|
|||
CoreProxy.proxy.registerTileEntity(TileFloodGate.class, "net.minecraft.src.buildcraft.factory.TileFloodGate");
|
||||
CoreProxy.proxy.registerTileEntity(TileTank.class, "net.minecraft.src.buildcraft.factory.TileTank");
|
||||
CoreProxy.proxy.registerTileEntity(TileRefinery.class, "net.minecraft.src.buildcraft.factory.Refinery");
|
||||
|
||||
if (!hopperDisabled) {
|
||||
CoreProxy.proxy.registerTileEntity(TileHopper.class, "net.minecraft.src.buildcraft.factory.TileHopper");
|
||||
}
|
||||
CoreProxy.proxy.registerTileEntity(TileHopper.class, "net.minecraft.src.buildcraft.factory.TileHopper");
|
||||
|
||||
FactoryProxy.proxy.initializeTileEntities();
|
||||
|
||||
|
@ -152,9 +154,19 @@ public class BuildCraftFactory {
|
|||
|
||||
@EventHandler
|
||||
public void initialize(FMLPreInitializationEvent evt) {
|
||||
allowMining = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "mining.enabled", true).getBoolean(true);
|
||||
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, Configuration.CATEGORY_GENERAL);
|
||||
|
||||
pumpDimensionList = new PumpDimensionList(BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pumping.controlList", DefaultProps.PUMP_DIMENSION_LIST).getString());
|
||||
allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines");
|
||||
quarryOneTimeUse = genCat.get("quarry.one.time.use", false, "Quarry cannot be picked back up after placement");
|
||||
miningMultiplier = genCat.get("mining.cost.multipler", 1F, 1F, 10F, "cost multiplier for mining operations, range (1.0 - 10.0)\nhigh values may render engines incapable of powering machines directly");
|
||||
miningDepth = genCat.get("mining.depth", 2, 256, 256, "how far below the machine can mining machines dig, range (2 - 256), default 256");
|
||||
|
||||
Property pumpList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pumping.controlList", DefaultProps.PUMP_DIMENSION_LIST);
|
||||
pumpList.comment = "Allows admins to whitelist or blacklist pumping of specific fluids in specific dimensions.\n"
|
||||
+ "Eg. \"-/-1/Lava\" will disable lava in the nether. \"-/*/Lava\" will disable lava in any dimension. \"+/0/*\" will enable any fluid in the overworld.\n"
|
||||
+ "Entries are comma seperated, banned fluids have precedence over allowed ones."
|
||||
+ "Default is \"+/*/*,+/-1/Lava\" - the second redundant entry (\"+/-1/Lava\") is there to show the format.";
|
||||
pumpDimensionList = new PumpDimensionList(pumpList.getString());
|
||||
|
||||
int miningWellId = BuildCraftCore.mainConfiguration.getBlock("miningWell.id", DefaultProps.MINING_WELL_ID).getInt(DefaultProps.MINING_WELL_ID);
|
||||
int plainPipeId = BuildCraftCore.mainConfiguration.getBlock("drill.id", DefaultProps.DRILL_ID).getInt(DefaultProps.DRILL_ID);
|
||||
|
|
|
@ -23,7 +23,7 @@ public final class PowerHandler {
|
|||
case STORAGE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,16 @@ public final class PowerHandler {
|
|||
case STORAGE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend this class to create custom Perdition algorithms (its not final).
|
||||
*
|
||||
* NOTE: It is not possible to create a Zero perdition algorithm.
|
||||
*/
|
||||
public static class PerditionCalculator {
|
||||
|
||||
public static final float DEFAULT_POWERLOSS = 1F;
|
||||
|
@ -48,6 +53,11 @@ public final class PowerHandler {
|
|||
powerLoss = DEFAULT_POWERLOSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple constructor for simple Perdition per tick.
|
||||
*
|
||||
* @param powerLoss power loss per tick
|
||||
*/
|
||||
public PerditionCalculator(float powerLoss) {
|
||||
if (powerLoss < MIN_POWERLOSS) {
|
||||
powerLoss = MIN_POWERLOSS;
|
||||
|
|
115
common/buildcraft/core/utils/ConfigUtils.java
Normal file
115
common/buildcraft/core/utils/ConfigUtils.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (c) SpaceToad, 2011-2012
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.utils;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import java.util.logging.Level;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public class ConfigUtils {
|
||||
|
||||
private static final String COMMENT_PREFIX = "";
|
||||
private static final String COMMENT_SUFFIX = "";
|
||||
private final Configuration config;
|
||||
private final String cat;
|
||||
|
||||
public ConfigUtils(Configuration config, String cat) {
|
||||
this.config = config;
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
public boolean get(String tag, boolean defaultValue, String comment) {
|
||||
return get(tag, defaultValue, false, comment);
|
||||
}
|
||||
|
||||
public boolean get(String tag, boolean defaultValue, boolean reset, String comment) {
|
||||
comment = COMMENT_PREFIX + comment.replace("{t}", tag) + COMMENT_SUFFIX;
|
||||
Property prop = config.get(cat, tag, defaultValue);
|
||||
prop.comment = comment;
|
||||
boolean ret = parseBoolean(prop, defaultValue);
|
||||
if (reset)
|
||||
prop.set(defaultValue);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int get(String tag, int defaultValue, String comment) {
|
||||
comment = COMMENT_PREFIX + comment.replace("{t}", tag) + COMMENT_SUFFIX;
|
||||
Property prop = config.get(cat, tag, defaultValue);
|
||||
prop.comment = comment;
|
||||
return parseInteger(prop, defaultValue);
|
||||
}
|
||||
|
||||
public int get(String tag, int min, int defaultValue, int max, String comment) {
|
||||
comment = COMMENT_PREFIX + comment.replace("{t}", tag) + COMMENT_SUFFIX;
|
||||
Property prop = config.get(cat, tag, defaultValue);
|
||||
prop.comment = comment;
|
||||
int parsed = parseInteger(prop, defaultValue);
|
||||
int clamped = Math.max(parsed, min);
|
||||
clamped = Math.min(clamped, max);
|
||||
if (clamped != parsed)
|
||||
prop.set(clamped);
|
||||
return clamped;
|
||||
}
|
||||
|
||||
public float get(String tag, float min, float defaultValue, float max, String comment) {
|
||||
comment = COMMENT_PREFIX + comment.replace("{t}", tag) + COMMENT_SUFFIX;
|
||||
Property prop = config.get(cat, tag, defaultValue);
|
||||
prop.comment = comment;
|
||||
double parsed = parseDouble(prop, defaultValue);
|
||||
double clamped = Math.max(parsed, min);
|
||||
clamped = Math.min(clamped, max);
|
||||
if (clamped != parsed)
|
||||
prop.set(clamped);
|
||||
return (float) clamped;
|
||||
}
|
||||
|
||||
private boolean parseBoolean(Property prop, boolean defaultValue) {
|
||||
String value = prop.getString();
|
||||
boolean parsed;
|
||||
try {
|
||||
parsed = Boolean.parseBoolean(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Failed to parse config tag, reseting to default: " + prop.getName(), ex);
|
||||
prop.set(defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
|
||||
private int parseInteger(Property prop, int defaultValue) {
|
||||
String value = prop.getString();
|
||||
int parsed;
|
||||
try {
|
||||
parsed = Integer.parseInt(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Failed to parse config tag, reseting to default: " + prop.getName(), ex);
|
||||
prop.set(defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
|
||||
private double parseDouble(Property prop, double defaultValue) {
|
||||
String value = prop.getString();
|
||||
double parsed;
|
||||
try {
|
||||
parsed = Double.parseDouble(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Failed to parse config tag, reseting to default: " + prop.getName(), ex);
|
||||
prop.set(defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.factory;
|
||||
|
||||
import buildcraft.BuildCraftFactory;
|
||||
|
@ -49,7 +47,7 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
|
||||
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(),1);
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(), 1);
|
||||
if (entityliving instanceof EntityPlayer) {
|
||||
TileQuarry tq = (TileQuarry) world.getBlockTileEntity(i, j, k);
|
||||
tq.placedBy = (EntityPlayer) entityliving;
|
||||
|
@ -62,14 +60,14 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
if (j == 0 && i == 3)
|
||||
return textureFront;
|
||||
|
||||
if (i == j && i>1) // Front can't be top or bottom.
|
||||
if (i == j && i > 1) // Front can't be top or bottom.
|
||||
return textureFront;
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
return textureTop;
|
||||
default:
|
||||
return textureSide;
|
||||
case 1:
|
||||
return textureTop;
|
||||
default:
|
||||
return textureSide;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,25 +89,25 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
if ((meta & 8) == 0) {
|
||||
world.setBlockMetadataWithNotify(i, j, k, meta | 8,0);
|
||||
world.setBlockMetadataWithNotify(i, j, k, meta | 8, 0);
|
||||
|
||||
ForgeDirection[] dirs = ForgeDirection.VALID_DIRECTIONS;
|
||||
|
||||
for (ForgeDirection dir : dirs) {
|
||||
switch (dir) {
|
||||
case UP:
|
||||
searchFrames(world, i, j + 1, k);
|
||||
case DOWN:
|
||||
searchFrames(world, i, j - 1, k);
|
||||
case SOUTH:
|
||||
searchFrames(world, i, j, k + 1);
|
||||
case NORTH:
|
||||
searchFrames(world, i, j, k - 1);
|
||||
case EAST:
|
||||
searchFrames(world, i + 1, j, k);
|
||||
case WEST:
|
||||
default:
|
||||
searchFrames(world, i - 1, j, k);
|
||||
case UP:
|
||||
searchFrames(world, i, j + 1, k);
|
||||
case DOWN:
|
||||
searchFrames(world, i, j - 1, k);
|
||||
case SOUTH:
|
||||
searchFrames(world, i, j, k + 1);
|
||||
case NORTH:
|
||||
searchFrames(world, i, j, k - 1);
|
||||
case EAST:
|
||||
searchFrames(world, i + 1, j, k);
|
||||
case WEST:
|
||||
default:
|
||||
searchFrames(world, i - 1, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,10 +115,18 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
|
||||
private void markFrameForDecay(World world, int x, int y, int z) {
|
||||
if (world.getBlockId(x, y, z) == BuildCraftFactory.frameBlock.blockID) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1,0);
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
if (BuildCraftFactory.quarryOneTimeUse) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
return super.getBlockDropped(world, x, y, z, metadata, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int i, int j, int k, int par5, int par6) {
|
||||
|
||||
|
@ -214,7 +220,7 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
public void addCreativeItems(ArrayList itemList) {
|
||||
itemList.add(new ItemStack(this));
|
||||
|
@ -222,10 +228,9 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
textureSide = par1IconRegister.registerIcon("buildcraft:quarry_side");
|
||||
textureTop = par1IconRegister.registerIcon("buildcraft:quarry_top");
|
||||
textureFront = par1IconRegister.registerIcon("buildcraft:quarry_front");
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
textureSide = par1IconRegister.registerIcon("buildcraft:quarry_side");
|
||||
textureTop = par1IconRegister.registerIcon("buildcraft:quarry_top");
|
||||
textureFront = par1IconRegister.registerIcon("buildcraft:quarry_front");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,18 +17,25 @@ import net.minecraft.util.Icon;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class FactoryProxyClient extends FactoryProxy {
|
||||
public static Icon pumpTexture;
|
||||
public static Icon drillTexture;
|
||||
public static Icon drillHeadTexture;
|
||||
|
||||
@Override
|
||||
public static Icon pumpTexture;
|
||||
public static Icon drillTexture;
|
||||
public static Icon drillHeadTexture;
|
||||
|
||||
@Override
|
||||
public void initializeTileEntities() {
|
||||
super.initializeTileEntities();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
|
||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0), new RenderRefinery());
|
||||
|
||||
if (!BuildCraftFactory.hopperDisabled) {
|
||||
if (BuildCraftFactory.tankBlock != null) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
|
||||
}
|
||||
|
||||
if (BuildCraftFactory.refineryBlock != null) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
|
||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0), new RenderRefinery());
|
||||
}
|
||||
|
||||
if (BuildCraftFactory.hopperBlock != null) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileHopper.class, new RenderHopper());
|
||||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
|
||||
}
|
||||
|
@ -53,26 +60,23 @@ public class FactoryProxyClient extends FactoryProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityBlock newPumpTube(World w)
|
||||
{
|
||||
EntityBlock eb = super.newPumpTube(w);
|
||||
eb.texture = pumpTexture;
|
||||
return eb;
|
||||
public EntityBlock newPumpTube(World w) {
|
||||
EntityBlock eb = super.newPumpTube(w);
|
||||
eb.texture = pumpTexture;
|
||||
return eb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBlock newDrill(World w, double i, double j, double k, double l, double d, double e)
|
||||
{
|
||||
EntityBlock eb = super.newDrill(w, i, j, k, l, d, e);
|
||||
eb.texture = drillTexture;
|
||||
return eb;
|
||||
public EntityBlock newDrill(World w, double i, double j, double k, double l, double d, double e) {
|
||||
EntityBlock eb = super.newDrill(w, i, j, k, l, d, e);
|
||||
eb.texture = drillTexture;
|
||||
return eb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBlock newDrillHead(World w, double i, double j, double k, double l, double d, double e)
|
||||
{
|
||||
EntityBlock eb = super.newDrillHead(w, i, j, k, l, d, e);
|
||||
eb.texture = drillHeadTexture;
|
||||
return eb;
|
||||
}
|
||||
public EntityBlock newDrillHead(World w, double i, double j, double k, double l, double d, double e) {
|
||||
EntityBlock eb = super.newDrillHead(w, i, j, k, l, d, e);
|
||||
eb.texture = drillHeadTexture;
|
||||
return eb;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ public class TileMiningWell extends TileBuildCraft implements IMachine, IPowerRe
|
|||
|
||||
public TileMiningWell() {
|
||||
powerHandler = new PowerHandler(this, Type.MACHINE);
|
||||
powerHandler.configure(100, 100, 60, 1000);
|
||||
|
||||
float mj = BuildCraftFactory.MINING_MJ_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier;
|
||||
powerHandler.configure(100 * BuildCraftFactory.miningMultiplier, 100 * BuildCraftFactory.miningMultiplier, mj, 1000 * BuildCraftFactory.miningMultiplier);
|
||||
powerHandler.configurePowerPerdition(1, 1);
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,8 @@ public class TileMiningWell extends TileBuildCraft implements IMachine, IPowerRe
|
|||
*/
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider) {
|
||||
if (powerHandler.useEnergy(60, 60, true) != 60)
|
||||
float mj = BuildCraftFactory.MINING_MJ_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier;
|
||||
if (powerHandler.useEnergy(mj, mj, true) != mj)
|
||||
return;
|
||||
|
||||
World world = worldObj;
|
||||
|
@ -52,7 +55,7 @@ public class TileMiningWell extends TileBuildCraft implements IMachine, IPowerRe
|
|||
depth = depth - 1;
|
||||
}
|
||||
|
||||
if (depth < 1 || !BlockUtil.canChangeBlock(world, xCoord, depth, zCoord)) {
|
||||
if (depth < 1 || depth < yCoord - BuildCraftFactory.miningDepth || !BlockUtil.canChangeBlock(world, xCoord, depth, zCoord)) {
|
||||
isDigging = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
public PowerHandler powerHandler;
|
||||
boolean isDigging = false;
|
||||
public static final int MAX_ENERGY = 15000;
|
||||
private static final PowerHandler.PerditionCalculator PERDITION = new PowerHandler.PerditionCalculator(2 * BuildCraftFactory.miningMultiplier);
|
||||
|
||||
public TileQuarry() {
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.MACHINE);
|
||||
|
@ -79,8 +80,9 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
}
|
||||
|
||||
private void initPowerProvider() {
|
||||
powerHandler.configure(50, 100, 25, MAX_ENERGY);
|
||||
powerHandler.configurePowerPerdition(2, 1);
|
||||
float mj = 25 * BuildCraftFactory.miningMultiplier;
|
||||
powerHandler.configure(50 * BuildCraftFactory.miningMultiplier, 100 * BuildCraftFactory.miningMultiplier, mj, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
powerHandler.setPerdition(PERDITION);
|
||||
}
|
||||
|
||||
public void createUtilsIfNeeded() {
|
||||
|
@ -194,9 +196,9 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
}
|
||||
|
||||
protected void buildFrame() {
|
||||
|
||||
powerHandler.configure(50, 100, 25, MAX_ENERGY);
|
||||
if (powerHandler.useEnergy(25, 25, true) != 25)
|
||||
float mj = 25 * BuildCraftFactory.miningMultiplier;
|
||||
powerHandler.configure(50 * BuildCraftFactory.miningMultiplier, 100 * BuildCraftFactory.miningMultiplier, mj, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
if (powerHandler.useEnergy(mj, mj, true) != mj)
|
||||
return;
|
||||
|
||||
if (builder == null) {
|
||||
|
@ -210,8 +212,10 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
}
|
||||
|
||||
protected void dig() {
|
||||
powerHandler.configure(100, 500, 60, MAX_ENERGY);
|
||||
if (powerHandler.useEnergy(60, 60, true) != 60)
|
||||
powerHandler.configure(100 * BuildCraftFactory.miningMultiplier, 500 * BuildCraftFactory.miningMultiplier, BuildCraftFactory.MINING_MJ_COST_PER_BLOCK, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
|
||||
float mj = BuildCraftFactory.MINING_MJ_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier;
|
||||
if (powerHandler.useEnergy(mj, mj, true) != mj)
|
||||
return;
|
||||
|
||||
if (!findTarget(true)) {
|
||||
|
@ -278,7 +282,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
|
||||
Integer[][] columnHeights = new Integer[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2];
|
||||
boolean[][] blockedColumns = new boolean[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2];
|
||||
for (int searchY = yCoord + 3; searchY >= 0; --searchY) {
|
||||
for (int searchY = yCoord + 3; searchY >= 1 && searchY >= yCoord - BuildCraftFactory.miningDepth; --searchY) {
|
||||
int startX, endX, incX;
|
||||
|
||||
if (searchY % 2 == 0) {
|
||||
|
|
Loading…
Reference in a new issue