Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Advanced Quarry + Pipes don't explode #679

Closed
wants to merge 4 commits into from

7 participants

@sadris

1) Added advanced quarry: quarry that does silk touch

2) Pipes will not explode if sent too much energy

@Flow86
Collaborator

I would say NO - power pipes HAVE to explode if overloaded. And I think you should create your own mod with the Advanced Quarry - the standard-quarry is balanced and good enough I think

@AartBluestoke

@Flow86 how do you recommend balancing power input vs power supply to run a quarry (or even just a forestry carpenter) at max speed? -- there is no mechanism in BC to tell if a pipe is close to exploding, if a machine is running at max speed, or if all power from an engine is being consumed.

@SirSengir
Owner

Explosions of conductive pipes are currently not quite working as intended. But the basic mechanic - overload/break if the system overloads - is sound. A PR that just removed the mechanic won't have a chance to get accepted. (There are plans to get rid of conductive pipes entirely, but no one has started on that yet.)

And NO to the advanced quarry. That's just silly in core BC. It's addon material, sorry.

@SirSengir SirSengir closed this
@Flow86
Collaborator

@AartBluestoke see #666 if you want non-exploding pipes if no consumer is there anymore ;-) (but you have to compile yourself, and you will get exploding engines if they're not safety-triggered)

@AartBluestoke

i like exploding engines, there's a gate-trigger i can use to manage that, exploding pipes just explode for no detectable reason :)

either way, i can see that updating for 1.5 is the priority now ;)

@Flow86
Collaborator

yes 1.5 is more important.

with my patch, pipes can still explode, but only if you really have 10000MJ pending somewhere (i personally get only 2000MJ for some time using thermalexpansion and redstone energy cells for energy storage)

@benfraley
@DZCreeper

Saw I wanted to make the default Quarry do silk touch 100% of the time, anyone willing to help me with that? From a person that hasn't really touched the code base the quarry code is complex.

