Skip to content

Commit bb7aa41

Browse files
committed
Fix Quarry in the nether. Closes a bunch of bug reports no doubt.
1 parent 5b4d661 commit bb7aa41

3 files changed

Lines changed: 36 additions & 6 deletions

File tree

.project

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@
1414
<natures>
1515
<nature>org.eclipse.jdt.core.javanature</nature>
1616
</natures>
17+
<linkedResources>
18+
<link>
19+
<name>common/assets</name>
20+
<type>2</type>
21+
<locationURI>PROJECT_LOC/buildcraft_resources/assets</locationURI>
22+
</link>
23+
</linkedResources>
1724
</projectDescription>

common/buildcraft/core/utils/BlockUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public static boolean canChangeBlock(World world, int x, int y, int z) {
7474
return canChangeBlock(world.getBlockId(x, y, z), world, x, y, z);
7575
}
7676

77+
public static boolean isAnObstructingBlock(int blockID, World world, int x, int y, int z)
78+
{
79+
Block block = Block.blocksList[blockID];
80+
81+
if (blockID == 0 || block == null || block.isAirBlock(world, x, y, z))
82+
return false;
83+
return true;
84+
}
7785
public static boolean canChangeBlock(int blockID, World world, int x, int y, int z) {
7886
Block block = Block.blocksList[blockID];
7987

common/buildcraft/factory/TileQuarry.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.List;
1212
import java.util.Set;
1313

14+
import net.minecraft.block.Block;
1415
import net.minecraft.entity.item.EntityItem;
1516
import net.minecraft.entity.player.EntityPlayer;
1617
import net.minecraft.item.ItemStack;
@@ -259,15 +260,22 @@ public boolean findTarget(boolean doSet) {
259260
if (!columnVisitListIsUpdated) { // nextTarget may not be accurate, at least search the target column for changes
260261
for (int y = nextTarget[1] + 1; y < yCoord + 3; y++) {
261262
int blockID = worldObj.getBlockId(nextTarget[0], y, nextTarget[2]);
262-
263-
if (BlockUtil.canChangeBlock(blockID, worldObj, nextTarget[0], y, nextTarget[2]) && !BlockUtil.isSoftBlock(blockID, worldObj, nextTarget[0], y, nextTarget[2])) {
263+
if (BlockUtil.isAnObstructingBlock(blockID, worldObj, nextTarget[0], y, nextTarget[2]) || !BlockUtil.isSoftBlock(blockID, worldObj, nextTarget[0], y, nextTarget[2])) {
264264
createColumnVisitList();
265-
nextTarget = visitList.removeFirst();
266-
265+
columnVisitListIsUpdated = true;
266+
nextTarget = null;
267267
break;
268268
}
269269
}
270270
}
271+
if (columnVisitListIsUpdated && nextTarget == null && !visitList.isEmpty())
272+
{
273+
nextTarget = visitList.removeFirst();
274+
}
275+
else if (columnVisitListIsUpdated && nextTarget == null)
276+
{
277+
return false;
278+
}
271279

272280
setTarget(nextTarget[0], nextTarget[1] + 1, nextTarget[2]);
273281

@@ -316,8 +324,10 @@ private void createColumnVisitList() {
316324
if (height == null)
317325
columnHeights[searchX][searchZ] = height = worldObj.getHeightValue(bx, bz);
318326

319-
if (height < by)
320-
continue;
327+
if (height > 0 && height < by && worldObj.provider.dimensionId != -1)
328+
{
329+
continue;
330+
}
321331

322332
int blockID = worldObj.getBlockId(bx, by, bz);
323333

@@ -326,6 +336,11 @@ private void createColumnVisitList() {
326336
} else if (!BlockUtil.isSoftBlock(blockID, worldObj, bx, by, bz)) {
327337
visitList.add(new int[]{bx, by, bz});
328338
}
339+
if (height == 0 && !worldObj.isAirBlock(bx, by, bz))
340+
{
341+
columnHeights[searchX][searchZ] = by;
342+
}
343+
329344
// Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this
330345
if (visitList.size() > bluePrintBuilder.bluePrint.sizeZ * bluePrintBuilder.bluePrint.sizeX * 2)
331346
return;

0 commit comments

Comments
 (0)