Merge branch '6.4.x' of github.com:BuildCraft/BuildCraft into 6.4.x
This commit is contained in:
commit
7bf6f02da3
5 changed files with 32 additions and 21 deletions
|
@ -508,7 +508,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
// Add base recipe for pipe waterproof.
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));
|
||||
if (additionalWaterproofingRecipe) {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.slime_ball, 1, 2));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.slime_ball, 1));
|
||||
}
|
||||
|
||||
// Add pipe recipes
|
||||
|
|
|
@ -363,9 +363,9 @@ public class Box implements IBox, ISerializable {
|
|||
|
||||
@Override
|
||||
public BlockIndex getRandomBlockIndex(Random rand) {
|
||||
int x = (xMax > xMin) ? xMin + rand.nextInt(xMax - xMin) : xMin;
|
||||
int y = (yMax > yMin) ? yMin + rand.nextInt(yMax - yMin) : yMin;
|
||||
int z = (zMax > zMin) ? zMin + rand.nextInt(zMax - zMin) : zMin;
|
||||
int x = (xMax > xMin) ? xMin + rand.nextInt(xMax - xMin + 1) : xMin;
|
||||
int y = (yMax > yMin) ? yMin + rand.nextInt(yMax - yMin + 1) : yMin;
|
||||
int z = (zMax > zMin) ? zMin + rand.nextInt(zMax - zMin + 1) : zMin;
|
||||
|
||||
return new BlockIndex(x, y, z);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ZoneChunk implements ISerializable {
|
|||
while (bitId > 0) {
|
||||
bitId--;
|
||||
|
||||
bitPosition = property.nextSetBit(bitPosition);
|
||||
bitPosition = property.nextSetBit(bitPosition + 1);
|
||||
}
|
||||
|
||||
z = bitPosition / 16;
|
||||
|
|
|
@ -56,33 +56,38 @@ public class AIRobotBreak extends AIRobot {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
if (block == null || block.isAir(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z)) {
|
||||
terminate();
|
||||
}
|
||||
|
||||
if (hardness != 0) {
|
||||
blockDamage += speed / hardness / 30F;
|
||||
blockDamage += speed / hardness / 30F;
|
||||
} else {
|
||||
// Instantly break the block
|
||||
blockDamage = 1.1F;
|
||||
// Instantly break the block
|
||||
blockDamage = 1.1F;
|
||||
}
|
||||
|
||||
if (blockDamage > 1.0F) {
|
||||
robot.worldObj.destroyBlockInWorldPartially(robot.getEntityId(), blockToBreak.x,
|
||||
blockToBreak.y, blockToBreak.z, -1);
|
||||
blockToBreak.y, blockToBreak.z, -1);
|
||||
blockDamage = 0;
|
||||
|
||||
if (robot.getHeldItem() != null) {
|
||||
robot.getHeldItem().getItem()
|
||||
.onBlockStartBreak(robot.getHeldItem(), blockToBreak.x, blockToBreak.y, blockToBreak.z,
|
||||
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) robot.worldObj).get());
|
||||
.onBlockStartBreak(robot.getHeldItem(), blockToBreak.x, blockToBreak.y, blockToBreak.z,
|
||||
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) robot.worldObj).get());
|
||||
}
|
||||
|
||||
if (BlockUtils.breakBlock((WorldServer) robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z, 6000)) {
|
||||
robot.worldObj.playAuxSFXAtEntity(null, 2001,
|
||||
blockToBreak.x, blockToBreak.y, blockToBreak.z,
|
||||
Block.getIdFromBlock(block) + (meta << 12));
|
||||
blockToBreak.x, blockToBreak.y, blockToBreak.z,
|
||||
Block.getIdFromBlock(block) + (meta << 12));
|
||||
|
||||
if (robot.getHeldItem() != null) {
|
||||
robot.getHeldItem().getItem()
|
||||
.onBlockDestroyed(robot.getHeldItem(), robot.worldObj, block, blockToBreak.x,
|
||||
blockToBreak.y, blockToBreak.z, robot);
|
||||
.onBlockDestroyed(robot.getHeldItem(), robot.worldObj, block, blockToBreak.x,
|
||||
blockToBreak.y, blockToBreak.z, robot);
|
||||
|
||||
if (robot.getHeldItem().getItemDamage() >= robot.getHeldItem().getMaxDamage()) {
|
||||
robot.setItemInUse(null);
|
||||
|
@ -93,7 +98,7 @@ public class AIRobotBreak extends AIRobot {
|
|||
terminate();
|
||||
} else {
|
||||
robot.worldObj.destroyBlockInWorldPartially(robot.getEntityId(), blockToBreak.x,
|
||||
blockToBreak.y, blockToBreak.z, (int) (blockDamage * 10.0F) - 1);
|
||||
blockToBreak.y, blockToBreak.z, (int) (blockDamage * 10.0F) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
|
|||
blockFilter = new IBlockFilter() {
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z).canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) Blocks.reeds)
|
||||
&& world.getBlock(x, y, z) != Blocks.reeds
|
||||
return isPlantable((IPlantable) Blocks.reeds, Blocks.reeds, world, x, y, z)
|
||||
&& !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))
|
||||
&& isAirAbove(world, x, y, z);
|
||||
}
|
||||
|
@ -98,17 +97,17 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
|
|||
blockFilter = new IBlockFilter() {
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z).canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) plantBlock)
|
||||
&& world.getBlock(x, y, z) != plantBlock
|
||||
return isPlantable((IPlantable) plantBlock, plantBlock, world, x, y, z)
|
||||
&& !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))
|
||||
&& isAirAbove(world, x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
} else {
|
||||
blockFilter = new IBlockFilter() {
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z).canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) itemStack.getItem())
|
||||
return isPlantable((IPlantable) itemStack.getItem(), null, world, x, y, z)
|
||||
&& !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))
|
||||
&& isAirAbove(world, x, y, z);
|
||||
}
|
||||
|
@ -172,6 +171,13 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isPlantable(IPlantable plant, Block block, World world, int x, int y, int z) {
|
||||
synchronized (world) {
|
||||
return world.getBlock(x, y, z).canSustainPlant(world, x, y, z, ForgeDirection.UP, plant)
|
||||
&& (block == null || world.getBlock(x, y, z) != block);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAirAbove(World world, int x, int y, int z) {
|
||||
synchronized (world) {
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
|
|
Loading…
Reference in a new issue