A few fixes and new mechanics
This commit is contained in:
parent
41eda67517
commit
5f2545d8e8
4 changed files with 51 additions and 37 deletions
|
@ -48,21 +48,10 @@ public class RobitAIPickup extends EntityAIBase
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldExecute()
|
public boolean shouldExecute()
|
||||||
{
|
{
|
||||||
EntityPlayer player = theRobit.getOwner();
|
|
||||||
|
|
||||||
if(player == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!theRobit.getDropPickup())
|
if(!theRobit.getDropPickup())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(theRobit.worldObj.provider.dimensionId != player.worldObj.provider.dimensionId)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(closest != null && closest.getDistanceSqToEntity(closest) > 100 && thePathfinder.getPathToXYZ(closest.posX, closest.posY, closest.posZ) != null)
|
if(closest != null && closest.getDistanceSqToEntity(closest) > 100 && thePathfinder.getPathToXYZ(closest.posX, closest.posY, closest.posZ) != null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -105,7 +94,7 @@ public class RobitAIPickup extends EntityAIBase
|
||||||
@Override
|
@Override
|
||||||
public boolean continueExecuting()
|
public boolean continueExecuting()
|
||||||
{
|
{
|
||||||
return !closest.isDead && !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(closest) > (100) && theRobit.getFollowing() && theRobit.getEnergy() > 0 && closest.worldObj.provider.dimensionId == theRobit.worldObj.provider.dimensionId;
|
return !closest.isDead && !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(closest) > 100 && theRobit.getFollowing() && theRobit.getEnergy() > 0 && closest.worldObj.provider.dimensionId == theRobit.worldObj.provider.dimensionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -169,6 +169,25 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tileEntity instanceof TileEntityLogisticalSorter)
|
||||||
|
{
|
||||||
|
TileEntityLogisticalSorter transporter = (TileEntityLogisticalSorter)tileEntity;
|
||||||
|
|
||||||
|
if(!world.isRemote && !transporter.hasInventory())
|
||||||
|
{
|
||||||
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
TileEntity tile = Object3D.get(transporter).getFromSide(dir).getTileEntity(world);
|
||||||
|
|
||||||
|
if(tile instanceof IInventory)
|
||||||
|
{
|
||||||
|
transporter.setFacing((short)dir.getOpposite().ordinal());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tileEntity.setFacing((short)change);
|
tileEntity.setFacing((short)change);
|
||||||
|
|
||||||
if(tileEntity instanceof IBoundingBlock)
|
if(tileEntity instanceof IBoundingBlock)
|
||||||
|
|
|
@ -8,9 +8,11 @@ import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.PacketHandler.Transmission;
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.item.ItemBlockBasic;
|
import mekanism.common.item.ItemBlockBasic;
|
||||||
import mekanism.common.network.PacketTileEntity;
|
import mekanism.common.network.PacketTileEntity;
|
||||||
|
import mekanism.common.util.InventoryUtils;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
import mekanism.common.util.TransporterUtils;
|
import mekanism.common.util.TransporterUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -174,6 +176,10 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
|
||||||
setInventorySlotContents(0, null);
|
setInventorySlotContents(0, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(tile instanceof IInventory)
|
||||||
|
{
|
||||||
|
setInventorySlotContents(0, InventoryUtils.putStackInInventory((IInventory)tile, getStack(), 0, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,23 +108,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
{
|
{
|
||||||
ChargeUtils.discharge(27, this);
|
ChargeUtils.discharge(27, this);
|
||||||
|
|
||||||
if(doEject && getTopEject(false, null) != null && getEjectInv() != null)
|
|
||||||
{
|
|
||||||
if(getEjectInv() instanceof IInventory)
|
|
||||||
{
|
|
||||||
ItemStack remains = InventoryUtils.putStackInInventory((IInventory)getEjectInv(), getTopEject(false, null), ForgeDirection.getOrientation(facing).getOpposite().ordinal(), false);
|
|
||||||
|
|
||||||
getTopEject(true, remains);
|
|
||||||
}
|
|
||||||
else if(getEjectInv() instanceof TileEntityLogisticalTransporter)
|
|
||||||
{
|
|
||||||
if(TransporterUtils.insert(getEjectTile(), (TileEntityLogisticalTransporter)getEjectInv(), getTopEject(false, null), null))
|
|
||||||
{
|
|
||||||
getTopEject(true, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(running && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
if(running && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||||
{
|
{
|
||||||
setActive(true);
|
setActive(true);
|
||||||
|
@ -198,6 +181,23 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(doEject && getTopEject(false, null) != null && getEjectInv() != null)
|
||||||
|
{
|
||||||
|
if(getEjectInv() instanceof IInventory)
|
||||||
|
{
|
||||||
|
ItemStack remains = InventoryUtils.putStackInInventory((IInventory)getEjectInv(), getTopEject(false, null), ForgeDirection.getOrientation(facing).getOpposite().ordinal(), false);
|
||||||
|
|
||||||
|
getTopEject(true, remains);
|
||||||
|
}
|
||||||
|
else if(getEjectInv() instanceof TileEntityLogisticalTransporter)
|
||||||
|
{
|
||||||
|
if(TransporterUtils.insert(getEjectTile(), (TileEntityLogisticalTransporter)getEjectInv(), getTopEject(false, null), null))
|
||||||
|
{
|
||||||
|
getTopEject(true, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(playersUsing.size() > 0)
|
if(playersUsing.size() > 0)
|
||||||
{
|
{
|
||||||
for(EntityPlayer player : playersUsing)
|
for(EntityPlayer player : playersUsing)
|
||||||
|
|
Loading…
Reference in a new issue