@secondfry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
BIN  buildcraft_resources/gfx/buildcraft/blocks/blocks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  buildcraft_resources/lang/buildcraft/en_US.properties
@@ -76,6 +76,7 @@ tile.miningWellBlock=Mining Well
tile.plainPipeBlock=Mining Pipe
tile.autoWorkbenchBlock=Autocrafting Table
tile.machineBlock=Quarry
+tile.machineAdvBlock=Advanced Quarry
tile.markerBlock=Land Mark
tile.fillerBlock=Filler
tile.builderBlock=Builder
View
41 common/buildcraft/BuildCraftFactory.java
@@ -10,6 +10,7 @@
import java.util.List;
+import buildcraft.factory.*;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -21,28 +22,6 @@
import buildcraft.core.DefaultProps;
import buildcraft.core.Version;
import buildcraft.core.proxy.CoreProxy;
-import buildcraft.factory.BlockAutoWorkbench;
-import buildcraft.factory.BlockFrame;
-import buildcraft.factory.BlockHopper;
-import buildcraft.factory.BlockMiningWell;
-import buildcraft.factory.BlockPlainPipe;
-import buildcraft.factory.BlockPump;
-import buildcraft.factory.BlockQuarry;
-import buildcraft.factory.BlockRefinery;
-import buildcraft.factory.BlockTank;
-import buildcraft.factory.BptBlockAutoWorkbench;
-import buildcraft.factory.BptBlockFrame;
-import buildcraft.factory.BptBlockRefinery;
-import buildcraft.factory.BptBlockTank;
-import buildcraft.factory.FactoryProxy;
-import buildcraft.factory.GuiHandler;
-import buildcraft.factory.TileAutoWorkbench;
-import buildcraft.factory.TileHopper;
-import buildcraft.factory.TileMiningWell;
-import buildcraft.factory.TilePump;
-import buildcraft.factory.TileQuarry;
-import buildcraft.factory.TileRefinery;
-import buildcraft.factory.TileTank;
import buildcraft.factory.network.PacketHandlerFactory;
import com.google.common.collect.Lists;
@@ -62,7 +41,8 @@
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandlerFactory.class, clientSideRequired = true, serverSideRequired = true)
public class BuildCraftFactory {
- public static BlockQuarry quarryBlock;
+ public static BlockAdvancedQuarry quarryAdvBlock;
+ public static BlockQuarry quarryBlock;
public static BlockMiningWell miningWellBlock;
public static BlockAutoWorkbench autoWorkbenchBlock;
public static BlockFrame frameBlock;
@@ -111,6 +91,9 @@ public void ticketsLoaded(List<Ticket> tickets, World world) {
if (blId == quarryBlock.blockID) {
validTickets.add(ticket);
}
+ else if(blId == quarryAdvBlock.blockID) {
+ validTickets.add(ticket);
+ }
}
return validTickets;
}
@@ -124,6 +107,7 @@ public void load(FMLInitializationEvent evt) {
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
CoreProxy.proxy.registerTileEntity(TileQuarry.class, "Machine");
+ CoreProxy.proxy.registerTileEntity(TileAdvancedQuarry.class, "MachineAdv");
CoreProxy.proxy.registerTileEntity(TileMiningWell.class, "MiningWell");
CoreProxy.proxy.registerTileEntity(TileAutoWorkbench.class, "AutoWorkbench");
CoreProxy.proxy.registerTileEntity(TilePump.class, "net.minecraft.src.buildcraft.factory.TilePump");
@@ -157,6 +141,7 @@ public void initialize(FMLPreInitializationEvent evt) {
Property autoWorkbenchId = BuildCraftCore.mainConfiguration.getBlock("autoWorkbench.id", DefaultProps.AUTO_WORKBENCH_ID);
Property frameId = BuildCraftCore.mainConfiguration.getBlock("frame.id", DefaultProps.FRAME_ID);
Property quarryId = BuildCraftCore.mainConfiguration.getBlock("quarry.id", DefaultProps.QUARRY_ID);
+ Property quarryAdvId = BuildCraftCore.mainConfiguration.getBlock("quarryAdv.id", DefaultProps.QUARRY_ADV_ID);
Property pumpId = BuildCraftCore.mainConfiguration.getBlock("pump.id", DefaultProps.PUMP_ID);
Property tankId = BuildCraftCore.mainConfiguration.getBlock("tank.id", DefaultProps.TANK_ID);
Property refineryId = BuildCraftCore.mainConfiguration.getBlock("refinery.id", DefaultProps.REFINERY_ID);
@@ -185,6 +170,10 @@ public void initialize(FMLPreInitializationEvent evt) {
CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
CoreProxy.proxy.addName(quarryBlock, "Quarry");
+ quarryAdvBlock = new BlockAdvancedQuarry(Integer.parseInt(quarryAdvId.value));
+ CoreProxy.proxy.registerBlock(quarryAdvBlock.setBlockName("machineAdvBlock"));
+ CoreProxy.proxy.addName(quarryAdvBlock, "Advanced Quarry");
+
tankBlock = new BlockTank(Integer.parseInt(tankId.value));
CoreProxy.proxy.registerBlock(tankBlock.setBlockName("tankBlock"));
CoreProxy.proxy.addName(tankBlock, "Tank");
@@ -218,6 +207,12 @@ public static void loadRecipes() {
new Object[] { "ipi", "gig", "dDd", Character.valueOf('i'), BuildCraftCore.ironGearItem, Character.valueOf('p'), Item.redstone,
Character.valueOf('g'), BuildCraftCore.goldGearItem, Character.valueOf('d'), BuildCraftCore.diamondGearItem,
Character.valueOf('D'), Item.pickaxeDiamond, });
+
+ CoreProxy.proxy.addCraftingRecipe(
+ new ItemStack(quarryAdvBlock),
+ new Object[] { "gGg", "bQb", "rDr", Character.valueOf('g'), BuildCraftCore.goldGearItem, Character.valueOf('G'), Item.pickaxeGold,
+ Character.valueOf('b'), Item.expBottle, Character.valueOf('Q'), BuildCraftFactory.quarryBlock,
+ Character.valueOf('r'), Item.redstone, Character.valueOf('D'), BuildCraftCore.diamondGearItem });
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock), new Object[] { "T ", "W ", Character.valueOf('T'), tankBlock, Character.valueOf('W'),
miningWellBlock, });
View
1  common/buildcraft/core/DefaultProps.java
@@ -91,6 +91,7 @@
public static int DRILL_ID = 1501;
public static int AUTO_WORKBENCH_ID = 1502;
public static int QUARRY_ID = 1503;
+ public static int QUARRY_ADV_ID = 1523;
public static int MARKER_ID = 1504;
public static int FILLER_ID = 1505;
public static int BUILDER_ID = 1507;
View
30 common/buildcraft/factory/BlockAdvancedQuarry.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) sadris, 2013
+ * 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.factory;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class BlockAdvancedQuarry extends BlockQuarry {
+
+ public BlockAdvancedQuarry(int i) {
+ super(i);
+
+ super.textureSide = 4 * 16 + 12;
+ super.textureFront = 4 * 16 + 10;
+ super.textureTop = 4 * 16 + 11;
+
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World var1) {
+ return new TileAdvancedQuarry();
+ }
+}
View
77 common/buildcraft/factory/TileAdvancedQuarry.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) sadris, 2013
+ * 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.factory;
+
+import buildcraft.api.power.IPowerProvider;
+import buildcraft.core.Box;
+import buildcraft.core.EntityRobot;
+import buildcraft.core.blueprints.BptBuilderBase;
+import buildcraft.core.network.TileNetworkData;
+import buildcraft.core.proxy.CoreProxy;
+import net.minecraft.block.Block;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+
+import java.util.List;
+
+public class TileAdvancedQuarry extends TileQuarry {
+
+ public TileAdvancedQuarry() {
+ super();
+ }
+
+ public void positionReached() {
+ inProcess = false;
+
+ if (worldObj.isRemote)
+ return;
+
+ int i = targetX;
+ int j = targetY - 1;
+ int k = targetZ;
+
+ int blockId = worldObj.getBlockId(i, j, k);
+
+ if (isQuarriableBlock(i, j, k)) {
+ powerProvider.getTimeTracker().markTime(worldObj);
+
+ // Share this with mining well!
+
+ Block block = Block.blocksList[worldObj.getBlockId(i, j, k)];
+ if( block!=null ) {
+ mineStack( new ItemStack(block) );
+ }
+
+ worldObj.playAuxSFXAtEntity(null, 2001, i, j, k, blockId + (worldObj.getBlockMetadata(i, j, k) << 12));
+ worldObj.setBlockWithNotify(i, j, k, 0);
+ }
+
+ // Collect any lost items laying around
+ double[] head = getHead();
+ AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(head[0] - 2, head[1] - 2, head[2] - 2, head[0] + 3, head[1] + 3, head[2] + 3);
+ List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis);
+ for (int ii = 0; ii < result.size(); ii++) {
+ if (result.get(ii) instanceof EntityItem) {
+ EntityItem entity = (EntityItem) result.get(ii);
+ if (entity.isDead) {
+ continue;
+ }
+
+ ItemStack mineable = entity.getEntityItem();
+ if (mineable.stackSize <= 0) {
+ continue;
+ }
+ CoreProxy.proxy.removeEntity(entity);
+ mineStack(mineable);
+ }
+ }
+ }
+}
View
6 common/buildcraft/factory/TileQuarry.java
@@ -431,7 +431,7 @@ public void positionReached() {
}
}
- private void mineStack(ItemStack stack) {
+ protected void mineStack(ItemStack stack) {
// First, try to add to a nearby chest
ItemStack added = Utils.addToRandomInventory(stack, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN);
stack.stackSize -= added.stackSize;
@@ -460,7 +460,7 @@ private void mineStack(ItemStack stack) {
}
}
- private boolean isQuarriableBlock(int bx, int by, int bz) {
+ protected boolean isQuarriableBlock(int bx, int by, int bz) {
return BlockUtil.canChangeBlock(worldObj, bx, by, bz) && !BlockUtil.isSoftBlock(worldObj, bx, by, bz);
}
@@ -798,7 +798,7 @@ private void setHead(double x, double y, double z) {
this.headPosZ = z;
}
- private double[] getHead() {
+ protected double[] getHead() {
return new double[] { headPosX, headPosY, headPosZ };
}
View
14 common/buildcraft/transport/PipeTransportPower.java
@@ -237,15 +237,15 @@ public void receiveEnergy(ForgeDirection from, double val) {
((IPipeTransportPowerHook) this.container.pipe).receiveEnergy(from, val);
} else {
if (BuildCraftTransport.usePipeLoss) {
- internalNextPower[from.ordinal()] += val * (1 - powerResistance);
- } else {
- internalNextPower[from.ordinal()] += val;
+ val = val * (1 - powerResistance);
}
-
- if (internalNextPower[from.ordinal()] >= MAX_POWER_INTERNAL) {
- worldObj.createExplosion(null, xCoord, yCoord, zCoord, 3, false);
- worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, 0);
+ double newPower = internalNextPower[from.ordinal()] + val;
+ if (newPower + val >= MAX_POWER_INTERNAL) {
+ internalNextPower[from.ordinal()] = newPower - 1;
+ return;
}
+
+ internalNextPower[from.ordinal()] = newPower;
}
}
Something went wrong with that request. Please try again.