This commit is contained in:
CovertJaguar 2013-08-09 01:41:42 -07:00
commit 95cbf27ba7
23 changed files with 106 additions and 85 deletions

View file

@ -18,13 +18,8 @@
<property name="mcpsrc.dir" value="${mcp.dir}/src"/>
<<<<<<< HEAD
<property name="mc.version" value="1.5.2"/>
<property name="forge.version" value="7.8.1.738"/>
=======
<property name="mc.version" value="1.6.2"/>
<property name="forge.version" value="9.10.0.800"/>
>>>>>>> mc16
<!-- <property name="project.version" value="0.0.0"/>-->
<property name="buildcraft.name" value="buildcraft"/>

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Thu Aug 01 17:24:24 CEST 2013
build.number=37
#Fri Aug 09 09:44:46 CEST 2013
build.number=39

View file

@ -17,7 +17,7 @@
<property name="mc.version" value="1.6.2"/>
<property name="forge.version" value="9.10.0.807"/>
<property name="bc.version" value="4.0.0"/>
<property name="bc.version" value="4.0.1"/>
<property name="bc.version.full" value="${bc.version}"/>

View file

@ -0,0 +1,8 @@
#3.7.2
- Added: Filtered Buffer. See http://www.youtube.com/watch?v=-Fusb7bEQW4 (SandGrainOne)
- Changed: Added colour modifier support to facades. (CovertJaguar)
- Changed: Tweaked selection box for plugs to make it easier to place plugs even on adjacent pipes. (CovertJaguar)
- Bugfix: Fixed log rotation recipes for facades again. (cpw)
- Bugfix: Fixed edge case where the ACT might not consider items as crafting equivalents if those were registered multiple times with the ore dictionary.

View file

@ -0,0 +1,5 @@
#4.0.1
- Bugfix: Fixed a critical issue with the safetime tracker.
- Bugfix: Fixed a dupe glitch in the automatic work bench.

View file

@ -22,7 +22,7 @@ public class SafeTimeTracker {
if (world == null)
return false;
long currentTime = world.getWorldTime();
long currentTime = world.getTotalWorldTime();
if (currentTime < lastMark) {
lastMark = currentTime;
@ -41,6 +41,6 @@ public class SafeTimeTracker {
}
public void markTime(World world) {
lastMark = world.getWorldTime();
lastMark = world.getTotalWorldTime();
}
}

View file

@ -1,15 +1,18 @@
package buildcraft.core.liquids;
package buildcraft.core.fluids;
import buildcraft.core.TileBuffer;
import buildcraft.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
/**
*
@ -72,4 +75,23 @@ public class FluidUtils {
return moving ? Block.lavaMoving.blockID : Block.lavaStill.blockID;
return fluid.getBlockID();
}
public static void pushFluidToConsumers(IFluidTank tank, int flowCap, TileBuffer[] tileBuffer) {
int amountToPush = flowCap;
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
FluidStack fluidStack = tank.drain(amountToPush, false);
if (fluidStack != null && fluidStack.amount > 0) {
TileEntity tile = tileBuffer[side.ordinal()].getTile();
if (tile instanceof IFluidHandler) {
int used = ((IFluidHandler) tile).fill(side.getOpposite(), fluidStack, true);
if (used > 0) {
amountToPush -= used;
tank.drain(used, true);
if (amountToPush <= 0)
return;
}
}
}
}
}
}

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.liquids;
package buildcraft.core.fluids;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.liquids;
package buildcraft.core.fluids;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.liquids;
package buildcraft.core.fluids;
import buildcraft.core.gui.tooltips.ToolTip;
import buildcraft.core.gui.tooltips.ToolTipLine;

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.liquids;
package buildcraft.core.fluids;
import com.google.common.collect.ForwardingList;
import cpw.mods.fml.relauncher.Side;

View file

@ -3,8 +3,10 @@ package buildcraft.core.inventory;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
import buildcraft.core.inventory.filters.ArrayStackFilter;
import buildcraft.core.inventory.filters.IStackFilter;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
/**
@ -82,4 +84,36 @@ public class InvUtils {
public static ItemStack moveOneItem(IInventory source, ForgeDirection output, IInventory dest, ForgeDirection intput, ItemStack... filter) {
return moveOneItem(source, output, dest, intput, new ArrayStackFilter(filter));
}
/* STACK DROPS */
public static void dropItems(World world, ItemStack stack, int i, int j, int k) {
if (stack.stackSize <= 0) {
return;
}
float f1 = 0.7F;
double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
EntityItem entityitem = new EntityItem(world, i + d, j + d1, k + d2, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
public static void dropItems(World world, IInventory inv, int i, int j, int k) {
for (int slot = 0; slot < inv.getSizeInventory(); ++slot) {
ItemStack items = inv.getStackInSlot(slot);
if (items != null && items.stackSize > 0) {
dropItems(world, inv.getStackInSlot(slot).copy(), i, j, k);
}
}
}
public static void wipeInventory(IInventory inv) {
for (int slot = 0; slot < inv.getSizeInventory(); ++slot) {
inv.setInventorySlotContents(slot, null);
}
}
}

View file

@ -11,7 +11,6 @@ import buildcraft.BuildCraftCore;
import buildcraft.api.core.IAreaProvider;
import buildcraft.api.core.LaserKind;
import buildcraft.api.core.Position;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.core.BlockIndex;
@ -20,6 +19,7 @@ import buildcraft.core.IDropControlInventory;
import buildcraft.core.IFramePipeConnection;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.ITransactor;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.Transactor;
import buildcraft.core.network.ISynchronizedTile;
import buildcraft.core.network.PacketUpdate;
@ -32,7 +32,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryLargeChest;
import net.minecraft.item.ItemStack;
@ -162,32 +161,6 @@ public class Utils {
return 0;
}
/* STACK DROPS */
public static void dropItems(World world, ItemStack stack, int i, int j, int k) {
if (stack.stackSize <= 0) {
return;
}
float f1 = 0.7F;
double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
EntityItem entityitem = new EntityItem(world, i + d, j + d1, k + d2, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
public static void dropItems(World world, IInventory inventory, int i, int j, int k) {
for (int l = 0; l < inventory.getSizeInventory(); ++l) {
ItemStack items = inventory.getStackInSlot(l);
if (items != null && items.stackSize > 0) {
dropItems(world, inventory.getStackInSlot(l).copy(), i, j, k);
}
}
}
public static TileEntity getTile(World world, Position pos, ForgeDirection step) {
Position tmp = new Position(pos);
tmp.orientation = step;
@ -364,7 +337,8 @@ public class Utils {
if (tile instanceof IInventory && !CoreProxy.proxy.isRenderWorld(world)) {
if (!(tile instanceof IDropControlInventory) || ((IDropControlInventory) tile).doDrop()) {
dropItems(world, (IInventory) tile, i, j, k);
InvUtils.dropItems(world, (IInventory) tile, i, j, k);
InvUtils.wipeInventory((IInventory)tile);
}
}

View file

@ -21,10 +21,10 @@ import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.core.DefaultProps;
import buildcraft.core.TileBuffer;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.network.TileNetworkData;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import buildcraft.energy.gui.ContainerEngine;
import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
@ -360,7 +360,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
}
public void delete() {
Utils.dropItems(worldObj, inv, xCoord, yCoord, zCoord);
InvUtils.dropItems(worldObj, inv, xCoord, yCoord, zCoord);
}
@Override

View file

@ -16,9 +16,9 @@ import buildcraft.api.fuels.IronEngineFuel.Fuel;
import buildcraft.api.gates.ITrigger;
import buildcraft.core.GuiIds;
import buildcraft.core.IItemPipe;
import buildcraft.core.liquids.FluidUtils;
import buildcraft.core.liquids.Tank;
import buildcraft.core.liquids.TankManager;
import buildcraft.core.fluids.FluidUtils;
import buildcraft.core.fluids.Tank;
import buildcraft.core.fluids.TankManager;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import buildcraft.energy.gui.ContainerEngine;

View file

@ -8,6 +8,7 @@
package buildcraft.factory;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.InventoryConcatenator;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
@ -82,12 +83,6 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
}
}
@Override
public void destroy() {
super.destroy();
Utils.dropItems(worldObj, craftMatrix, xCoord, yCoord, zCoord);
}
@Override
public int getSizeInventory() {
return 10;
@ -268,7 +263,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
ItemStack stack = slot.getStackInSlot();
if (stack != null) {
slot.setStackInSlot(null);
Utils.dropItems(worldObj, stack, xCoord, yCoord + 1, zCoord);
InvUtils.dropItems(worldObj, stack, xCoord, yCoord + 1, zCoord);
}
}
}

View file

@ -10,8 +10,8 @@ package buildcraft.factory;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.core.BlockIndex;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.liquids.FluidUtils;
import buildcraft.core.liquids.Tank;
import buildcraft.core.fluids.FluidUtils;
import buildcraft.core.fluids.Tank;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.BlockUtil;
import buildcraft.core.utils.Utils;

View file

@ -20,7 +20,8 @@ import buildcraft.core.EntityBlock;
import buildcraft.core.IMachine;
import buildcraft.core.TileBuffer;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.liquids.SingleUseTank;
import buildcraft.core.fluids.FluidUtils;
import buildcraft.core.fluids.SingleUseTank;
import buildcraft.core.network.PacketPayload;
import buildcraft.core.network.PacketPayloadStream;
import buildcraft.core.network.PacketUpdate;
@ -133,23 +134,9 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
}
private void pushToConsumers() {
FluidStack fluidStack = tank.getFluid();
if (fluidStack != null && fluidStack.amount > 0) {
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
TileEntity tile = getTile(side);
if (tile instanceof IFluidHandler) {
int moved = ((IFluidHandler) tile).fill(side.getOpposite(), fluidStack, true);
if (moved > 0) {
tank.drain(moved, true);
fluidStack = tank.getFluid();
if (fluidStack == null || fluidStack.amount <= 0) {
break;
}
}
}
}
}
if(tileBuffer == null)
tileBuffer = TileBuffer.makeBuffer(worldObj, xCoord, yCoord, zCoord, false);
FluidUtils.pushFluidToConsumers(tank, 400, tileBuffer);
}
private TileEntity getTile(ForgeDirection side) {

View file

@ -18,8 +18,8 @@ import buildcraft.api.recipes.RefineryRecipes;
import buildcraft.api.recipes.RefineryRecipes.Recipe;
import buildcraft.core.IMachine;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.liquids.Tank;
import buildcraft.core.liquids.TankManager;
import buildcraft.core.fluids.Tank;
import buildcraft.core.fluids.TankManager;
import buildcraft.core.network.PacketPayload;
import buildcraft.core.network.PacketPayloadStream;
import buildcraft.core.network.PacketUpdate;

View file

@ -10,8 +10,8 @@ package buildcraft.factory;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.core.TileBuildCraft;
import buildcraft.core.liquids.Tank;
import buildcraft.core.liquids.TankManager;
import buildcraft.core.fluids.Tank;
import buildcraft.core.fluids.TankManager;
import buildcraft.core.network.PacketPayload;
import buildcraft.core.network.PacketPayloadStream;
import buildcraft.core.network.PacketUpdate;

View file

@ -349,7 +349,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
output.stackSize -= Utils.addToRandomInventoryAround(worldObj, xCoord, yCoord, zCoord, output);
}
if (output.stackSize > 0) {
Utils.dropItems(worldObj, output, xCoord, yCoord + 1, zCoord);
InvUtils.dropItems(worldObj, output, xCoord, yCoord + 1, zCoord);
}
}
}

