minor tweaks to builder algorithmics

This commit is contained in:
SpaceToad 2014-04-30 20:28:12 +02:00
parent 9e397870a2
commit 708b9b63cd
2 changed files with 16 additions and 16 deletions

View file

@ -29,13 +29,13 @@ import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicEntity; import buildcraft.api.blueprints.SchematicEntity;
import buildcraft.api.core.BCLog; import buildcraft.api.core.BCLog;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IInvSlot;
import buildcraft.api.core.StackKey; import buildcraft.api.core.StackKey;
import buildcraft.builders.TileAbstractBuilder; import buildcraft.builders.TileAbstractBuilder;
import buildcraft.core.BlockIndex; import buildcraft.core.BlockIndex;
import buildcraft.core.blueprints.BuildingSlotBlock.Mode; import buildcraft.core.blueprints.BuildingSlotBlock.Mode;
import buildcraft.core.inventory.InventoryCopy; import buildcraft.core.inventory.InventoryCopy;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.BlockUtil; import buildcraft.core.utils.BlockUtil;
@ -222,28 +222,25 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} else { } else {
if (setupForDestroy(builder, context, slot)) { if (setupForDestroy(builder, context, slot)) {
iterator.remove(); iterator.remove();
postProcessing.add(slot);
clearedLocations.add(new BlockIndex(slot.x, clearedLocations.add(new BlockIndex(slot.x,
slot.y, slot.z)); slot.y, slot.z));
return slot; return slot;
} }
} }
} else if (!slot.schematic.doNotBuild()) { } else if (!slot.schematic.doNotBuild()) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, if (checkRequirements(builder, slot.schematic)) {
slot.z)) { // At this stage, regardless of the fact that the
if (checkRequirements(builder, slot.schematic)) { // block can actually be built or not, we'll try.
useRequirements(builder, slot); // When the item reaches the actual block, we'll
// verify that the location is indeed clear, and
// avoid building otherwise.
useRequirements(builder, slot);
iterator.remove();
postProcessing.add(slot);
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
return slot;
}
} else {
// the block is not soft anymore, we can't build
// here. Forget about it.
iterator.remove(); iterator.remove();
postProcessing.add(slot);
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
return slot;
} }
} else { } else {
iterator.remove(); iterator.remove();

View file

@ -18,6 +18,7 @@ import buildcraft.api.blueprints.MappingRegistry;
import buildcraft.api.blueprints.SchematicBlockBase; import buildcraft.api.blueprints.SchematicBlockBase;
import buildcraft.api.blueprints.SchematicFactory; import buildcraft.api.blueprints.SchematicFactory;
import buildcraft.api.blueprints.SchematicMask; import buildcraft.api.blueprints.SchematicMask;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.Position; import buildcraft.api.core.Position;
public class BuildingSlotBlock extends BuildingSlot implements Comparable<BuildingSlotBlock> { public class BuildingSlotBlock extends BuildingSlot implements Comparable<BuildingSlotBlock> {
@ -122,7 +123,9 @@ public class BuildingSlotBlock extends BuildingSlot implements Comparable<Buildi
@Override @Override
public void writeCompleted (IBuilderContext context, double complete) { public void writeCompleted (IBuilderContext context, double complete) {
getSchematic().writeCompleted(context, x, y, z, complete); if (BuildCraftAPI.isSoftBlock(context.world(), x, y, z)) {
getSchematic().writeCompleted(context, x, y, z, complete);
}
} }
@Override @Override