revert february 2013 optimization - fix 3 issues related to quarry mining

This commit is contained in:
Adrian 2015-07-11 14:31:01 +02:00
parent 3ba539ade3
commit 915d900a40
6 changed files with 4 additions and 21 deletions

View file

@ -38,7 +38,7 @@ public abstract class Schematic {
* Blocks are build in various stages, in order to make sure that a block * Blocks are build in various stages, in order to make sure that a block
* can indeed be placed, and that it's unlikely to disturb other blocks. * can indeed be placed, and that it's unlikely to disturb other blocks.
*/ */
public static enum BuildingStage { public enum BuildingStage {
/** /**
* Standalone blocks can be placed in the air, and they don't change * Standalone blocks can be placed in the air, and they don't change
* once placed. * once placed.

View file

@ -6,6 +6,7 @@ Bugs fixed:
* [#2841] Another crash with Oil in the Nether (asie) * [#2841] Another crash with Oil in the Nether (asie)
* [#2837] Massive lag with Construction Markers (hea3ven) * [#2837] Massive lag with Construction Markers (hea3ven)
* [#2831] Robots sinking through the ground (hea3ven) * [#2831] Robots sinking through the ground (hea3ven)
* [#2825, #2618, #1777] Quarry issues with just about every translucent block (asie)
* Allow Builders to use arbitrary IPathProviders (asie) * Allow Builders to use arbitrary IPathProviders (asie)
* Block breaking robots sleeping in mid air (hea3ven) * Block breaking robots sleeping in mid air (hea3ven)
* Error in robot AI loading (hea3ven) * Error in robot AI loading (hea3ven)

View file

@ -466,7 +466,6 @@ public class BuildCraftCore extends BuildCraftMod {
BuildCraftAPI.softBlocks.add(Blocks.snow); BuildCraftAPI.softBlocks.add(Blocks.snow);
BuildCraftAPI.softBlocks.add(Blocks.vine); BuildCraftAPI.softBlocks.add(Blocks.vine);
BuildCraftAPI.softBlocks.add(Blocks.fire); BuildCraftAPI.softBlocks.add(Blocks.fire);
BuildCraftAPI.softBlocks.add(Blocks.air);
FMLCommonHandler.instance().bus().register(new TickHandlerCore()); FMLCommonHandler.instance().bus().register(new TickHandlerCore());

View file

@ -313,9 +313,7 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
if (!columnVisitListIsUpdated) { // nextTarget may not be accurate, at least search the target column for changes if (!columnVisitListIsUpdated) { // nextTarget may not be accurate, at least search the target column for changes
for (int y = nextTarget[1] + 1; y < yCoord + 3; y++) { for (int y = nextTarget[1] + 1; y < yCoord + 3; y++) {
Block block = worldObj.getBlock(nextTarget[0], y, nextTarget[2]); if (isQuarriableBlock(nextTarget[0], y, nextTarget[2])) {
if (BlockUtils.isAnObstructingBlock(block, worldObj, nextTarget[0], y, nextTarget[2])
|| !BuildCraftAPI.isSoftBlock(worldObj, nextTarget[0], y, nextTarget[2])) {
createColumnVisitList(); createColumnVisitList();
columnVisitListIsUpdated = true; columnVisitListIsUpdated = true;
nextTarget = null; nextTarget = null;
@ -340,8 +338,6 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
*/ */
private void createColumnVisitList() { private void createColumnVisitList() {
visitList.clear(); visitList.clear();
Integer[][] columnHeights = new Integer[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2];
boolean[][] blockedColumns = new boolean[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2]; boolean[][] blockedColumns = new boolean[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2];
for (int searchY = yCoord + 3; searchY >= 1; --searchY) { for (int searchY = yCoord + 3; searchY >= 1; --searchY) {
@ -372,17 +368,8 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
for (int searchZ = startZ; searchZ != endZ; searchZ += incZ) { for (int searchZ = startZ; searchZ != endZ; searchZ += incZ) {
if (!blockedColumns[searchX][searchZ]) { if (!blockedColumns[searchX][searchZ]) {
Integer height = columnHeights[searchX][searchZ];
int bx = box.xMin + searchX + 1, by = searchY, bz = box.zMin + searchZ + 1; int bx = box.xMin + searchX + 1, by = searchY, bz = box.zMin + searchZ + 1;
if (height == null) {
columnHeights[searchX][searchZ] = height = worldObj.getHeightValue(bx, bz);
}
if (height > 0 && height < by && worldObj.provider.dimensionId != -1) {
continue;
}
Block block = worldObj.getBlock(bx, by, bz); Block block = worldObj.getBlock(bx, by, bz);
if (!BlockUtils.canChangeBlock(block, worldObj, bx, by, bz)) { if (!BlockUtils.canChangeBlock(block, worldObj, bx, by, bz)) {
@ -391,10 +378,6 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
visitList.add(new int[]{bx, by, bz}); visitList.add(new int[]{bx, by, bz});
} }
if (height == 0 && !worldObj.isAirBlock(bx, by, bz)) {
columnHeights[searchX][searchZ] = by;
}
// Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this // Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this
if (visitList.size() > builder.blueprint.sizeZ * builder.blueprint.sizeX * 2) { if (visitList.size() > builder.blueprint.sizeZ * builder.blueprint.sizeX * 2) {

View file

@ -119,6 +119,7 @@ public final class BlockUtils {
world.spawnEntityInWorld(entityitem); world.spawnEntityInWorld(entityitem);
} }
@Deprecated
public static boolean isAnObstructingBlock(Block block, World world, int x, int y, int z) { public static boolean isAnObstructingBlock(Block block, World world, int x, int y, int z) {
if (block == null || block.isAir(world, x, y, z)) { if (block == null || block.isAir(world, x, y, z)) {
return false; return false;

View file

@ -14,7 +14,6 @@ import net.minecraft.world.IBlockAccess;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
public class WorldPropertyIsSoft extends WorldProperty { public class WorldPropertyIsSoft extends WorldProperty {
@Override @Override
public boolean get(IBlockAccess blockAccess, Block block, int meta, int x, int y, int z) { public boolean get(IBlockAccess blockAccess, Block block, int meta, int x, int y, int z) {
return block == null return block == null