Merge branch '6.4.x' of github.com:BuildCraft/BuildCraft into 6.5.x

This commit is contained in:
asiekierka 2015-04-01 16:28:29 +02:00
commit 4378884e78
10 changed files with 102 additions and 76 deletions

View file

@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle'
version = "7.0.0"
version = "7.0.1"
group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]

View file

@ -0,0 +1,8 @@
Improvements:
[#2587] Hollow Facades now display in the creative tab (asie)
Bugfixes:
[#2600, #2591, #2589, #2584, others] **Builder/Filler causing unbearable lag** (asie) (tested it this time! I'm pretty sure I got it)
[#2593] Stripes Pipe fluid dupe bug (asie)
Fixed planters stopping under certain conditions (hea3ven)
Fixed robots stopping under certain different conditions (hea3ven)

View file

@ -1,3 +1,3 @@
1.6.4:BuildCraft:4.2.2
1.7.2:BuildCraft:6.0.16
1.7.10:BuildCraft:6.4.5
1.7.10:BuildCraft:6.4.6

View file

@ -9,7 +9,7 @@
package buildcraft.core.blueprints;
import java.util.HashSet;
import java.util.LinkedList;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@ -180,8 +180,6 @@ public abstract class BptBuilderBase implements IAreaProvider {
}
protected final boolean canDestroy(TileAbstractBuilder builder, IBuilderContext context, BuildingSlotBlock slot) {
LinkedList<ItemStack> result = new LinkedList<ItemStack>();
return builder.energyAvailable() >= getBlockBreakEnergy(slot);
}

View file

@ -334,8 +334,21 @@ public class BptBuilderBlueprint extends BptBuilderBase {
}
try {
if (BlockUtils.isUnbreakableBlock(world, slot.x, slot.y, slot.z)
|| isBlockBreakCanceled(world, slot.x, slot.y, slot.z)) {
if (slot.isAlreadyBuilt(context)) {
if (slot.mode == Mode.Build) {
// Even slots that considered already built may need
// post processing calls. For example, flowing water
// may need to be adjusted, engines may need to be
// turned to the right direction, etc.
postProcessing.add(slot);
}
iterator.remove();
continue;
}
if (BlockUtils.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
// if the block can't be broken, just forget this iterator
iterator.remove();
@ -346,10 +359,11 @@ public class BptBuilderBlueprint extends BptBuilderBase {
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
}
} else if (!slot.isAlreadyBuilt(context)) {
} else {
if (slot.mode == Mode.ClearIfInvalid) {
if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y,
slot.z)) {
slot.z)
|| isBlockBreakCanceled(world, slot.x, slot.y, slot.z)) {
iterator.remove();
clearedLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
@ -370,13 +384,16 @@ public class BptBuilderBlueprint extends BptBuilderBase {
} else if (!slot.schematic.doNotBuild()) {
if (builder == null) {
return slot;
} else if (isBlockPlaceCanceled(world, x, y, z, slot.schematic)) {
// Forge does not allow us to place a block in
// this position.
iterator.remove();
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
} else if (checkRequirements(builder, slot.schematic)) {
if (isBlockPlaceCanceled(world, slot.x, slot.y, slot.z, slot.schematic)) {
// Forge does not allow us to place a block in
// this position.
iterator.remove();
builtLocations.add(new BlockIndex(slot.x,
slot.y, slot.z));
continue;
}
// At this stage, regardless of the fact that the
// block can actually be built or not, we'll try.
// When the item reaches the actual block, we'll
@ -393,20 +410,10 @@ public class BptBuilderBlueprint extends BptBuilderBase {
}
} else {
// Even slots that don't need to be build may need
// post processing, see below for the argument.
// post processing, see above for the argument.
postProcessing.add(slot);
iterator.remove();
}
} else {
if (slot.mode == Mode.Build) {
// Even slots that considered already built may need
// post processing calls. For example, flowing water
// may need to be adjusted, engines may need to be
// turned to the right direction, etc.
postProcessing.add(slot);
}
iterator.remove();
}
} catch (Throwable t) {
// Defensive code against errors in implementers
@ -513,7 +520,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
}
}
return !(builder.energyAvailable() < slot.getEnergyRequirement(stacksUsed));
return builder.energyAvailable() >= slot.getEnergyRequirement(stacksUsed);
}
@Override

View file

@ -126,10 +126,10 @@ public class BptBuilderTemplate extends BptBuilderBase {
if (slot != null) {
return slot;
}
} else {
checkDone();
}
checkDone();
return null;
}
@ -161,20 +161,22 @@ public class BptBuilderTemplate extends BptBuilderBase {
break;
}
if (BlockUtils.isUnbreakableBlock(world, slot.x, slot.y, slot.z)
|| isBlockBreakCanceled(world, slot.x, slot.y, slot.z)
|| BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
iteratorClear.remove();
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
} else if (canDestroy(builder, context, slot)) {
consumeEnergyToDestroy(builder, slot);
createDestroyItems(slot);
if (canDestroy(builder, context, slot)) {
if (BlockUtils.isUnbreakableBlock(world, slot.x, slot.y, slot.z)
|| isBlockBreakCanceled(world, slot.x, slot.y, slot.z)
|| BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
iteratorClear.remove();
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
} else {
consumeEnergyToDestroy(builder, slot);
createDestroyItems(slot);
result = slot;
iteratorClear.remove();
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
result = slot;
iteratorClear.remove();
clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
break;
break;
}
}
}
@ -183,7 +185,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
}
// Step 2: Check the built, but only if we have anything to place and enough energy
if (firstSlotToConsume == null || builder.getBattery().getEnergyStored() < BuilderAPI.BUILD_ENERGY) {
if (firstSlotToConsume == null) {
return null;
}
@ -198,7 +200,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
}
if (BlockUtils.isUnbreakableBlock(world, slot.x, slot.y, slot.z)
|| isBlockPlaceCanceled(world, x, y, z, slot.schematic)
|| isBlockPlaceCanceled(world, slot.x, slot.y, slot.z, slot.schematic)
|| !BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
iteratorBuild.remove();
builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));

