Added a delay to Digital Miner eject, have multipart Logistical Transporters drop contents when broken, fixed transporters insertion logic
This commit is contained in:
parent
7010f03b65
commit
047ead8d09
2 changed files with 26 additions and 6 deletions
|
@ -417,13 +417,13 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
|
|||
stack.homeLocation = original;
|
||||
stack.color = color;
|
||||
|
||||
ItemStack rejected = stack.recalculatePath(this, min);
|
||||
|
||||
if(!canReceiveFrom(original.getTileEntity(world()), ForgeDirection.getOrientation(stack.getSide(this))) || !stack.canInsertToTransporter(tile(), ForgeDirection.getOrientation(stack.getSide(this))))
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ItemStack rejected = stack.recalculatePath(this, min);
|
||||
|
||||
if(TransporterManager.didEmit(stack.itemStack, rejected))
|
||||
{
|
||||
stack.itemStack = TransporterManager.getToUse(stack.itemStack, rejected);
|
||||
|
@ -447,13 +447,13 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
|
|||
stack.homeLocation = Coord4D.get(outputter);
|
||||
stack.color = color;
|
||||
|
||||
ItemStack rejected = stack.recalculateRRPath(outputter, this, min);
|
||||
|
||||
if(!canReceiveFrom(outputter, ForgeDirection.getOrientation(stack.getSide(this))) || !stack.canInsertToTransporter(tile(), ForgeDirection.getOrientation(stack.getSide(this))))
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ItemStack rejected = stack.recalculateRRPath(outputter, this, min);
|
||||
|
||||
if(TransporterManager.didEmit(stack.itemStack, rejected))
|
||||
{
|
||||
stack.itemStack = TransporterManager.getToUse(stack.itemStack, rejected);
|
||||
|
@ -788,6 +788,18 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
|
|||
return getConnectionType(side) == ConnectionType.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved()
|
||||
{
|
||||
if(!world().isRemote)
|
||||
{
|
||||
for(TransporterStack stack : transit)
|
||||
{
|
||||
TransporterUtils.drop(this, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
|
|
|
@ -86,6 +86,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
public double prevEnergy;
|
||||
|
||||
public int delayTicks;
|
||||
|
||||
public boolean initCalc = false;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
|
@ -209,7 +211,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
}
|
||||
}
|
||||
|
||||
if(doEject && getTopEject(false, null) != null && getEjectInv() != null)
|
||||
if(doEject && delayTicks == 0 && getTopEject(false, null) != null && getEjectInv() != null)
|
||||
{
|
||||
if(getEjectInv() instanceof IInventory)
|
||||
{
|
||||
|
@ -220,12 +222,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
else if(getEjectInv() instanceof ILogisticalTransporter)
|
||||
{
|
||||
ItemStack rejected = TransporterUtils.insert(getEjectTile(), (ILogisticalTransporter)getEjectInv(), getTopEject(false, null), null, true, 0);
|
||||
|
||||
System.out.println(rejected + " " + (rejected != null ? rejected.stackSize : 0));
|
||||
if(TransporterManager.didEmit(getTopEject(false, null), rejected))
|
||||
{
|
||||
getTopEject(true, rejected);
|
||||
}
|
||||
}
|
||||
|
||||
delayTicks = 10;
|
||||
}
|
||||
else if(delayTicks > 0)
|
||||
{
|
||||
delayTicks--;
|
||||
}
|
||||
|
||||
if(playersUsing.size() > 0)
|
||||
|
|
Loading…
Reference in a new issue