Merge branch '6.5.x' of github.com:BuildCraft/BuildCraft into 7.1.x
This commit is contained in:
commit
0d3b5b2eb7
21 changed files with 181 additions and 145 deletions
|
@ -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.
|
||||||
|
|
|
@ -194,9 +194,9 @@ public class AIRobot {
|
||||||
if (aiRobotClass != null) {
|
if (aiRobotClass != null) {
|
||||||
delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
|
delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
|
||||||
.newInstance(robot);
|
.newInstance(robot);
|
||||||
|
delegateAI.parentAI = this;
|
||||||
|
|
||||||
if (delegateAI.canLoadFromNBT()) {
|
if (delegateAI.canLoadFromNBT()) {
|
||||||
delegateAI.parentAI = this;
|
|
||||||
delegateAI.loadFromNBT(sub);
|
delegateAI.loadFromNBT(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
|
||||||
apply plugin: 'maven' // for uploading to a maven repo
|
apply plugin: 'maven' // for uploading to a maven repo
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
version = "7.0.13"
|
version = "7.0.14"
|
||||||
group= "com.mod-buildcraft"
|
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]
|
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]
|
||||||
|
|
||||||
|
|
19
buildcraft_resources/changelog/7.0.14
Normal file
19
buildcraft_resources/changelog/7.0.14
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Improvements:
|
||||||
|
|
||||||
|
* Quarries now dig through light fluids and stop on dense fluids. Behaviour might change later, so watch out! (asie)
|
||||||
|
|
||||||
|
Bugs fixed:
|
||||||
|
|
||||||
|
* [#2880] Try to fix fluid pipe bug (asie)
|
||||||
|
* [#2878] Robot NPE for robots prior to 7.0.13 fix (asie)
|
||||||
|
* [#2877] Survival blueprint crash (asie)
|
||||||
|
* [#2841] Another crash with Oil in the Nether (asie)
|
||||||
|
* [#2837] Massive lag with Construction Markers (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)
|
||||||
|
* Block breaking robots sleeping in mid air (hea3ven)
|
||||||
|
* Error in robot AI loading (hea3ven)
|
||||||
|
* Incorrect Request Needed Items action name (asie)
|
||||||
|
* Packages crashing Minecraft if mods are removed (asie)
|
||||||
|
* Robots ignoring gate config on their linked station when equipping items (hea3ven)
|
|
@ -1,3 +1,3 @@
|
||||||
1.6.4:BuildCraft:4.2.2
|
1.6.4:BuildCraft:4.2.2
|
||||||
1.7.2:BuildCraft:6.0.16
|
1.7.2:BuildCraft:6.0.16
|
||||||
1.7.10:BuildCraft:7.0.13
|
1.7.10:BuildCraft:7.0.14
|
||||||
|
|
|
@ -489,7 +489,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());
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class LibraryDatabase {
|
||||||
int sepIndex = fileName.lastIndexOf(LibraryId.BPT_SEP_CHARACTER);
|
int sepIndex = fileName.lastIndexOf(LibraryId.BPT_SEP_CHARACTER);
|
||||||
int dotIndex = fileName.lastIndexOf('.');
|
int dotIndex = fileName.lastIndexOf('.');
|
||||||
|
|
||||||
|
if (dotIndex > 0) {
|
||||||
String extension = fileName.substring(dotIndex + 1);
|
String extension = fileName.substring(dotIndex + 1);
|
||||||
|
|
||||||
if (sepIndex > 0) {
|
if (sepIndex > 0) {
|
||||||
|
@ -169,6 +170,9 @@ public class LibraryDatabase {
|
||||||
if (!blueprintIds.contains(id)) {
|
if (!blueprintIds.contains(id)) {
|
||||||
blueprintIds.add(id);
|
blueprintIds.add(id);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
BCLog.logger.warn("Found incorrectly named (no extension) blueprint file: '%s'!", fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pages = blueprintIds.toArray(new LibraryId[blueprintIds.size()]);
|
pages = blueprintIds.toArray(new LibraryId[blueprintIds.size()]);
|
||||||
|
|
|
@ -209,7 +209,6 @@ public class TileConstructionMarker extends TileBuildCraft implements IBuildingI
|
||||||
@Override
|
@Override
|
||||||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||||
if (side.isServer() && "uploadBuildersInAction".equals(command)) {
|
if (side.isServer() && "uploadBuildersInAction".equals(command)) {
|
||||||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "uploadBuildersInAction", null));
|
|
||||||
for (BuildingItem i : buildersInAction) {
|
for (BuildingItem i : buildersInAction) {
|
||||||
BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender, createLaunchItemPacket(i));
|
BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender, createLaunchItemPacket(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.google.common.collect.Sets;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
@ -31,6 +32,7 @@ import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
|
|
||||||
import buildcraft.BuildCraftBuilders;
|
import buildcraft.BuildCraftBuilders;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
|
@ -313,9 +315,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 +340,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,29 +370,16 @@ 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)) {
|
||||||
blockedColumns[searchX][searchZ] = true;
|
blockedColumns[searchX][searchZ] = true;
|
||||||
} else if (!BuildCraftAPI.isSoftBlock(worldObj, bx, by, bz)) {
|
} else if (!BuildCraftAPI.isSoftBlock(worldObj, bx, by, bz) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock)) {
|
||||||
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) {
|
||||||
|
@ -487,7 +472,8 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
|
||||||
private boolean isQuarriableBlock(int bx, int by, int bz) {
|
private boolean isQuarriableBlock(int bx, int by, int bz) {
|
||||||
Block block = worldObj.getBlock(bx, by, bz);
|
Block block = worldObj.getBlock(bx, by, bz);
|
||||||
return BlockUtils.canChangeBlock(block, worldObj, bx, by, bz)
|
return BlockUtils.canChangeBlock(block, worldObj, bx, by, bz)
|
||||||
&& !BuildCraftAPI.isSoftBlock(worldObj, bx, by, bz);
|
&& !BuildCraftAPI.isSoftBlock(worldObj, bx, by, bz)
|
||||||
|
&& !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@ package buildcraft.core;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
|
|
@ -265,9 +265,11 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
||||||
|
|
||||||
private int getBuildListCount() {
|
private int getBuildListCount() {
|
||||||
int out = 0;
|
int out = 0;
|
||||||
|
if (buildStageOccurences != null) {
|
||||||
for (int i = 0; i < buildStageOccurences.length; i++) {
|
for (int i = 0; i < buildStageOccurences.length; i++) {
|
||||||
out += buildStageOccurences[i];
|
out += buildStageOccurences[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class BlockBuildCraftFluid extends BlockFluidClassic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
public boolean canDropFromExplosion(Explosion explosion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -139,13 +140,13 @@ public final class BlockUtils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this support all "heavy" liquids, not just oil/lava
|
|
||||||
if (block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null && "oil".equals(((IFluidBlock) block).getFluid().getName())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block == Blocks.lava || block == Blocks.flowing_lava) {
|
if (block == Blocks.lava || block == Blocks.flowing_lava) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null) {
|
||||||
|
Fluid f = ((IFluidBlock) block).getFluid();
|
||||||
|
if (f.getDensity(world, x, y, z) >= 3000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -62,7 +62,10 @@ public class DockingStationPipe extends DockingStation {
|
||||||
|
|
||||||
public IPipeTile getPipe() {
|
public IPipeTile getPipe() {
|
||||||
if (pipe == null) {
|
if (pipe == null) {
|
||||||
pipe = (IPipeTile) world.getTileEntity(x(), y(), z());
|
TileEntity tile = world.getTileEntity(x(), y(), z());
|
||||||
|
if (tile instanceof IPipeTile) {
|
||||||
|
pipe = (IPipeTile) tile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipe == null || ((TileEntity) pipe).isInvalid()) {
|
if (pipe == null || ((TileEntity) pipe).isInvalid()) {
|
||||||
|
|
|
@ -10,11 +10,10 @@ package buildcraft.robotics.ai;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.api.robots.AIRobot;
|
import buildcraft.api.robots.AIRobot;
|
||||||
import buildcraft.api.robots.DockingStation;
|
|
||||||
import buildcraft.api.robots.EntityRobotBase;
|
import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.core.lib.inventory.ITransactor;
|
import buildcraft.core.lib.inventory.ITransactor;
|
||||||
import buildcraft.core.lib.inventory.Transactor;
|
import buildcraft.core.lib.inventory.Transactor;
|
||||||
|
@ -37,11 +36,18 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
||||||
filter = new AggregateFilter(ActionRobotFilterTool.getGateFilter(iRobot.getLinkedStation()), iFilter);
|
filter = new AggregateFilter(ActionRobotFilterTool.getGateFilter(iRobot.getLinkedStation()), iFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (robot.getDockingStation() == null) {
|
if (robot.getDockingStation() == null) {
|
||||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
setSuccess(false);
|
||||||
} else {
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
if (delay++ > 40) {
|
if (delay++ > 40) {
|
||||||
if (equipItemStack()) {
|
if (equipItemStack()) {
|
||||||
terminate();
|
terminate();
|
||||||
|
@ -51,7 +57,6 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delegateAIEnded(AIRobot ai) {
|
public void delegateAIEnded(AIRobot ai) {
|
||||||
|
@ -71,31 +76,20 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equipItemStack() {
|
private boolean equipItemStack() {
|
||||||
if (robot.getDockingStation() != null) {
|
IInventory tileInventory = robot.getDockingStation().getItemInput();
|
||||||
DockingStation station = robot.getDockingStation();
|
if (tileInventory == null) {
|
||||||
|
return false;
|
||||||
ItemStack itemFound = null;
|
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
|
||||||
TileEntity nearbyTile = robot.worldObj.getTileEntity(station.x() + dir.offsetX,
|
|
||||||
station.y() + dir.offsetY, station.z() + dir.offsetZ);
|
|
||||||
|
|
||||||
if (nearbyTile != null && nearbyTile instanceof IInventory) {
|
|
||||||
ITransactor trans = Transactor.getTransactorFor(nearbyTile);
|
|
||||||
|
|
||||||
itemFound = trans.remove(filter, dir.getOpposite(), true);
|
|
||||||
|
|
||||||
if (itemFound != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ITransactor trans = Transactor.getTransactorFor(tileInventory);
|
||||||
|
|
||||||
|
ItemStack itemFound = trans.remove(filter, ForgeDirection.UNKNOWN, true);
|
||||||
|
|
||||||
if (itemFound != null) {
|
if (itemFound != null) {
|
||||||
robot.setItemInUse(itemFound);
|
robot.setItemInUse(itemFound);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
|
||||||
if (station == robot.getLinkedStation() && station == robot.getDockingStation()) {
|
if (station == robot.getLinkedStation() && station == robot.getDockingStation()) {
|
||||||
terminate();
|
terminate();
|
||||||
} else {
|
} else {
|
||||||
if (station.takeAsMain(robot)) {
|
if (station != null && station.takeAsMain(robot)) {
|
||||||
startDelegateAI(new AIRobotGotoBlock(robot,
|
startDelegateAI(new AIRobotGotoBlock(robot,
|
||||||
station.x() + station.side().offsetX * 2,
|
station.x() + station.side().offsetX * 2,
|
||||||
station.y() + station.side().offsetY * 2,
|
station.y() + station.side().offsetY * 2,
|
||||||
|
|
|
@ -15,7 +15,7 @@ import buildcraft.api.robots.EntityRobotBase;
|
||||||
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
||||||
import buildcraft.robotics.ai.AIRobotBreak;
|
import buildcraft.robotics.ai.AIRobotBreak;
|
||||||
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
|
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
|
||||||
import buildcraft.robotics.ai.AIRobotSleep;
|
import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||||
|
|
||||||
public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock {
|
public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock {
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearc
|
||||||
public void delegateAIEnded(AIRobot ai) {
|
public void delegateAIEnded(AIRobot ai) {
|
||||||
if (ai instanceof AIRobotFetchAndEquipItemStack) {
|
if (ai instanceof AIRobotFetchAndEquipItemStack) {
|
||||||
if (!ai.success()) {
|
if (!ai.success()) {
|
||||||
startDelegateAI(new AIRobotSleep(robot));
|
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||||
}
|
}
|
||||||
} else if (ai instanceof AIRobotBreak) {
|
} else if (ai instanceof AIRobotBreak) {
|
||||||
releaseBlockFound(ai.success());
|
releaseBlockFound(ai.success());
|
||||||
|
|
|
@ -112,7 +112,12 @@ public class TileStampingTable extends TileLaserTableBase implements IHasWork, I
|
||||||
NBTTagCompound tag = NBTUtils.getItemData(input);
|
NBTTagCompound tag = NBTUtils.getItemData(input);
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
if (tag.hasKey("item" + i)) {
|
if (tag.hasKey("item" + i)) {
|
||||||
crafting.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(tag.getCompoundTag("item" + i)));
|
ItemStack is = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("item" + i));
|
||||||
|
if (is != null) {
|
||||||
|
crafting.setInventorySlotContents(i, is);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
crafting.setInventorySlotContents(i, null);
|
crafting.setInventorySlotContents(i, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class PackageFontRenderer extends FontRenderer {
|
||||||
|
|
||||||
if (pkgTag.hasKey("item" + slotPos)) {
|
if (pkgTag.hasKey("item" + slotPos)) {
|
||||||
ItemStack slotStack = ItemStack.loadItemStackFromNBT(pkgTag.getCompoundTag("item" + slotPos));
|
ItemStack slotStack = ItemStack.loadItemStackFromNBT(pkgTag.getCompoundTag("item" + slotPos));
|
||||||
|
if (slotStack != null) {
|
||||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||||
FontRenderer font = slotStack.getItem().getFontRenderer(slotStack);
|
FontRenderer font = slotStack.getItem().getFontRenderer(slotStack);
|
||||||
|
@ -59,6 +60,9 @@ public class PackageFontRenderer extends FontRenderer {
|
||||||
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||||
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||||
itemRender.zLevel = 0.0F;
|
itemRender.zLevel = 0.0F;
|
||||||
|
} else {
|
||||||
|
realRenderer.drawString("X", rx, y, 0xFF0000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rx += 7;
|
rx += 7;
|
||||||
|
|
|
@ -226,9 +226,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fluidType != null) {
|
|
||||||
moveFluids();
|
moveFluids();
|
||||||
}
|
|
||||||
|
|
||||||
if (networkSyncTracker.markTimeIfDelay(container.getWorldObj())) {
|
if (networkSyncTracker.markTimeIfDelay(container.getWorldObj())) {
|
||||||
boolean init = false;
|
boolean init = false;
|
||||||
|
@ -245,17 +243,22 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveFluids() {
|
private void moveFluids() {
|
||||||
|
if (fluidType != null) {
|
||||||
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
|
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
|
||||||
short outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
|
int outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
|
||||||
|
|
||||||
|
if (fluidType != null) {
|
||||||
moveFromPipe(outputCount);
|
moveFromPipe(outputCount);
|
||||||
moveFromCenter();
|
moveFromCenter();
|
||||||
moveToCenter();
|
moveToCenter();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
computeTTLs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void moveFromPipe(short outputCount) {
|
private void moveFromPipe(int outputCount) {
|
||||||
// Move liquid from the non-center to the connected output blocks
|
// Move liquid from the non-center to the connected output blocks
|
||||||
boolean pushed = false;
|
|
||||||
if (outputCount > 0) {
|
if (outputCount > 0) {
|
||||||
for (ForgeDirection o : directions) {
|
for (ForgeDirection o : directions) {
|
||||||
if (transferState[o.ordinal()] == TransferState.Output) {
|
if (transferState[o.ordinal()] == TransferState.Output) {
|
||||||
|
@ -270,7 +273,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
if (liquidToPush.amount > 0) {
|
if (liquidToPush.amount > 0) {
|
||||||
int filled = ((IFluidHandler) target).fill(o.getOpposite(), liquidToPush, true);
|
int filled = ((IFluidHandler) target).fill(o.getOpposite(), liquidToPush, true);
|
||||||
section.drain(filled, true);
|
section.drain(filled, true);
|
||||||
pushed = true;
|
|
||||||
if (filled <= 0) {
|
if (filled <= 0) {
|
||||||
outputTTL[o.ordinal()]--;
|
outputTTL[o.ordinal()]--;
|
||||||
}
|
}
|
||||||
|
@ -278,19 +280,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pushed) {
|
|
||||||
boolean hasFluid = false;
|
|
||||||
for (PipeSection s: sections) {
|
|
||||||
if (s.amount > 0) {
|
|
||||||
hasFluid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasFluid) {
|
|
||||||
setFluidType(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveFromCenter() {
|
private void moveFromCenter() {
|
||||||
|
@ -361,43 +350,76 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private short computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) {
|
private void computeTTLs() {
|
||||||
short outputCount = 0;
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (transferState[i] == TransferState.Input) {
|
||||||
|
if (inputTTL[i] > 0) {
|
||||||
|
inputTTL[i]--;
|
||||||
|
} else {
|
||||||
|
transferState[i] = TransferState.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Processes all interna4al tanks
|
if (outputCooldown[i] > 0) {
|
||||||
|
outputCooldown[i]--;
|
||||||
|
} else {
|
||||||
|
if (outputTTL[i] > 0) {
|
||||||
|
outputTTL[i]--;
|
||||||
|
} else {
|
||||||
|
transferState[i] = TransferState.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) {
|
||||||
|
int outputCount = 0;
|
||||||
|
int fluidAmount = 0;
|
||||||
|
|
||||||
|
// Processes all internal tanks
|
||||||
for (ForgeDirection direction : orientations) {
|
for (ForgeDirection direction : orientations) {
|
||||||
sections[direction.ordinal()].setTime(newTimeSlot);
|
int dirI = direction.ordinal();
|
||||||
sections[direction.ordinal()].moveFluids();
|
PipeSection section = sections[dirI];
|
||||||
|
|
||||||
|
fluidAmount += section.amount;
|
||||||
|
section.setTime(newTimeSlot);
|
||||||
|
section.moveFluids();
|
||||||
|
|
||||||
// Input processing
|
// Input processing
|
||||||
if (direction == ForgeDirection.UNKNOWN) {
|
if (direction == ForgeDirection.UNKNOWN) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (transferState[direction.ordinal()] == TransferState.Input) {
|
if (transferState[dirI] == TransferState.Input) {
|
||||||
inputTTL[direction.ordinal()]--;
|
inputTTL[dirI]--;
|
||||||
if (inputTTL[direction.ordinal()] <= 0) {
|
if (inputTTL[dirI] <= 0) {
|
||||||
transferState[direction.ordinal()] = TransferState.None;
|
transferState[dirI] = TransferState.None;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!container.pipe.outputOpen(direction)) {
|
if (!container.pipe.outputOpen(direction)) {
|
||||||
transferState[direction.ordinal()] = TransferState.None;
|
transferState[dirI] = TransferState.None;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (outputCooldown[direction.ordinal()] > 0) {
|
if (outputCooldown[dirI] > 0) {
|
||||||
outputCooldown[direction.ordinal()]--;
|
outputCooldown[dirI]--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (outputTTL[direction.ordinal()] <= 0) {
|
if (outputTTL[dirI] <= 0) {
|
||||||
transferState[direction.ordinal()] = TransferState.None;
|
transferState[dirI] = TransferState.None;
|
||||||
outputCooldown[direction.ordinal()] = OUTPUT_COOLDOWN;
|
outputCooldown[dirI] = OUTPUT_COOLDOWN;
|
||||||
outputTTL[direction.ordinal()] = OUTPUT_TTL;
|
outputTTL[dirI] = OUTPUT_TTL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (canReceiveCache[direction.ordinal()] && outputOpen(direction)) {
|
if (canReceiveCache[dirI] && outputOpen(direction)) {
|
||||||
transferState[direction.ordinal()] = TransferState.Output;
|
transferState[dirI] = TransferState.Output;
|
||||||
outputCount++;
|
outputCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fluidAmount == 0) {
|
||||||
|
setFluidType(null);
|
||||||
|
}
|
||||||
|
|
||||||
return outputCount;
|
return outputCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue