Search in sources :

Example 1 with ICargoEntity

use of micdoodle8.mods.galacticraft.api.entity.ICargoEntity in project Galacticraft by micdoodle8.

the class TileEntityCargoUnloader method checkForCargoEntity.

public void checkForCargoEntity() {
    boolean foundFuelable = false;
    BlockVec3 thisVec = new BlockVec3(this);
    for (final EnumFacing dir : EnumFacing.VALUES) {
        final TileEntity pad = thisVec.getTileEntityOnSide(this.worldObj, dir);
        if (pad != null && pad instanceof TileEntityMulti) {
            final TileEntity mainTile = ((TileEntityMulti) pad).getMainBlockTile();
            if (mainTile instanceof ICargoEntity) {
                this.attachedFuelable = (ICargoEntity) mainTile;
                foundFuelable = true;
                break;
            }
        } else if (pad != null && pad instanceof ICargoEntity) {
            this.attachedFuelable = (ICargoEntity) pad;
            foundFuelable = true;
            break;
        }
    }
    if (!foundFuelable) {
        this.attachedFuelable = null;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumFacing(net.minecraft.util.EnumFacing) ICargoEntity(micdoodle8.mods.galacticraft.api.entity.ICargoEntity) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 2 with ICargoEntity

use of micdoodle8.mods.galacticraft.api.entity.ICargoEntity in project Galacticraft by micdoodle8.

the class TileEntityCargoLoader method checkForCargoEntity.

public void checkForCargoEntity() {
    boolean foundFuelable = false;
    BlockVec3 thisVec = new BlockVec3(this);
    for (final EnumFacing dir : EnumFacing.VALUES) {
        final TileEntity pad = thisVec.getTileEntityOnSide(this.worldObj, dir);
        if (pad != null && pad instanceof TileEntityMulti) {
            final TileEntity mainTile = ((TileEntityMulti) pad).getMainBlockTile();
            if (mainTile instanceof ICargoEntity) {
                this.attachedFuelable = (ICargoEntity) mainTile;
                foundFuelable = true;
                break;
            }
        } else if (pad != null && pad instanceof ICargoEntity) {
            this.attachedFuelable = (ICargoEntity) pad;
            foundFuelable = true;
            break;
        }
    }
    if (!foundFuelable) {
        this.attachedFuelable = null;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ICargoEntity(micdoodle8.mods.galacticraft.api.entity.ICargoEntity) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Aggregations

ICargoEntity (micdoodle8.mods.galacticraft.api.entity.ICargoEntity)2 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)1