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);
}
}
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));
}
}
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);
}
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;
}
Aggregations