View file

@ -16,6 +16,7 @@ import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.TriggerParameter;
import buildcraft.api.transport.IPipe;
import buildcraft.core.IDropControlInventory;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.network.TilePacketWrapper;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
@ -374,7 +375,7 @@ public abstract class Pipe<T extends PipeTransport> implements IPipe, IDropContr
}
public void dropItem(ItemStack stack) {
Utils.dropItems(container.worldObj, stack, container.xCoord, container.yCoord, container.zCoord);
InvUtils.dropItems(container.worldObj, stack, container.xCoord, container.yCoord, container.zCoord);
}
public void onBlockRemoval() {

View file

@ -25,10 +25,10 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.IDropControlInventory;
import buildcraft.core.ITileBufferHolder;
import buildcraft.core.TileBuffer;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.network.IClientState;
import buildcraft.core.network.ISyncedTile;
import buildcraft.core.network.PacketTileState;
import buildcraft.core.utils.Utils;
import buildcraft.transport.Gate.GateKind;
import buildcraft.transport.network.PipeRenderStatePacket;
import cpw.mods.fml.relauncher.Side;
@ -565,7 +565,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
}
private void dropFacadeItem(ForgeDirection direction) {
Utils.dropItems(worldObj, ItemFacade.getStack(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()]), this.xCoord, this.yCoord, this.zCoord);
InvUtils.dropItems(worldObj, ItemFacade.getStack(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()]), this.xCoord, this.yCoord, this.zCoord);
}
public void dropFacade(ForgeDirection direction) {
@ -663,7 +663,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
return;
plugs[side.ordinal()] = false;
Utils.dropItems(worldObj, new ItemStack(BuildCraftTransport.plugItem), this.xCoord, this.yCoord, this.zCoord);
InvUtils.dropItems(worldObj, new ItemStack(BuildCraftTransport.plugItem), this.xCoord, this.yCoord, this.zCoord);
worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, getBlockId());
scheduleNeighborChange(); //To force recalculation of connections
scheduleRenderUpdate();