Search in sources :

Example 11 with TileEntityMulti

use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.

the class BlockMulti method setBedOccupied.

@Override
public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) {
    TileEntity tileEntity = world.getTileEntity(pos);
    BlockPos mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;
    if (mainBlockPosition != null && !mainBlockPosition.equals(pos)) {
        world.getBlockState(mainBlockPosition).getBlock().setBedOccupied(world, mainBlockPosition, player, occupied);
    } else {
        super.setBedOccupied(world, pos, player, occupied);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityMulti(micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)

Example 12 with TileEntityMulti

use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.

the class BlockMulti method makeFakeBlock.

public void makeFakeBlock(World worldObj, Collection<BlockPos> posList, BlockPos mainBlock, EnumBlockMultiType type) {
    for (BlockPos pos : posList) {
        worldObj.setBlockState(pos, this.getDefaultState().withProperty(MULTI_TYPE, type), type == EnumBlockMultiType.CRYO_CHAMBER ? 3 : 0);
        worldObj.setTileEntity(pos, new TileEntityMulti(mainBlock));
    }
}
Also used : TileEntityMulti(micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)

Example 13 with TileEntityMulti

use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.

the class BlockMulti method breakBlock.

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntity tileEntity = worldIn.getTileEntity(pos);
    if (tileEntity instanceof TileEntityMulti) {
        ((TileEntityMulti) tileEntity).onBlockRemoval();
    }
    super.breakBlock(worldIn, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityMulti(micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)

Example 14 with TileEntityMulti

use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.

the class BlockMulti method getBedSpawnPosition.

@Override
public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) {
    if (!(world instanceof World)) {
        return null;
    }
    int tries = 3;
    World worldIn = (World) world;
    TileEntity tileEntity = worldIn.getTileEntity(pos);
    BlockPos mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;
    IBlockState cryoChamber = worldIn.getBlockState(mainBlockPosition);
    EnumFacing enumfacing = EnumFacing.NORTH;
    if (GalacticraftCore.isPlanetsLoaded && cryoChamber.getBlock() == MarsBlocks.machine) {
        enumfacing = (EnumFacing) cryoChamber.getValue(BlockMachineMars.FACING);
    }
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();
    for (int l = 0; l <= 1; ++l) {
        int i1 = i - enumfacing.getFrontOffsetX() * l - 1;
        int j1 = k - enumfacing.getFrontOffsetZ() * l - 1;
        int k1 = i1 + 2;
        int l1 = j1 + 2;
        for (int i2 = i1; i2 <= k1; ++i2) {
            for (int j2 = j1; j2 <= l1; ++j2) {
                BlockPos blockpos = new BlockPos(i2, j, j2);
                if (hasRoomForPlayer(worldIn, blockpos)) {
                    if (tries <= 0) {
                        return blockpos;
                    }
                    --tries;
                }
            }
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) World(net.minecraft.world.World) TileEntityMulti(micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)11 TileEntityMulti (micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)10 IBlockState (net.minecraft.block.state.IBlockState)4 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)3 BlockPos (net.minecraft.util.BlockPos)3 ICargoEntity (micdoodle8.mods.galacticraft.api.entity.ICargoEntity)2 Block (net.minecraft.block.Block)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 EnumFacing (net.minecraft.util.EnumFacing)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ArrayList (java.util.ArrayList)1 ICameraZoomEntity (micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity)1 IFuelable (micdoodle8.mods.galacticraft.api.entity.IFuelable)1 BlockMulti (micdoodle8.mods.galacticraft.core.blocks.BlockMulti)1 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 TileEntityMinerBase (micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityMinerBase)1 TileEntityCryogenicChamber (micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber)1 RendererLivingEntity (net.minecraft.client.renderer.entity.RendererLivingEntity)1