Merge branch '6.5.x' of github.com:BuildCraft/BuildCraft into 6.5.x
This commit is contained in:
commit
c90dde2c37
26 changed files with 210 additions and 226 deletions
|
@ -38,7 +38,7 @@ public abstract class Schematic {
|
|||
* 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.
|
||||
*/
|
||||
public static enum BuildingStage {
|
||||
public enum BuildingStage {
|
||||
/**
|
||||
* Standalone blocks can be placed in the air, and they don't change
|
||||
* once placed.
|
||||
|
|
|
@ -194,9 +194,9 @@ public class AIRobot {
|
|||
if (aiRobotClass != null) {
|
||||
delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class)
|
||||
.newInstance(robot);
|
||||
delegateAI.parentAI = this;
|
||||
|
||||
if (delegateAI.canLoadFromNBT()) {
|
||||
delegateAI.parentAI = this;
|
||||
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: 'checkstyle'
|
||||
|
||||
version = "7.0.13"
|
||||
version = "7.0.15"
|
||||
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]
|
||||
|
||||
|
|
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)
|
5
buildcraft_resources/changelog/7.0.15
Normal file
5
buildcraft_resources/changelog/7.0.15
Normal file
|
@ -0,0 +1,5 @@
|
|||
Bugs fixed:
|
||||
|
||||
* [#2883] Pipe Empty/Fluid Traversing not working on fluid pipes (asie)
|
||||
* [#2882] **Massive Recipe Packager dupe bug** (asie)
|
||||
* Packager GUI issues on shift-click (asie)
|
|
@ -1,3 +1,3 @@
|
|||
1.6.4:BuildCraft:4.2.2
|
||||
1.7.2:BuildCraft:6.0.16
|
||||
1.7.10:BuildCraft:7.0.13
|
||||
1.7.10:BuildCraft:7.0.15
|
||||
|
|
|
@ -466,7 +466,6 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
BuildCraftAPI.softBlocks.add(Blocks.snow);
|
||||
BuildCraftAPI.softBlocks.add(Blocks.vine);
|
||||
BuildCraftAPI.softBlocks.add(Blocks.fire);
|
||||
BuildCraftAPI.softBlocks.add(Blocks.air);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new TickHandlerCore());
|
||||
|
||||
|
|
|
@ -150,22 +150,26 @@ public class LibraryDatabase {
|
|||
int sepIndex = fileName.lastIndexOf(LibraryId.BPT_SEP_CHARACTER);
|
||||
int dotIndex = fileName.lastIndexOf('.');
|
||||
|
||||
String extension = fileName.substring(dotIndex + 1);
|
||||
if (dotIndex > 0) {
|
||||
String extension = fileName.substring(dotIndex + 1);
|
||||
|
||||
if (sepIndex > 0) {
|
||||
String prefix = fileName.substring(0, sepIndex);
|
||||
String suffix = fileName.substring(sepIndex + 1);
|
||||
if (sepIndex > 0) {
|
||||
String prefix = fileName.substring(0, sepIndex);
|
||||
String suffix = fileName.substring(sepIndex + 1);
|
||||
|
||||
id.name = prefix;
|
||||
id.uniqueId = LibraryId.toBytes(suffix.substring(0, suffix.length() - (extension.length() + 1)));
|
||||
id.name = prefix;
|
||||
id.uniqueId = LibraryId.toBytes(suffix.substring(0, suffix.length() - (extension.length() + 1)));
|
||||
} else {
|
||||
id.name = fileName.substring(0, dotIndex);
|
||||
id.uniqueId = new byte[0];
|
||||
}
|
||||
id.extension = extension;
|
||||
|
||||
if (!blueprintIds.contains(id)) {
|
||||
blueprintIds.add(id);
|
||||
}
|
||||
} else {
|
||||
id.name = fileName.substring(0, dotIndex);
|
||||
id.uniqueId = new byte[0];
|
||||
}
|
||||
id.extension = extension;
|
||||
|
||||
if (!blueprintIds.contains(id)) {
|
||||
blueprintIds.add(id);
|
||||
BCLog.logger.warn("Found incorrectly named (no extension) blueprint file: '%s'!", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,6 @@ public class TileConstructionMarker extends TileBuildCraft implements IBuildingI
|
|||
@Override
|
||||
public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) {
|
||||
if (side.isServer() && "uploadBuildersInAction".equals(command)) {
|
||||
BuildCraftCore.instance.sendToServer(new PacketCommand(this, "uploadBuildersInAction", null));
|
||||
for (BuildingItem i : buildersInAction) {
|
||||
BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender, createLaunchItemPacket(i));
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ package buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.google.common.collect.Sets;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
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
|
||||
for (int y = nextTarget[1] + 1; y < yCoord + 3; y++) {
|
||||
Block block = worldObj.getBlock(nextTarget[0], y, nextTarget[2]);
|
||||
if (BlockUtils.isAnObstructingBlock(block, worldObj, nextTarget[0], y, nextTarget[2])
|
||||
|| !BuildCraftAPI.isSoftBlock(worldObj, nextTarget[0], y, nextTarget[2])) {
|
||||
if (isQuarriableBlock(nextTarget[0], y, nextTarget[2])) {
|
||||
createColumnVisitList();
|
||||
columnVisitListIsUpdated = true;
|
||||
nextTarget = null;
|
||||
|
@ -340,8 +340,6 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
|
|||
*/
|
||||
private void createColumnVisitList() {
|
||||
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];
|
||||
|
||||
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) {
|
||||
if (!blockedColumns[searchX][searchZ]) {
|
||||
Integer height = columnHeights[searchX][searchZ];
|
||||
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);
|
||||
|
||||
if (!BlockUtils.canChangeBlock(block, worldObj, bx, by, bz)) {
|
||||
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});
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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) {
|
||||
Block block = worldObj.getBlock(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
|
||||
|
|
|
@ -265,8 +265,10 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
|
||||
private int getBuildListCount() {
|
||||
int out = 0;
|
||||
for (int i = 0; i < buildStageOccurences.length; i++) {
|
||||
out += buildStageOccurences[i];
|
||||
if (buildStageOccurences != null) {
|
||||
for (int i = 0; i < buildStageOccurences.length; i++) {
|
||||
out += buildStageOccurences[i];
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class BlockBuildCraftFluid extends BlockFluidClassic {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
||||
public boolean canDropFromExplosion(Explosion explosion) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ public final class BlockUtils {
|
|||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean isAnObstructingBlock(Block block, World world, int x, int y, int z) {
|
||||
if (block == null || block.isAir(world, x, y, z)) {
|
||||
return false;
|
||||
|
@ -139,13 +140,13 @@ public final class BlockUtils {
|
|||
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) {
|
||||
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;
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.IBlockAccess;
|
|||
import buildcraft.api.core.BuildCraftAPI;
|
||||
|
||||
public class WorldPropertyIsSoft extends WorldProperty {
|
||||
|
||||
@Override
|
||||
public boolean get(IBlockAccess blockAccess, Block block, int meta, int x, int y, int z) {
|
||||
return block == null
|
||||
|
|
|
@ -62,7 +62,10 @@ public class DockingStationPipe extends DockingStation {
|
|||
|
||||
public IPipeTile getPipe() {
|
||||
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()) {
|
||||
|
|
|
@ -10,11 +10,10 @@ package buildcraft.robotics.ai;
|
|||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.DockingStation;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.lib.inventory.ITransactor;
|
||||
import buildcraft.core.lib.inventory.Transactor;
|
||||
|
@ -37,18 +36,24 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
|||
filter = new AggregateFilter(ActionRobotFilterTool.getGateFilter(iRobot.getLinkedStation()), iFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (robot.getDockingStation() == null) {
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
||||
} else {
|
||||
if (delay++ > 40) {
|
||||
if (equipItemStack()) {
|
||||
terminate();
|
||||
} else {
|
||||
delay = 0;
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
||||
}
|
||||
setSuccess(false);
|
||||
terminate();
|
||||
}
|
||||
|
||||
if (delay++ > 40) {
|
||||
if (equipItemStack()) {
|
||||
terminate();
|
||||
} else {
|
||||
delay = 0;
|
||||
startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,31 +76,20 @@ public class AIRobotFetchAndEquipItemStack extends AIRobot {
|
|||
}
|
||||
|
||||
private boolean equipItemStack() {
|
||||
if (robot.getDockingStation() != null) {
|
||||
DockingStation station = robot.getDockingStation();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemFound != null) {
|
||||
robot.setItemInUse(itemFound);
|
||||
return true;
|
||||
}
|
||||
IInventory tileInventory = robot.getDockingStation().getItemInput();
|
||||
if (tileInventory == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ITransactor trans = Transactor.getTransactorFor(tileInventory);
|
||||
|
||||
ItemStack itemFound = trans.remove(filter, ForgeDirection.UNKNOWN, true);
|
||||
|
||||
if (itemFound != null) {
|
||||
robot.setItemInUse(itemFound);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
|
|||
if (station == robot.getLinkedStation() && station == robot.getDockingStation()) {
|
||||
terminate();
|
||||
} else {
|
||||
if (station.takeAsMain(robot)) {
|
||||
if (station != null && station.takeAsMain(robot)) {
|
||||
startDelegateAI(new AIRobotGotoBlock(robot,
|
||||
station.x() + station.side().offsetX * 2,
|
||||
station.y() + station.side().offsetY * 2,
|
||||
|
@ -52,10 +52,10 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
|
|||
public void delegateAIEnded(AIRobot ai) {
|
||||
if (ai instanceof AIRobotGotoBlock) {
|
||||
if (ai.success()) {
|
||||
startDelegateAI(new AIRobotStraightMoveTo(robot,
|
||||
station.x() + 0.5F + station.side().offsetX * 0.5F,
|
||||
station.y() + 0.5F + station.side().offsetY * 0.5F,
|
||||
station.z() + 0.5F + station.side().offsetZ * 0.5F));
|
||||
startDelegateAI(new AIRobotStraightMoveTo(robot,
|
||||
station.x() + 0.5F + station.side().offsetX * 0.5F,
|
||||
station.y() + 0.5F + station.side().offsetY * 0.5F,
|
||||
station.z() + 0.5F + station.side().offsetZ * 0.5F));
|
||||
} else {
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import buildcraft.api.robots.EntityRobotBase;
|
|||
import buildcraft.core.lib.inventory.filters.IStackFilter;
|
||||
import buildcraft.robotics.ai.AIRobotBreak;
|
||||
import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack;
|
||||
import buildcraft.robotics.ai.AIRobotSleep;
|
||||
import buildcraft.robotics.ai.AIRobotGotoSleep;
|
||||
|
||||
public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock {
|
||||
|
||||
|
@ -45,7 +45,7 @@ public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearc
|
|||
public void delegateAIEnded(AIRobot ai) {
|
||||
if (ai instanceof AIRobotFetchAndEquipItemStack) {
|
||||
if (!ai.success()) {
|
||||
startDelegateAI(new AIRobotSleep(robot));
|
||||
startDelegateAI(new AIRobotGotoSleep(robot));
|
||||
}
|
||||
} else if (ai instanceof AIRobotBreak) {
|
||||
releaseBlockFound(ai.success());
|
||||
|
|
|
@ -20,12 +20,10 @@ import buildcraft.BuildCraftSilicon;
|
|||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.core.lib.block.TileBuildCraft;
|
||||
import buildcraft.core.lib.inventory.InventoryConcatenator;
|
||||
import buildcraft.core.lib.inventory.InventoryIterator;
|
||||
import buildcraft.core.lib.inventory.SimpleInventory;
|
||||
import buildcraft.core.lib.inventory.StackHelper;
|
||||
import buildcraft.core.lib.utils.NBTUtils;
|
||||
import buildcraft.core.lib.utils.Utils;
|
||||
|
||||
public class TilePackager extends TileBuildCraft implements ISidedInventory {
|
||||
private class Requirement {
|
||||
|
@ -65,11 +63,12 @@ public class TilePackager extends TileBuildCraft implements ISidedInventory {
|
|||
return location.hashCode() + (slot * 17);
|
||||
}
|
||||
}
|
||||
private static final int[] SLOTS = Utils.createSlotArray(0, 12);
|
||||
|
||||
// Slot 10 is currently missing. Left in for backwards compat.
|
||||
private static final int[] SLOTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11};
|
||||
|
||||
public SimpleInventory inventoryPublic = new SimpleInventory(12, "Packager", 64);
|
||||
public SimpleInventory inventoryPattern = new SimpleInventory(9, "Packager", 64);
|
||||
public IInventory visibleInventory = InventoryConcatenator.make().add(inventoryPublic).add(inventoryPattern);
|
||||
|
||||
private Requirement[] requirements = new Requirement[9];
|
||||
private int patternsSet;
|
||||
|
@ -406,27 +405,27 @@ public class TilePackager extends TileBuildCraft implements ISidedInventory {
|
|||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return visibleInventory.getSizeInventory();
|
||||
return inventoryPublic.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return visibleInventory.getStackInSlot(slot);
|
||||
return inventoryPublic.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return visibleInventory.decrStackSize(slot, amount);
|
||||
return inventoryPublic.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return visibleInventory.getStackInSlotOnClosing(slot);
|
||||
return inventoryPublic.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
visibleInventory.setInventorySlotContents(slot, stack);
|
||||
inventoryPublic.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -446,17 +445,17 @@ public class TilePackager extends TileBuildCraft implements ISidedInventory {
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return visibleInventory.isUseableByPlayer(player);
|
||||
return inventoryPublic.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
visibleInventory.openInventory();
|
||||
inventoryPublic.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
visibleInventory.closeInventory();
|
||||
inventoryPublic.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -464,7 +463,7 @@ public class TilePackager extends TileBuildCraft implements ISidedInventory {
|
|||
if (slot == 9) {
|
||||
return stack == null || stack.getItem() == Items.paper || stack.getItem() instanceof ItemPackage;
|
||||
}
|
||||
return visibleInventory.isItemValidForSlot(slot, stack);
|
||||
return inventoryPublic.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -112,7 +112,12 @@ public class TileStampingTable extends TileLaserTableBase implements IHasWork, I
|
|||
NBTTagCompound tag = NBTUtils.getItemData(input);
|
||||
for (int i = 0; i < 9; 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 {
|
||||
crafting.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ package buildcraft.silicon.gui;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -21,7 +20,6 @@ import buildcraft.silicon.TilePackager;
|
|||
|
||||
public class ContainerPackager extends BuildCraftContainer {
|
||||
private final TilePackager tile;
|
||||
// private int lastProgress;
|
||||
|
||||
public ContainerPackager(InventoryPlayer inventoryplayer, TilePackager t) {
|
||||
super(t.getSizeInventory());
|
||||
|
@ -38,14 +36,13 @@ public class ContainerPackager extends BuildCraftContainer {
|
|||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
addSlotToContainer(new SlotPackager(tile, 12 + x + y * 3, 30 + x * 18, 17 + y * 18));
|
||||
addSlotToContainer(new SlotPackager(tile.inventoryPattern, x + y * 3, 30 + x * 18, 17 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
// addSlotToContainer(new Slot(tile, 10, 108, 31));
|
||||
addSlotToContainer(new SlotOutput(tile, 11, 123, 59));
|
||||
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
addSlotToContainer(new Slot(inventoryplayer, x + y * 9 + 9, 8 + x * 18, 115 + y * 18));
|
||||
|
@ -59,48 +56,13 @@ public class ContainerPackager extends BuildCraftContainer {
|
|||
onCraftMatrixChanged(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting icrafting) {
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
//icrafting.sendProgressBarUpdate(this, 0, tile.progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
/*for (int i = 0; i < crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) crafters.get(i);
|
||||
|
||||
if (lastProgress != tile.progress) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, tile.progress);
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack output = craftResult.getStackInSlot(0);
|
||||
if (output != prevOutput) {
|
||||
prevOutput = output;
|
||||
onCraftMatrixChanged(tile.craftMatrix);
|
||||
}
|
||||
|
||||
lastProgress = tile.progress;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int id, int data) {
|
||||
/*switch (id) {
|
||||
case 0:
|
||||
tile.progress = data;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
||||
ItemStack out = super.slotClick(slotNum, mouseButton, modifier, player);
|
||||
Slot slot = slotNum < 0 ? null : (Slot) this.inventorySlots.get(slotNum);
|
||||
ItemStack out = super.slotClick(slotNum, mouseButton, slot instanceof SlotPackager ? 0 : modifier, player);
|
||||
|
||||
if (slot instanceof SlotPackager) {
|
||||
int idx = slot.getSlotIndex() - 12;
|
||||
int idx = slot.getSlotIndex();
|
||||
ItemStack stack = player != null && player.inventory != null ? player.inventory.getItemStack() : null;
|
||||
if (stack == null) {
|
||||
tile.setPatternSlot(idx, !tile.isPatternSlotSet(idx));
|
||||
|
|
|
@ -46,9 +46,5 @@ public class GuiPackager extends GuiBuildCraft {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*if (bench.progress > 0) {
|
||||
int progress = bench.getProgressScaled(23);
|
||||
drawTexturedModalRect(guiLeft + 89, guiTop + 45, 176, 0, progress + 1, 12);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,18 +47,22 @@ public class PackageFontRenderer extends FontRenderer {
|
|||
|
||||
if (pkgTag.hasKey("item" + slotPos)) {
|
||||
ItemStack slotStack = ItemStack.loadItemStackFromNBT(pkgTag.getCompoundTag("item" + slotPos));
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
FontRenderer font = slotStack.getItem().getFontRenderer(slotStack);
|
||||
itemRender.zLevel = 200.0F;
|
||||
if (slotStack != null) {
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
FontRenderer font = slotStack.getItem().getFontRenderer(slotStack);
|
||||
itemRender.zLevel = 200.0F;
|
||||
|
||||
if (font == null || font instanceof PackageFontRenderer) {
|
||||
font = Minecraft.getMinecraft().fontRenderer;
|
||||
if (font == null || font instanceof PackageFontRenderer) {
|
||||
font = Minecraft.getMinecraft().fontRenderer;
|
||||
}
|
||||
|
||||
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||
itemRender.zLevel = 0.0F;
|
||||
} else {
|
||||
realRenderer.drawString("X", rx, y, 0xFF0000);
|
||||
}
|
||||
|
||||
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), slotStack, rx * 2, y * 2);
|
||||
itemRender.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
rx += 7;
|
||||
|
|
|
@ -226,9 +226,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
return;
|
||||
}
|
||||
|
||||
if (fluidType != null) {
|
||||
moveFluids();
|
||||
}
|
||||
moveFluids();
|
||||
|
||||
if (networkSyncTracker.markTimeIfDelay(container.getWorldObj())) {
|
||||
boolean init = false;
|
||||
|
@ -245,17 +243,22 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
|
||||
private void moveFluids() {
|
||||
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
|
||||
short outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
|
||||
if (fluidType != null) {
|
||||
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
|
||||
int outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
|
||||
|
||||
moveFromPipe(outputCount);
|
||||
moveFromCenter();
|
||||
moveToCenter();
|
||||
if (fluidType != null) {
|
||||
moveFromPipe(outputCount);
|
||||
moveFromCenter();
|
||||
moveToCenter();
|
||||
}
|
||||
} else {
|
||||
computeTTLs();
|
||||
}
|
||||
}
|
||||
|
||||
private void moveFromPipe(short outputCount) {
|
||||
private void moveFromPipe(int outputCount) {
|
||||
// Move liquid from the non-center to the connected output blocks
|
||||
boolean pushed = false;
|
||||
if (outputCount > 0) {
|
||||
for (ForgeDirection o : directions) {
|
||||
if (transferState[o.ordinal()] == TransferState.Output) {
|
||||
|
@ -270,7 +273,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
if (liquidToPush.amount > 0) {
|
||||
int filled = ((IFluidHandler) target).fill(o.getOpposite(), liquidToPush, true);
|
||||
section.drain(filled, true);
|
||||
pushed = true;
|
||||
if (filled <= 0) {
|
||||
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() {
|
||||
|
@ -361,43 +350,76 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
}
|
||||
|
||||
private short computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) {
|
||||
short outputCount = 0;
|
||||
private void computeTTLs() {
|
||||
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) {
|
||||
sections[direction.ordinal()].setTime(newTimeSlot);
|
||||
sections[direction.ordinal()].moveFluids();
|
||||
int dirI = direction.ordinal();
|
||||
PipeSection section = sections[dirI];
|
||||
|
||||
fluidAmount += section.amount;
|
||||
section.setTime(newTimeSlot);
|
||||
section.moveFluids();
|
||||
|
||||
// Input processing
|
||||
if (direction == ForgeDirection.UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
if (transferState[direction.ordinal()] == TransferState.Input) {
|
||||
inputTTL[direction.ordinal()]--;
|
||||
if (inputTTL[direction.ordinal()] <= 0) {
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
if (transferState[dirI] == TransferState.Input) {
|
||||
inputTTL[dirI]--;
|
||||
if (inputTTL[dirI] <= 0) {
|
||||
transferState[dirI] = TransferState.None;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!container.pipe.outputOpen(direction)) {
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
transferState[dirI] = TransferState.None;
|
||||
continue;
|
||||
}
|
||||
if (outputCooldown[direction.ordinal()] > 0) {
|
||||
outputCooldown[direction.ordinal()]--;
|
||||
if (outputCooldown[dirI] > 0) {
|
||||
outputCooldown[dirI]--;
|
||||
continue;
|
||||
}
|
||||
if (outputTTL[direction.ordinal()] <= 0) {
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
outputCooldown[direction.ordinal()] = OUTPUT_COOLDOWN;
|
||||
outputTTL[direction.ordinal()] = OUTPUT_TTL;
|
||||
if (outputTTL[dirI] <= 0) {
|
||||
transferState[dirI] = TransferState.None;
|
||||
outputCooldown[dirI] = OUTPUT_COOLDOWN;
|
||||
outputTTL[dirI] = OUTPUT_TTL;
|
||||
continue;
|
||||
}
|
||||
if (canReceiveCache[direction.ordinal()] && outputOpen(direction)) {
|
||||
transferState[direction.ordinal()] = TransferState.Output;
|
||||
if (canReceiveCache[dirI] && outputOpen(direction)) {
|
||||
transferState[dirI] = TransferState.Output;
|
||||
outputCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (fluidAmount == 0) {
|
||||
setFluidType(null);
|
||||
}
|
||||
|
||||
return outputCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,8 @@ import java.util.Locale;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
|
@ -95,30 +93,18 @@ public class TriggerPipeContents extends BCStatement implements ITriggerInternal
|
|||
} else if (pipe.transport instanceof PipeTransportFluids) {
|
||||
PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport;
|
||||
|
||||
FluidStack searchedFluid = null;
|
||||
|
||||
if (parameter != null && parameter.getItemStack() != null) {
|
||||
searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
|
||||
}
|
||||
|
||||
if (kind == PipeContents.empty) {
|
||||
for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
|
||||
if (b.fluid != null && b.fluid.amount != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return transportFluids.fluidType == null;
|
||||
} else {
|
||||
for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
|
||||
if (b.fluid != null && b.fluid.amount != 0) {
|
||||
if (searchedFluid == null || searchedFluid.isFluidEqual(b.fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parameter != null && parameter.getItemStack() != null) {
|
||||
FluidStack searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
|
||||
|
||||
return false;
|
||||
if (searchedFluid != null) {
|
||||
return transportFluids.fluidType != null && searchedFluid.isFluidEqual(transportFluids.fluidType);
|
||||
}
|
||||
} else {
|
||||
return transportFluids.fluidType != null;
|
||||
}
|
||||
}
|
||||
} else if (pipe.transport instanceof PipeTransportPower) {
|
||||
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||
|
|
Loading…
Reference in a new issue