View file

@ -12,8 +12,7 @@ import java.util.Iterator;
import java.util.LinkedList;
public class BuildingSlotIterator {
private static int ITERATIONS_MAX = 1000;
private static int ITERATIONS_MAX = 500;
private LinkedList<BuildingSlotBlock> buildList;
private Iterator<BuildingSlotBlock> current;

View file

@ -178,7 +178,11 @@ public final class BlockUtils {
if (fluid != null && FluidRegistry.isFluidRegistered(fluid)) {
int meta = world.getBlockMetadata(x, y, z);
if (meta != 0) {
if (block instanceof IFluidBlock) {
if (!((IFluidBlock) block).canDrain(world, x, y, z)) {
return null;
}
} else if (meta != 0) {
return null;
}

View file

@ -133,6 +133,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
}
public static final ArrayList<ItemStack> allFacades = new ArrayList<ItemStack>();
public static final ArrayList<ItemStack> allHollowFacades = new ArrayList<ItemStack>();
public static final ArrayList<String> allFacadeIDs = new ArrayList<String>();
public static final ArrayList<String> blacklistedFacades = new ArrayList<String>();
@ -207,9 +208,11 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
// Do not call super, that would add a 0:0 facade
for (ItemStack stack : allFacades) {
itemList.add(stack.copy());
itemList.add(stack);
}
for (ItemStack stack : allHollowFacades) {
itemList.add(stack);
}
}
@ -440,6 +443,8 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
FacadeState state = getFacadeStates(facade6)[0];
ItemStack facadeHollow = getFacade(new FacadeState(state.block, state.metadata, state.wire, true));
allHollowFacades.add(facadeHollow);
ItemStack facade6Hollow = facadeHollow.copy();
facade6Hollow.stackSize = 6;

View file

@ -8,16 +8,26 @@ import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import buildcraft.api.transport.IStripesActivator;
import buildcraft.api.transport.IStripesHandler;
import buildcraft.core.utils.BlockUtils;
public class StripesHandlerBucket implements IStripesHandler {
private static final ItemStack emptyBucket = new ItemStack(Items.bucket, 1);
private ItemStack getFilledBucket(FluidStack fluidStack, Block underblock) {
if (underblock == Blocks.lava) {
return new ItemStack(Items.lava_bucket, 1);
} else if (underblock == Blocks.water) {
return new ItemStack(Items.water_bucket, 1);
} else {
return FluidContainerRegistry.fillFluidContainer(fluidStack, emptyBucket);
}
}
@Override
public StripesHandlerType getType() {
return StripesHandlerType.ITEM_USE;
@ -45,33 +55,26 @@ public class StripesHandlerBucket implements IStripesHandler {
return true;
} else {
ItemStack filledBucket = null;
if (underblock instanceof IFluidBlock) {
Fluid fluid = ((IFluidBlock) underblock).getFluid();
FluidStack fluidStack = new FluidStack(fluid, 1000);
filledBucket = FluidContainerRegistry.fillFluidContainer(fluidStack, emptyBucket);
}
if (underblock == Blocks.lava) {
filledBucket = new ItemStack(Items.lava_bucket, 1);
}
if (underblock == Blocks.water) {
filledBucket = new ItemStack(Items.water_bucket, 1);
}
if (filledBucket != null) {
world.setBlockToAir(x, y - 1, z);
activator.sendItem(filledBucket, direction.getOpposite());
stack.stackSize--;
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
if (!FluidContainerRegistry.isEmptyContainer(stack)) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
FluidStack fluidStack = BlockUtils.drainBlock(underblock, world, x, y - 1, z, true);
ItemStack filledBucket = getFilledBucket(fluidStack, underblock);
if (fluidStack == null || filledBucket == null) {
activator.sendItem(stack, direction.getOpposite());
return true;
}
activator.sendItem(filledBucket, direction.getOpposite());
stack.stackSize--;
if (stack.stackSize > 0) {
activator.sendItem(stack, direction.getOpposite());
}
return true;
}
}
return false;